Class PostingsConsumer
Abstract API that consumes postings for an individual term.
The lifecycle is:
- PostingsConsumer is returned for each term by
Start
Term(Bytes .Ref) - Start
Doc(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
Add
Position(Int32, Bytes will be called for each occurrence in the document.Ref, Int32, Int32) - Finish
Doc() is called when the producer is done adding positions to the document.
This is a Lucene.NET EXPERIMENTAL API, use at your own risk
Namespace: Lucene.Net.Codecs
Assembly: Lucene.Net.dll
Syntax
public abstract class PostingsConsumer : object
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 Bytespayload
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. |
position | |
Bytes |
payload | |
System. |
startOffset | |
System. |
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 |
---|---|---|
Merge |
mergeState | |
Index |
indexOptions | |
Docs |
postings | |
Fixed |
visitedDocs |
Returns
Type | Description |
---|---|
Term |
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. |
docId | |
System. |
freq |