Search in sources :

Example 1 with PostingsWriterBase

use of org.apache.lucene.codecs.PostingsWriterBase in project lucene-solr by apache.

the class FSTOrdPostingsFormat method fieldsConsumer.

@Override
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
    PostingsWriterBase postingsWriter = new Lucene50PostingsWriter(state);
    boolean success = false;
    try {
        FieldsConsumer ret = new FSTOrdTermsWriter(state, postingsWriter);
        success = true;
        return ret;
    } finally {
        if (!success) {
            IOUtils.closeWhileHandlingException(postingsWriter);
        }
    }
}
Also used : PostingsWriterBase(org.apache.lucene.codecs.PostingsWriterBase) FieldsConsumer(org.apache.lucene.codecs.FieldsConsumer) Lucene50PostingsWriter(org.apache.lucene.codecs.lucene50.Lucene50PostingsWriter)

Example 2 with PostingsWriterBase

use of org.apache.lucene.codecs.PostingsWriterBase in project lucene-solr by apache.

the class LuceneFixedGap method fieldsConsumer.

@Override
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
    PostingsWriterBase docs = new Lucene50PostingsWriter(state);
    // TODO: should we make the terms index more easily
    // pluggable?  Ie so that this codec would record which
    // index impl was used, and switch on loading?
    // Or... you must make a new Codec for this?
    TermsIndexWriterBase indexWriter;
    boolean success = false;
    try {
        indexWriter = new FixedGapTermsIndexWriter(state, termIndexInterval);
        success = true;
    } finally {
        if (!success) {
            docs.close();
        }
    }
    success = false;
    try {
        // Must use BlockTermsWriter (not BlockTree) because
        // BlockTree doens't support ords (yet)...
        FieldsConsumer ret = new BlockTermsWriter(indexWriter, state, docs);
        success = true;
        return ret;
    } finally {
        if (!success) {
            try {
                docs.close();
            } finally {
                indexWriter.close();
            }
        }
    }
}
Also used : PostingsWriterBase(org.apache.lucene.codecs.PostingsWriterBase) FixedGapTermsIndexWriter(org.apache.lucene.codecs.blockterms.FixedGapTermsIndexWriter) BlockTermsWriter(org.apache.lucene.codecs.blockterms.BlockTermsWriter) TermsIndexWriterBase(org.apache.lucene.codecs.blockterms.TermsIndexWriterBase) FieldsConsumer(org.apache.lucene.codecs.FieldsConsumer) Lucene50PostingsWriter(org.apache.lucene.codecs.lucene50.Lucene50PostingsWriter)

Example 3 with PostingsWriterBase

use of org.apache.lucene.codecs.PostingsWriterBase in project lucene-solr by apache.

the class LuceneVarGapFixedInterval method fieldsConsumer.

@Override
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
    PostingsWriterBase docs = new Lucene50PostingsWriter(state);
    // TODO: should we make the terms index more easily
    // pluggable?  Ie so that this codec would record which
    // index impl was used, and switch on loading?
    // Or... you must make a new Codec for this?
    TermsIndexWriterBase indexWriter;
    boolean success = false;
    try {
        indexWriter = new VariableGapTermsIndexWriter(state, new VariableGapTermsIndexWriter.EveryNTermSelector(termIndexInterval));
        success = true;
    } finally {
        if (!success) {
            docs.close();
        }
    }
    success = false;
    try {
        // Must use BlockTermsWriter (not BlockTree) because
        // BlockTree doens't support ords (yet)...
        FieldsConsumer ret = new BlockTermsWriter(indexWriter, state, docs);
        success = true;
        return ret;
    } finally {
        if (!success) {
            try {
                docs.close();
            } finally {
                indexWriter.close();
            }
        }
    }
}
Also used : PostingsWriterBase(org.apache.lucene.codecs.PostingsWriterBase) VariableGapTermsIndexWriter(org.apache.lucene.codecs.blockterms.VariableGapTermsIndexWriter) BlockTermsWriter(org.apache.lucene.codecs.blockterms.BlockTermsWriter) TermsIndexWriterBase(org.apache.lucene.codecs.blockterms.TermsIndexWriterBase) FieldsConsumer(org.apache.lucene.codecs.FieldsConsumer) Lucene50PostingsWriter(org.apache.lucene.codecs.lucene50.Lucene50PostingsWriter)

Example 4 with PostingsWriterBase

use of org.apache.lucene.codecs.PostingsWriterBase in project lucene-solr by apache.

the class BlockTreeOrdsPostingsFormat method fieldsConsumer.

@Override
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
    PostingsWriterBase postingsWriter = new Lucene50PostingsWriter(state);
    boolean success = false;
    try {
        FieldsConsumer ret = new OrdsBlockTreeTermsWriter(state, postingsWriter, minTermBlockSize, maxTermBlockSize);
        success = true;
        return ret;
    } finally {
        if (!success) {
            IOUtils.closeWhileHandlingException(postingsWriter);
        }
    }
}
Also used : PostingsWriterBase(org.apache.lucene.codecs.PostingsWriterBase) FieldsConsumer(org.apache.lucene.codecs.FieldsConsumer) Lucene50PostingsWriter(org.apache.lucene.codecs.lucene50.Lucene50PostingsWriter)

Example 5 with PostingsWriterBase

use of org.apache.lucene.codecs.PostingsWriterBase in project lucene-solr by apache.

the class FSTPostingsFormat method fieldsConsumer.

@Override
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
    PostingsWriterBase postingsWriter = new Lucene50PostingsWriter(state);
    boolean success = false;
    try {
        FieldsConsumer ret = new FSTTermsWriter(state, postingsWriter);
        success = true;
        return ret;
    } finally {
        if (!success) {
            IOUtils.closeWhileHandlingException(postingsWriter);
        }
    }
}
Also used : PostingsWriterBase(org.apache.lucene.codecs.PostingsWriterBase) FieldsConsumer(org.apache.lucene.codecs.FieldsConsumer) Lucene50PostingsWriter(org.apache.lucene.codecs.lucene50.Lucene50PostingsWriter)

Aggregations

FieldsConsumer (org.apache.lucene.codecs.FieldsConsumer)9 PostingsWriterBase (org.apache.lucene.codecs.PostingsWriterBase)9 Lucene50PostingsWriter (org.apache.lucene.codecs.lucene50.Lucene50PostingsWriter)7 BlockTermsWriter (org.apache.lucene.codecs.blockterms.BlockTermsWriter)4 TermsIndexWriterBase (org.apache.lucene.codecs.blockterms.TermsIndexWriterBase)4 VariableGapTermsIndexWriter (org.apache.lucene.codecs.blockterms.VariableGapTermsIndexWriter)3 FixedGapTermsIndexWriter (org.apache.lucene.codecs.blockterms.FixedGapTermsIndexWriter)2 BlockTreeTermsWriter (org.apache.lucene.codecs.blocktree.BlockTreeTermsWriter)2 Random (java.util.Random)1 TermStats (org.apache.lucene.codecs.TermStats)1 OrdsBlockTreeTermsWriter (org.apache.lucene.codecs.blocktreeords.OrdsBlockTreeTermsWriter)1 FSTOrdTermsWriter (org.apache.lucene.codecs.memory.FSTOrdTermsWriter)1 FSTTermsWriter (org.apache.lucene.codecs.memory.FSTTermsWriter)1 FieldInfo (org.apache.lucene.index.FieldInfo)1 IndexOutput (org.apache.lucene.store.IndexOutput)1 BytesRef (org.apache.lucene.util.BytesRef)1