Examples of FieldType


Examples of org.apache.lucene.document.FieldType

  public void testIndexedBit() throws Exception {
    Directory dir = newDirectory();
    RandomIndexWriter w = new RandomIndexWriter(random(), dir);
    Document doc = new Document();
    FieldType onlyStored = new FieldType();
    onlyStored.setStored(true);
    doc.add(new Field("field", "value", onlyStored));
    doc.add(new StringField("field2", "value", Field.Store.YES));
    w.addDocument(doc);
    IndexReader r = w.getReader();
    w.close();
View Full Code Here

Examples of org.apache.lucene.document.FieldType

    Directory dir = newDirectory();
    IndexWriterConfig iwConf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
    iwConf.setMaxBufferedDocs(RandomInts.randomIntBetween(random(), 2, 30));
    RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwConf);
   
    FieldType ft = new FieldType();
    ft.setStored(true);
    ft.freeze();

    final String string = _TestUtil.randomSimpleString(random(), 50);
    final byte[] bytes = string.getBytes("UTF-8");
    final long l = random().nextBoolean() ? random().nextInt(42) : random().nextLong();
    final int i = random().nextBoolean() ? random().nextInt(42) : random().nextInt();
View Full Code Here

Examples of org.apache.lucene.document.FieldType

        final int max = rarely() ? 256 : 2;
        data[i][j] = randomByteArray(length, max);
      }
    }

    final FieldType type = new FieldType(StringField.TYPE_STORED);
    type.setIndexed(false);
    type.freeze();
    IntField id = new IntField("id", 0, Store.YES);
    for (int i = 0; i < data.length; ++i) {
      Document doc = new Document();
      doc.add(id);
      id.setIntValue(i);
View Full Code Here

Examples of org.apache.lucene.document.FieldType

    final Field idField = new StringField("id", "", Store.NO);
    emptyDoc.add(idField);
    bigDoc1.add(idField);
    bigDoc2.add(idField);

    final FieldType onlyStored = new FieldType(StringField.TYPE_STORED);
    onlyStored.setIndexed(false);

    final Field smallField = new Field("fld", randomByteArray(random().nextInt(10), 256), onlyStored);
    final int numFields = RandomInts.randomIntBetween(random(), 500000, 1000000);
    for (int i = 0; i < numFields; ++i) {
      bigDoc1.add(smallField);
View Full Code Here

Examples of org.apache.lucene.document.FieldType

  protected Options randomOptions() {
    return RandomPicks.randomFrom(random(), new ArrayList<Options>(validOptions()));
  }

  protected FieldType fieldType(Options options) {
    FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
    ft.setStoreTermVectors(true);
    ft.setStoreTermVectorPositions(options.positions);
    ft.setStoreTermVectorOffsets(options.offsets);
    ft.setStoreTermVectorPayloads(options.payloads);
    ft.freeze();
    return ft;
  }
View Full Code Here

Examples of org.apache.lucene.document.FieldType

    d1.add(buildMetaField("salary", "04500"));

    Field sf = new StringField("testStored", "stored", Store.YES);
    d1.add(sf);

    FieldType ft = new FieldType();
    ft.setStored(false);
    ft.setIndexed(true);
    ft.setTokenized(true);
    ft.setStoreTermVectors(true);
    ft.setStoreTermVectorPositions(false);
    ft.setStoreTermVectorOffsets(false);
    Field tvf = new Field("tv", "bobo bobo lucene lucene lucene test", ft);
    d1.add(tvf);

    FieldType ftPositions = new FieldType();
    ftPositions.setStored(false);
    ftPositions.setIndexed(true);
    ftPositions.setTokenized(true);
    ftPositions.setStoreTermVectors(true);
    ftPositions.setStoreTermVectorPositions(true);
    ftPositions.setStoreTermVectorOffsets(false);
    tvf = new Field("tvPositions", "bobo bobo lucene lucene lucene test", ftPositions);
    d1.add(tvf);

    FieldType ftOffsets = new FieldType();
    ftOffsets.setStored(false);
    ftOffsets.setIndexed(true);
    ftOffsets.setTokenized(true);
    ftOffsets.setStoreTermVectors(true);
    ftOffsets.setStoreTermVectorPositions(false);
    ftOffsets.setStoreTermVectorOffsets(true);
    tvf = new Field("tvOffsets", "bobo bobo lucene lucene lucene test", ftOffsets);
    d1.add(tvf);

    FieldType ftPositionsAndOffsets = new FieldType();
    ftPositionsAndOffsets.setStored(false);
    ftPositionsAndOffsets.setIndexed(true);
    ftPositionsAndOffsets.setTokenized(true);
    ftPositionsAndOffsets.setStoreTermVectors(true);
    ftPositionsAndOffsets.setStoreTermVectorPositions(true);
    ftPositionsAndOffsets.setStoreTermVectorOffsets(true);
    tvf = new Field("tvPositionsAndOffsets", "bobo bobo lucene lucene lucene test",
        ftPositionsAndOffsets);
    d1.add(tvf);

    Document d2 = new Document();
View Full Code Here

Examples of org.apache.lucene.document.FieldType

   
    if (openMode == OpenMode.CREATE) {
      ++indexEpoch;
    }
   
    FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
    ft.setOmitNorms(true);
    parentStreamField = new Field(Consts.FIELD_PAYLOADS, parentStream, ft);
    fullPathField = new StringField(Consts.FULL, "", Field.Store.YES);

    nextID = indexWriter.maxDoc();
View Full Code Here

Examples of org.apache.lucene.document.FieldType

        TEST_VERSION_CURRENT, new MockAnalyzer(random()))
        .setMaxBufferedDocs(2).setRAMBufferSizeMB(
                                                  IndexWriterConfig.DISABLE_AUTO_FLUSH));
    Document document = new Document();

    FieldType customType = new FieldType();
    customType.setStored(true);

    FieldType customType1 = new FieldType(TextField.TYPE_NOT_STORED);
    customType1.setTokenized(false);
    customType1.setStoreTermVectors(true);
    customType1.setStoreTermVectorPositions(true);
    customType1.setStoreTermVectorOffsets(true);
   
    Field idField = newStringField("id", "", Field.Store.NO);
    document.add(idField);
    Field storedField = newField("stored", "stored", customType);
    document.add(storedField);
View Full Code Here

Examples of org.apache.lucene.document.FieldType

            setMergePolicy(newLogMergePolicy(50))
    );

    Document document = new Document();

    FieldType customType = new FieldType();
    customType.setStored(true);

    FieldType customType1 = new FieldType(TextField.TYPE_NOT_STORED);
    customType1.setTokenized(false);
    customType1.setStoreTermVectors(true);
    customType1.setStoreTermVectorPositions(true);
    customType1.setStoreTermVectorOffsets(true);
   
    Field storedField = newField("stored", "stored", customType);
    document.add(storedField);
    Field termVectorField = newField("termVector", "termVector", customType1);
    document.add(termVectorField);
View Full Code Here

Examples of org.apache.lucene.document.FieldType

            setMaxBufferedDocs(2).
            setRAMBufferSizeMB(IndexWriterConfig.DISABLE_AUTO_FLUSH).
            setMergePolicy(newLogMergePolicy(50))
    );

    FieldType customType = new FieldType();
    customType.setStored(true);

    FieldType customType1 = new FieldType(TextField.TYPE_NOT_STORED);
    customType1.setTokenized(false);
    customType1.setStoreTermVectors(true);
    customType1.setStoreTermVectorPositions(true);
    customType1.setStoreTermVectorOffsets(true);
   
    Document document = new Document();
    Field storedField = newField("stored", "stored", customType);
    document.add(storedField);
    Field termVectorField = newField("termVector", "termVector", customType1);
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.