Package org.apache.lucene.document

Examples of org.apache.lucene.document.SortedNumericDocValuesField


        document.add(new NumericDocValuesField("sparsenumeric", random.nextInt()));
      }
      // add sortednumeric sometimes
      document.removeFields("sparsesortednum");
      if (random.nextInt(5) == 1) {
        document.add(new SortedNumericDocValuesField("sparsesortednum", random.nextLong()));
        if (random.nextBoolean()) {
          document.add(new SortedNumericDocValuesField("sparsesortednum", random.nextLong()));
        }
      }
      writer.addDocument(document);
    }
   
View Full Code Here


      if (defaultCodecSupportsSortedSet()) {
        doc.add(new SortedSetDocValuesField("sortedsetdv", new BytesRef("one")));
        doc.add(new SortedSetDocValuesField("sortedsetdv", new BytesRef("two")));
      }
      if (defaultCodecSupportsSortedNumeric()) {
        doc.add(new SortedNumericDocValuesField("sortednumericdv", 4));
        doc.add(new SortedNumericDocValuesField("sortednumericdv", 3));
      }
      w.addDocument(doc);
      doc = new Document();
      doc.add(newStringField(random, "id", "501", Field.Store.NO));
      doc.add(newField(random, "field", "some more contents", storedTextType));
      if (defaultCodecSupportsDocValues()) {
        doc.add(new BinaryDocValuesField("binarydv", new BytesRef("501")));
        doc.add(new NumericDocValuesField("numericdv", 501));
        doc.add(new SortedDocValuesField("sorteddv", new BytesRef("501")));
      }
      if (defaultCodecSupportsSortedSet()) {
        doc.add(new SortedSetDocValuesField("sortedsetdv", new BytesRef("two")));
        doc.add(new SortedSetDocValuesField("sortedsetdv", new BytesRef("three")));
      }
      if (defaultCodecSupportsSortedNumeric()) {
        doc.add(new SortedNumericDocValuesField("sortednumericdv", 6));
        doc.add(new SortedNumericDocValuesField("sortednumericdv", 1));
      }
      w.addDocument(doc);
      w.deleteDocuments(new Term("id", "500"));
      w.close();
    }
View Full Code Here

    int numDocs = atLeast(500);
    for (int i = 0; i < numDocs; i++) {
      Document doc = new Document();
      int numValues = random().nextInt(5);
      for (int j = 0; j < numValues; j++) {
        doc.add(new SortedNumericDocValuesField("nums", TestUtil.nextLong(random(), Long.MIN_VALUE, Long.MAX_VALUE)));
      }
      iw.addDocument(doc);
      if (random().nextInt(17) == 0) {
        iw.commit();
      }
View Full Code Here

    protected abstract void innerParseCreateField(ParseContext context, List<Field> fields) throws IOException;

    protected final void addDocValue(ParseContext context, List<Field> fields, long value) {
        if (useSortedNumericDocValues) {
            fields.add(new SortedNumericDocValuesField(names().indexName(), value));
        } else {
            CustomLongNumericDocValuesField field = (CustomLongNumericDocValuesField) context.doc().getByKey(names().indexName());
            if (field != null) {
                field.add(value);
            } else {
View Full Code Here

TOP

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

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.