public abstract class PushPostingsWriterBase extends PostingsWriterBase
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.PostingsReaderBase
Modifier and Type | Field and Description |
---|---|
protected FieldInfo |
fieldInfo
FieldInfo of current field being written. |
protected IndexOptions |
indexOptions
IndexOptions of current field being
written |
protected boolean |
writeFreqs
True if the current field writes freqs.
|
protected boolean |
writeOffsets
True if the current field writes offsets.
|
protected boolean |
writePayloads
True if the current field writes payloads.
|
protected boolean |
writePositions
True if the current field writes positions.
|
Modifier | Constructor and Description |
---|---|
protected |
PushPostingsWriterBase()
Sole constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
addPosition(int position,
BytesRef payload,
int startOffset,
int endOffset)
Add a new position and payload, and start/end offset.
|
abstract void |
finishDoc()
Called when we are done adding positions and payloads
for each doc.
|
abstract void |
finishTerm(BlockTermState state)
Finishes the current term.
|
abstract BlockTermState |
newTermState()
Return a newly created empty TermState
|
void |
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.
|
abstract void |
startDoc(int docID,
int freq)
Adds a new doc in this term.
|
abstract void |
startTerm(NumericDocValues norms)
Start a new term.
|
BlockTermState |
writeTerm(BytesRef term,
TermsEnum termsEnum,
FixedBitSet docsSeen,
NormsProducer norms)
Write all postings for one term; use the provided
TermsEnum to pull a PostingsEnum . |
close, encodeTerm, init
protected IndexOptions indexOptions
IndexOptions
of current field being
writtenprotected boolean writeFreqs
protected boolean writePositions
protected boolean writePayloads
protected boolean writeOffsets
protected PushPostingsWriterBase()
public abstract BlockTermState newTermState() throws IOException
IOException
public abstract void startTerm(NumericDocValues norms) throws IOException
finishTerm(BlockTermState)
is done, only if the term has at least one
document.IOException
public abstract void finishTerm(BlockTermState state) throws IOException
BlockTermState
contains the term's summary statistics,
and will holds metadata from PBF when returnedIOException
public void setField(FieldInfo fieldInfo)
setField
in class PostingsWriterBase
public final BlockTermState writeTerm(BytesRef term, TermsEnum termsEnum, FixedBitSet docsSeen, NormsProducer norms) throws IOException
PostingsWriterBase
TermsEnum
to pull a PostingsEnum
.
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.writeTerm
in class PostingsWriterBase
IOException
public abstract void startDoc(int docID, int freq) throws IOException
freq
will be -1 when term frequencies are omitted
for the field.IOException
public abstract void addPosition(int position, BytesRef payload, int startOffset, int endOffset) throws IOException
BytesRef
for the payload between calls
(method must fully consume the payload). startOffset
and endOffset
will be -1 when offsets are not indexed.IOException
public abstract void finishDoc() throws IOException
IOException
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.