Examples of BinaryDocValuesField


Examples of org.apache.lucene.document.BinaryDocValuesField

    assumeTrue("3.x does not support docvalues", defaultCodecSupportsDocValues());
    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

Examples of org.apache.lucene.document.BinaryDocValuesField

      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();
    iw.close();
View Full Code Here

Examples of org.apache.lucene.document.BinaryDocValuesField

      doc.add(group);
      Field valuesField = null;
      if (canUseIDV) {
        switch(valueType) {
        case BINARY:
          valuesField = new BinaryDocValuesField("group_dv", new BytesRef());
          break;
        case SORTED:
          valuesField = new SortedDocValuesField("group_dv", new BytesRef());
          break;
        default:
View Full Code Here

Examples of org.apache.lucene.document.BinaryDocValuesField

    doc.add(new TextField(groupField, value, Field.Store.YES));
    if (canUseIDV) {
      Field valuesField = null;
      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:
View Full Code Here

Examples of org.apache.lucene.document.BinaryDocValuesField

    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 NumericDocValuesField("dv1", 5));
    doc.add(new BinaryDocValuesField("dv2", new BytesRef("hello world")));
    iwriter.addDocument(doc);
    iwriter.close();
   
    // Now search the index:
    IndexReader ireader = DirectoryReader.open(directory); // read-only=true
View Full Code Here

Examples of org.apache.lucene.document.BinaryDocValuesField

      doc.add(textField);

      Field textGramField = new Field("textgrams", "", ft);
      doc.add(textGramField);

      Field textDVField = new BinaryDocValuesField(TEXT_FIELD_NAME, new BytesRef());
      doc.add(textDVField);

      // TODO: use threads...?
      Field weightField = new NumericDocValuesField("weight", 0);
      doc.add(weightField);

      Field payloadField;
      if (iter.hasPayloads()) {
        payloadField = new BinaryDocValuesField("payloads", new BytesRef());
        doc.add(payloadField);
      } else {
        payloadField = null;
      }

      //long t0 = System.nanoTime();
      while ((text = iter.next()) != null) {
        String textString = text.utf8ToString();
        textField.setStringValue(textString);
        textGramField.setStringValue(textString);
        textDVField.setBytesValue(text);
        weightField.setLongValue(iter.weight());
        if (iter.hasPayloads()) {
          payloadField.setBytesValue(iter.payload());
        }
        w.addDocument(doc);
View Full Code Here

Examples of org.apache.lucene.document.BinaryDocValuesField

   * Add the counting list data to the document under the given field. Note that
   * the field is determined by the {@link CategoryListParams}.
   */
  protected void addCountingListData(Document doc, Map<String,BytesRef> categoriesData, String field) {
    for (Entry<String,BytesRef> entry : categoriesData.entrySet()) {
      doc.add(new BinaryDocValuesField(field + entry.getKey(), entry.getValue()));
    }
  }
View Full Code Here

Examples of org.apache.lucene.document.BinaryDocValuesField

    final int nDocs = atLeast(50);
    final Field id = new NumericDocValuesField("id", 0);
    final Field f;
    switch (type) {
      case BINARY:
        f = new BinaryDocValuesField("dv", new BytesRef());
        break;
      case SORTED:
        f = new SortedDocValuesField("dv", new BytesRef());
        break;
      case NUMERIC:
View Full Code Here

Examples of org.apache.lucene.document.BinaryDocValuesField

    }
    doc.add(new NumericDocValuesField(NUMERIC_DV_FIELD, id));
    TextField norms = new TextField(NORMS_FIELD, Integer.toString(id), Store.NO);
    norms.setBoost(Float.intBitsToFloat(id));
    doc.add(norms);
    doc.add(new BinaryDocValuesField(BINARY_DV_FIELD, new BytesRef(Integer.toString(id))));
    doc.add(new SortedDocValuesField(SORTED_DV_FIELD, new BytesRef(Integer.toString(id))));
    if (defaultCodecSupportsSortedSet()) {
      doc.add(new SortedSetDocValuesField(SORTED_SET_DV_FIELD, new BytesRef(Integer.toString(id))));
      doc.add(new SortedSetDocValuesField(SORTED_SET_DV_FIELD, new BytesRef(Integer.toString(id + 1))));
    }
View Full Code Here

Examples of org.apache.lucene.document.BinaryDocValuesField

    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 BinaryDocValuesField("dv1", new BytesRef(longTerm)));
    doc.add(new BinaryDocValuesField("dv2", new BytesRef(text)));
    iwriter.addDocument(doc);
    iwriter.close();
   
    // Now search the index:
    IndexReader ireader = DirectoryReader.open(directory); // read-only=true
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.