Package org.apache.lucene.document

Examples of org.apache.lucene.document.Field.binaryValue()


    boolean warn = false;
    if (selEnc != null) enc = selEnc;
    int len = 0;
    byte[] data = null;
    if (f.binaryValue() != null) {
      BytesRef bytes = f.binaryValue();
      data = new byte[bytes.length];
      System.arraycopy(bytes.bytes, bytes.offset, data, 0,
          bytes.length);
    }
    else if (f.stringValue() != null) {
View Full Code Here


      return;
    }
    Object progress = null;
    try {
      byte[] data = null;
      if (f.binaryValue() != null) {
        BytesRef bytes = f.binaryValue();
        data = new byte[bytes.length];
        System.arraycopy(bytes.bytes, bytes.offset, data, 0,
            bytes.length);
      }
View Full Code Here

    }
    Object progress = null;
    try {
      byte[] data = null;
      if (f.binaryValue() != null) {
        BytesRef bytes = f.binaryValue();
        data = new byte[bytes.length];
        System.arraycopy(bytes.bytes, bytes.offset, data, 0,
            bytes.length);
      }
      else {
View Full Code Here

      }
      else if (fieldable instanceof Field) {
        Field safeField = (Field) fieldable;
        //FIXME it seems like in new Field implementation it's possible to have multiple data types at the same time. Investigate?
        //The following sequence of else/ifs would not be appropriate.
        if ( safeField.binaryValue() != null ) {
          serializer.addFieldWithBinaryData( new LuceneFieldContext( safeField ) );
        }
        else if ( safeField.stringValue() != null ) {
          serializer.addFieldWithStringData( new LuceneFieldContext( safeField ) );
        }
View Full Code Here

    for(int i=0;i<50;i++)
      b[i] = (byte) (i+77);

    Document doc = new Document();
    Field f = new StoredField("binary", b, 10, 17);
    byte[] bx = f.binaryValue().bytes;
    assertTrue(bx != null);
    assertEquals(50, bx.length);
    assertEquals(10, f.binaryValue().offset);
    assertEquals(17, f.binaryValue().length);
    doc.add(f);
View Full Code Here

    Document doc = new Document();
    Field f = new StoredField("binary", b, 10, 17);
    byte[] bx = f.binaryValue().bytes;
    assertTrue(bx != null);
    assertEquals(50, bx.length);
    assertEquals(10, f.binaryValue().offset);
    assertEquals(17, f.binaryValue().length);
    doc.add(f);
    w.addDocument(doc);
    w.close();
View Full Code Here

    Field f = new StoredField("binary", b, 10, 17);
    byte[] bx = f.binaryValue().bytes;
    assertTrue(bx != null);
    assertEquals(50, bx.length);
    assertEquals(10, f.binaryValue().offset);
    assertEquals(17, f.binaryValue().length);
    doc.add(f);
    w.addDocument(doc);
    w.close();

    IndexReader ir = DirectoryReader.open(dir);
View Full Code Here

    for(int i=0;i<50;i++)
      b[i] = (byte) (i+77);

    Document doc = new Document();
    Field f = new StoredField("binary", b, 10, 17);
    byte[] bx = f.binaryValue().bytes;
    assertTrue(bx != null);
    assertEquals(50, bx.length);
    assertEquals(10, f.binaryValue().offset);
    assertEquals(17, f.binaryValue().length);
    doc.add(f);
View Full Code Here

    Document doc = new Document();
    Field f = new StoredField("binary", b, 10, 17);
    byte[] bx = f.binaryValue().bytes;
    assertTrue(bx != null);
    assertEquals(50, bx.length);
    assertEquals(10, f.binaryValue().offset);
    assertEquals(17, f.binaryValue().length);
    doc.add(f);
    w.addDocument(doc);
    w.close();
View Full Code Here

    Field f = new StoredField("binary", b, 10, 17);
    byte[] bx = f.binaryValue().bytes;
    assertTrue(bx != null);
    assertEquals(50, bx.length);
    assertEquals(10, f.binaryValue().offset);
    assertEquals(17, f.binaryValue().length);
    doc.add(f);
    w.addDocument(doc);
    w.close();

    IndexReader ir = DirectoryReader.open(dir);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.