Class PostingsConsumer
Abstract API that consumes postings for an individual term.
The lifecycle is:
- PostingsConsumer is returned for each term by StartTerm(BytesRef).
- StartDoc(Int32, Int32) 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(Int32, BytesRef, Int32, Int32) 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
| Improve this Doc View SourcePostingsConsumer()
Sole constructor. (For invocation by subclass constructors, typically implicit.)
Declaration
protected PostingsConsumer()
Methods
| Improve this Doc View SourceAddPosition(Int32, BytesRef, Int32, Int32)
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 |
---|---|---|
System.Int32 | position | |
BytesRef | payload | |
System.Int32 | startOffset | |
System.Int32 | 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(Int32, Int32)
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 |
---|---|---|
System.Int32 | docId | |
System.Int32 | freq |