PushPostingsWriterBase

Extension of PostingsWriterBase, adding a push API for writing each element of the postings. This API is somewhat analogous to an XML SAX API, while PostingsWriterBase is more like an XML DOM API.

See also

Inheritors

Functions

Link copied to clipboard
abstract fun addPosition(position: Int, payload: BytesRef?, startOffset: Int, endOffset: Int)

Add a new position and payload, and start/end offset. A null payload means no payload; a non-null payload with zero length also means no payload. Caller may reuse the BytesRef for the payload between calls (method must fully consume the payload). startOffset and endOffset will be -1 when offsets are not indexed.

Link copied to clipboard
abstract override fun close()
Link copied to clipboard
abstract fun encodeTerm(out: DataOutput, fieldInfo: FieldInfo, state: BlockTermState, absolute: Boolean)

Encode metadata as long[] and byte[]. absolute controls whether current term is delta encoded according to latest term. Usually elements in longs 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.

Link copied to clipboard
abstract fun finishDoc()

Called when we are done adding positions and payloads for each doc.

Link copied to clipboard
abstract fun finishTerm(state: BlockTermState)

Finishes the current term. The provided BlockTermState contains the term's summary statistics, and will holds metadata from PBF when returned

Link copied to clipboard
abstract fun init(termsOut: IndexOutput, state: SegmentWriteState)

Called once after startup, before any terms have been added. Implementations typically write a header to the provided termsOut.

Link copied to clipboard

Return a newly created empty TermState

Link copied to clipboard
open override fun setField(fieldInfo: FieldInfo)

Sets the current field for writing, and returns the fixed length of long[] metadata (which is fixed per field), called when the writing switches to another field.

Link copied to clipboard
abstract fun startDoc(docID: Int, freq: Int)

Adds a new doc in this term. freq will be -1 when term frequencies are omitted for the field.

Link copied to clipboard
abstract fun startTerm(norms: NumericDocValues?)

Start a new term. Note that a matching call to .finishTerm is done, only if the term has at least one document.

Link copied to clipboard
open override fun writeTerm(term: BytesRef, termsEnum: TermsEnum, docsSeen: FixedBitSet, norms: NormsProducer?): BlockTermState?

Write all postings for one term; use the provided TermsEnum to pull a [ ]. This method should not re-position the TermsEnum! It is already positioned on the term that should be written. This method must set the bit in the provided FixedBitSet for every docID written. If no docs were written, this method should return null, and the terms dict will skip the term.