Package org.apache.lucene.document

Examples of org.apache.lucene.document.SortedDocValuesField


  // tries to make more dups than testSorted
  public void testSortedWithLotsOfDups() throws Exception {
    Directory dir = newDirectory();
    Document doc = new Document();
    BytesRef ref = new BytesRef();
    Field field = new SortedDocValuesField("bytes", ref);
    doc.add(field);
   
    IndexWriterConfig iwc = newIndexWriterConfig(random(), TEST_VERSION_CURRENT, null);
    iwc.setMergePolicy(newLogMergePolicy());
    RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwc);
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

          System.out.println("  " + numDocs + ": s=" + s);
        }

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

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

      if (supportsDocValues) {
        fields.add(new NumericDocValuesField("intdocvalues", random().nextInt()));
        fields.add(new FloatDocValuesField("floatdocvalues", random().nextFloat()));
        fields.add(new SortedDocValuesField("sortedbytesdocvalues", new BytesRef(_TestUtil.randomRealisticUnicodeString(random()))));
        fields.add(new SortedDocValuesField("sortedbytesdocvaluesval", new BytesRef(_TestUtil.randomRealisticUnicodeString(random()))));
        fields.add(new BinaryDocValuesField("straightbytesdocvalues", new BytesRef(_TestUtil.randomRealisticUnicodeString(random()))));
      }
      Document document = new Document();
      document.add(new StoredField("id", ""+i));
      if (VERBOSE) {
View Full Code Here

      doc.add(newTextField(r, "content4", "aaa bbb ccc ddd", Field.Store.NO));
      doc.add(newStringField(r, "content5", "aaa bbb ccc ddd", Field.Store.NO));
      if (defaultCodecSupportsDocValues()) {
        doc.add(new NumericDocValuesField("numericdv", 5));
        doc.add(new BinaryDocValuesField("binarydv", new BytesRef("hello")));
        doc.add(new SortedDocValuesField("sorteddv", new BytesRef("world")));
      }
      if (defaultCodecSupportsSortedSet()) {
        doc.add(new SortedSetDocValuesField("sortedsetdv", new BytesRef("hellllo")));
        doc.add(new SortedSetDocValuesField("sortedsetdv", new BytesRef("again")));
      }
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

      doc.add(newStringField(random, "id", "500", Field.Store.NO));
      doc.add(newField(random, "field", "some prepackaged text contents", storedTextType));
      if (defaultCodecSupportsDocValues()) {
        doc.add(new BinaryDocValuesField("binarydv", new BytesRef("500")));
        doc.add(new NumericDocValuesField("numericdv", 500));
        doc.add(new SortedDocValuesField("sorteddv", new BytesRef("500")));
      }
      if (defaultCodecSupportsSortedSet()) {
        doc.add(new SortedSetDocValuesField("sortedsetdv", new BytesRef("one")));
        doc.add(new SortedSetDocValuesField("sortedsetdv", new BytesRef("two")));
      }
      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")));
      }
View Full Code Here

            doc.add(idField);
            doc.add(newField(random, "field", "some text contents", storedTextType));
            if (defaultCodecSupportsDocValues()) {
              binaryDVField = new BinaryDocValuesField("binarydv", new BytesRef());
              numericDVField = new NumericDocValuesField("numericdv", 0);
              sortedDVField = new SortedDocValuesField("sorteddv", new BytesRef());
              doc.add(binaryDVField);
              doc.add(numericDVField);
              doc.add(sortedDVField);
            }
            if (defaultCodecSupportsSortedSet()) {
View Full Code Here

            break;
          case BINARY:
            field2 = new BinaryDocValuesField(field1.name(), field1.binaryValue());
          break;
          case SORTED:
            field2 = new SortedDocValuesField(field1.name(), field1.binaryValue());
            break;
          default:
            throw new IllegalStateException("unknown Type: " + dvType);
        }
      } else {
View Full Code Here

  }

  private Iterable<? extends Field> addSort(Column column, String name, Field field) {
    List<Field> list = new ArrayList<Field>();
    list.add(field);
    list.add(new SortedDocValuesField(name, new BytesRef(column.getValue())));
    return list;
  }
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.