Package org.apache.lucene.document

Examples of org.apache.lucene.document.SortedDocValuesField


    IndexWriter writer = new IndexWriter(dir, conf);
   
    Document doc = new Document();
    doc.add(new StringField("key", "doc", Store.NO));
    doc.add(new NumericDocValuesField("ndv", 5));
    doc.add(new SortedDocValuesField("sorted", new BytesRef("value")));
    writer.addDocument(doc); // flushed document
    writer.commit();
    writer.addDocument(doc); // in-memory document
   
    writer.updateNumericDocValue(new Term("key", "doc"), "ndv", 17L);
View Full Code Here


      (byte)(id >>> 24), (byte)(id >>> 16),(byte)(id >>> 8),(byte)id
    };
    BytesRef ref = new BytesRef(bytes);
    doc.add(new BinaryDocValuesField("dvBytesDerefFixed", ref));
    doc.add(new BinaryDocValuesField("dvBytesDerefVar", ref));
    doc.add(new SortedDocValuesField("dvBytesSortedFixed", ref));
    doc.add(new SortedDocValuesField("dvBytesSortedVar", ref));
    doc.add(new BinaryDocValuesField("dvBytesStraightFixed", ref));
    doc.add(new BinaryDocValuesField("dvBytesStraightVar", ref));
    doc.add(new DoubleDocValuesField("dvDouble", (double)id));
    doc.add(new FloatDocValuesField("dvFloat", (float)id));
    doc.add(new NumericDocValuesField("dvInt", id));
View Full Code Here

    Directory dir = newDirectory();
    IndexWriterConfig iwc = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
    RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwc);
    Document doc = new Document();
    doc.add(new BinaryDocValuesField("binary", new BytesRef("binary value")));
    doc.add(new SortedDocValuesField("sorted", new BytesRef("sorted value")));
    doc.add(new NumericDocValuesField("numeric", 42));
    if (defaultCodecSupportsSortedSet()) {
      doc.add(new SortedSetDocValuesField("sortedset", new BytesRef("sortedset value1")));
      doc.add(new SortedSetDocValuesField("sortedset", new BytesRef("sortedset value2")));
    }
View Full Code Here

      document.add(new DoubleField("double", random().nextDouble(), Field.Store.NO));

      if (supportsDocValues) {
        document.add(new NumericDocValuesField("intdocvalues", random().nextInt()));
        document.add(new FloatDocValuesField("floatdocvalues", random().nextFloat()));
        document.add(new SortedDocValuesField("sortedbytesdocvalues", new BytesRef(_TestUtil.randomRealisticUnicodeString(random()))));
        document.add(new SortedDocValuesField("sortedbytesdocvaluesval", new BytesRef(_TestUtil.randomRealisticUnicodeString(random()))));
        document.add(new BinaryDocValuesField("straightbytesdocvalues", new BytesRef(_TestUtil.randomRealisticUnicodeString(random()))));
      }
      iw.addDocument(document);
    }
    reader = iw.getReader();
View Full Code Here

      date = new StringField("date", "", Field.Store.YES);
      doc.add(date);

      if (useDocValues) {
        titleDV = new SortedDocValuesField("titleDV", new BytesRef());
        doc.add(titleDV);
      } else {
        titleDV = null;
      }
    }
View Full Code Here

        switch(valueType) {
        case BINARY:
          valuesField = new BinaryDocValuesField("group_dv", new BytesRef());
          break;
        case SORTED:
          valuesField = new SortedDocValuesField("group_dv", new BytesRef());
          break;
        default:
          fail("unhandled type");
        }
        doc.add(valuesField);
View Full Code Here

      switch(valueType) {
      case BINARY:
        valuesField = new BinaryDocValuesField(groupField + "_dv", new BytesRef(value));
        break;
      case SORTED:
        valuesField = new SortedDocValuesField(groupField + "_dv", new BytesRef(value));
        break;
      default:
        fail("unhandled type");
      }
      doc.add(valuesField);
View Full Code Here

        System.out.println("  " + numDocs + ": s=" + s);
      }
     
      final Document doc = new Document();
      if (defaultCodecSupportsDocValues()) {
        doc.add(new SortedDocValuesField("stringdv", br));
        doc.add(newStringField("string", s, Field.Store.NO));
        doc.add(new NumericDocValuesField("id", numDocs));
      } else {
        doc.add(newStringField("string", s, Field.Store.NO));
        doc.add(newStringField("id", Integer.toString(numDocs), Field.Store.NO));
View Full Code Here

    RandomIndexWriter iwriter = new RandomIndexWriter(random(), directory);
    Document doc = new Document();
    String longTerm = "longtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongterm";
    String text = "This is the text to be indexed. " + longTerm;
    doc.add(newTextField("fieldname", text, Field.Store.YES));
    doc.add(new SortedDocValuesField("dv1", new BytesRef("hello hello")));
    doc.add(new NumericDocValuesField("dv2", 5));
    doc.add(new BinaryDocValuesField("dv3", new BytesRef("hello world")));
    iwriter.addDocument(doc);
    iwriter.close();
   
View Full Code Here

    Document doc = new Document();
    String longTerm = "longtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongterm";
    String text = "This is the text to be indexed. " + longTerm;
    doc.add(newTextField("fieldname", text, Field.Store.YES));
    doc.add(new BinaryDocValuesField("dv1", new BytesRef("hello world")));
    doc.add(new SortedDocValuesField("dv2", new BytesRef("hello hello")));
    doc.add(new NumericDocValuesField("dv3", 5));
    iwriter.addDocument(doc);
    iwriter.close();
   
    // Now search the index:
View Full Code Here

TOP

Related Classes of org.apache.lucene.document.SortedDocValuesField

Copyright © 2018 www.massapicom. 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.