Class PostingsConsumer
Abstract API that consumes postings for an individual term.
The lifecycle is:- PostingsConsumer is returned for each term by StartTerm(BytesRef).
- StartDoc(int, int) is called for each document where the term occurs, specifying id and term frequency for that document.
- If positions are enabled for the field, then AddPosition(int, BytesRef, int, int) will be called for each occurrence in the document.
- FinishDoc() is called when the producer is done adding positions to the document.
Note
This API is experimental and might change in incompatible ways in the next release.
Inherited Members
Namespace: Lucene.Net.Codecs
Assembly: Lucene.Net.dll
Syntax
public abstract class PostingsConsumer
Constructors
PostingsConsumer()
Sole constructor. (For invocation by subclass constructors, typically implicit.)
Declaration
protected PostingsConsumer()
Methods
AddPosition(int, BytesRef, int, int)
Add a new position & 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.
Declaration
public abstract void AddPosition(int position, BytesRef payload, int startOffset, int endOffset)
Parameters
Type | Name | Description |
---|---|---|
int | position | |
BytesRef | payload | |
int | startOffset | |
int | endOffset |
FinishDoc()
Called when we are done adding positions & payloads for each doc.
Declaration
public abstract void FinishDoc()
Merge(MergeState, IndexOptions, DocsEnum, FixedBitSet)
Default merge impl: append documents, mapping around deletes.
Declaration
public virtual TermStats Merge(MergeState mergeState, IndexOptions indexOptions, DocsEnum postings, FixedBitSet visitedDocs)
Parameters
Type | Name | Description |
---|---|---|
MergeState | mergeState | |
IndexOptions | indexOptions | |
DocsEnum | postings | |
FixedBitSet | visitedDocs |
Returns
Type | Description |
---|---|
TermStats |
StartDoc(int, int)
Adds a new doc in this term.
freq
will be -1 when term frequencies are omitted
for the field.
Declaration
public abstract void StartDoc(int docId, int freq)
Parameters
Type | Name | Description |
---|---|---|
int | docId | |
int | freq |