Package org.apache.lucene.codecs
Class PostingsWriterBase
java.lang.Object
org.apache.lucene.codecs.PostingsWriterBase
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
PushPostingsWriterBase
Class that plugs into term dictionaries, such as
Lucene90BlockTreeTermsWriter, and
handles writing postings.- See Also:
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidclose()abstract voidencodeTerm(DataOutput out, FieldInfo fieldInfo, BlockTermState state, boolean absolute) Encode metadata as long[] and byte[].abstract voidinit(IndexOutput termsOut, SegmentWriteState state) Called once after startup, before any terms have been added.abstract voidSets the current field for writing.abstract BlockTermStatewriteTerm(BytesRef term, TermsEnum termsEnum, FixedBitSet docsSeen, NormsProducer norms) Write all postings for one term; use the providedTermsEnumto pull aPostingsEnum.
-
Constructor Details
-
PostingsWriterBase
protected PostingsWriterBase()Sole constructor. (For invocation by subclass constructors, typically implicit.)
-
-
Method Details
-
init
Called once after startup, before any terms have been added. Implementations typically write a header to the providedtermsOut.- Throws:
IOException
-
writeTerm
public abstract BlockTermState writeTerm(BytesRef term, TermsEnum termsEnum, FixedBitSet docsSeen, NormsProducer norms) throws IOException Write all postings for one term; use the providedTermsEnumto pull aPostingsEnum. This method should not re-position theTermsEnum! It is already positioned on the term that should be written. This method must set the bit in the providedFixedBitSetfor every docID written. If no docs were written, this method should return null, and the terms dict will skip the term.- Throws:
IOException
-
encodeTerm
public abstract void encodeTerm(DataOutput out, FieldInfo fieldInfo, BlockTermState state, boolean absolute) throws IOException Encode metadata as long[] and byte[].absolutecontrols whether current term is delta encoded according to latest term. Usually elements inlongsare file pointers, so each one always increases when a new term is consumed.outis used to write generic bytes, which are not monotonic.- Throws:
IOException
-
setField
Sets the current field for writing. -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-