Package org.apache.lucene.document

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


    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

   
    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

        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

            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

            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

    lmp.setMaxMergeDocs(20);
    lmp.setMergeFactor(2);
    IndexWriter iw = new IndexWriter(dir, conf);
    Document document = new Document();

    FieldType customType = new FieldType(TextField.TYPE_NOT_STORED);
    customType.setStoreTermVectors(true);
   
    document.add(newField("tvtest", "a b c", customType));
    for(int i=0;i<177;i++)
      iw.addDocument(document);
    iw.close();
View Full Code Here

 
  public void testNoWaitClose() throws Throwable {
    Directory directory = newDirectory();

    final Document doc = new Document();
    FieldType customType = new FieldType(TextField.TYPE_STORED);
    customType.setTokenized(false);

    Field idField = newField("id", "", customType);
    doc.add(idField);

    for(int pass=0;pass<2;pass++) {
View Full Code Here

    // this field will have norms
    Field f1 = newTextField("f1", "This field has norms", Field.Store.NO);
    d.add(f1);
      
    // this field will NOT have norms
    FieldType customType = new FieldType(TextField.TYPE_NOT_STORED);
    customType.setOmitNorms(true);
    Field f2 = newField("f2", "This field has NO norms in all docs", customType);
    d.add(f2);
       
    writer.addDocument(d);
    writer.forceMerge(1);
View Full Code Here

    // this field will have norms
    Field f1 = newTextField("f1", "This field has norms", Field.Store.NO);
    d.add(f1);
      
    // this field will NOT have norms
    FieldType customType = new FieldType(TextField.TYPE_NOT_STORED);
    customType.setOmitNorms(true);
    Field f2 = newField("f2", "This field has NO norms in all docs", customType);
    d.add(f2);

    for (int i = 0; i < 30; i++) {
      writer.addDocument(d);
View Full Code Here

TOP

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

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.