- java.lang.Object
-
- org.apache.lucene.codecs.PostingsWriterBase
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
PushPostingsWriterBase
public abstract class PostingsWriterBase extends java.lang.Object implements java.io.Closeable
Class that plugs into term dictionaries, such asLucene90BlockTreeTermsWriter
, and handles writing postings.- See Also:
PostingsReaderBase
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PostingsWriterBase()
Sole constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract void
close()
abstract void
encodeTerm(DataOutput out, FieldInfo fieldInfo, BlockTermState state, boolean absolute)
Encode metadata as long[] and byte[].abstract void
init(IndexOutput termsOut, SegmentWriteState state)
Called once after startup, before any terms have been added.abstract void
setField(FieldInfo fieldInfo)
Sets the current field for writing.abstract BlockTermState
writeTerm(BytesRef term, TermsEnum termsEnum, FixedBitSet docsSeen, NormsProducer norms)
Write all postings for one term; use the providedTermsEnum
to pull aPostingsEnum
.
-
-
-
Method Detail
-
init
public abstract void init(IndexOutput termsOut, SegmentWriteState state) throws java.io.IOException
Called once after startup, before any terms have been added. Implementations typically write a header to the providedtermsOut
.- Throws:
java.io.IOException
-
writeTerm
public abstract BlockTermState writeTerm(BytesRef term, TermsEnum termsEnum, FixedBitSet docsSeen, NormsProducer norms) throws java.io.IOException
Write all postings for one term; use the providedTermsEnum
to 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 providedFixedBitSet
for every docID written. If no docs were written, this method should return null, and the terms dict will skip the term.- Throws:
java.io.IOException
-
encodeTerm
public abstract void encodeTerm(DataOutput out, FieldInfo fieldInfo, BlockTermState state, boolean absolute) throws java.io.IOException
Encode metadata as long[] and byte[].absolute
controls whether current term is delta encoded according to latest term. Usually elements inlongs
are file pointers, so each one always increases when a new term is consumed.out
is used to write generic bytes, which are not monotonic.- Throws:
java.io.IOException
-
setField
public abstract void setField(FieldInfo fieldInfo)
Sets the current field for writing.
-
close
public abstract void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-