Class PulsingPostingsWriter
Writer for the pulsing format.
Wraps another postings implementation and decides (based on total number of occurrences), whether a terms postings should be inlined into the term dictionary, or passed through to the wrapped writer.Note
This API is experimental and might change in incompatible ways in the next release.
Implements
Inherited Members
Namespace: Lucene.Net.Codecs.Pulsing
Assembly: Lucene.Net.Codecs.dll
Syntax
public sealed class PulsingPostingsWriter : PostingsWriterBase, IDisposable
Constructors
PulsingPostingsWriter(SegmentWriteState, int, PostingsWriterBase)
If the total number of positions (summed across all docs
for this term) is less than or equal maxPositions
, then the postings are
inlined into terms dict.
Declaration
public PulsingPostingsWriter(SegmentWriteState state, int maxPositions, PostingsWriterBase wrappedPostingsWriter)
Parameters
Type | Name | Description |
---|---|---|
SegmentWriteState | state | |
int | maxPositions | |
PostingsWriterBase | wrappedPostingsWriter |
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 Lucene.Net.Util.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 override void AddPosition(int position, BytesRef payload, int startOffset, int endOffset)
Parameters
Type | Name | Description |
---|---|---|
int | position | |
BytesRef | payload | |
int | startOffset | |
int | endOffset |
Overrides
Dispose(bool)
Implementations must override and should dispose all resources used by this instance.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing |
Overrides
EncodeTerm(long[], DataOutput, FieldInfo, BlockTermState, bool)
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.
Declaration
public override void EncodeTerm(long[] empty, DataOutput output, FieldInfo fieldInfo, BlockTermState state, bool abs)
Parameters
Type | Name | Description |
---|---|---|
long[] | empty | |
DataOutput | output | |
FieldInfo | fieldInfo | |
BlockTermState | state | |
bool | abs |
Overrides
FinishDoc()
Called when we are done adding positions & payloads for each doc.
Declaration
public override void FinishDoc()
Overrides
FinishTerm(BlockTermState)
Called when we are done adding docs to this term.
Declaration
public override void FinishTerm(BlockTermState state)
Parameters
Type | Name | Description |
---|---|---|
BlockTermState | state |
Overrides
Init(IndexOutput)
Called once after startup, before any terms have been
added. Implementations typically write a header to
the provided termsOut
.
Declaration
public override void Init(IndexOutput termsOut)
Parameters
Type | Name | Description |
---|---|---|
IndexOutput | termsOut |
Overrides
NewTermState()
Return a newly created empty Lucene.Net.Index.TermState
Declaration
public override BlockTermState NewTermState()
Returns
Type | Description |
---|---|
BlockTermState |
Overrides
SetField(FieldInfo)
Currently, this instance is re-used across fields, so our parent calls setField whenever the field changes.
Declaration
public override int SetField(FieldInfo fieldInfo)
Parameters
Type | Name | Description |
---|---|---|
FieldInfo | fieldInfo |
Returns
Type | Description |
---|---|
int |
Overrides
StartDoc(int, int)
Adds a new doc in this term.
freq
will be -1 when term frequencies are omitted
for the field.
Declaration
public override void StartDoc(int docId, int termDocFreq)
Parameters
Type | Name | Description |
---|---|---|
int | docId | |
int | termDocFreq |
Overrides
StartTerm()
Start a new term. Note that a matching call to Lucene.Net.Codecs.PostingsWriterBase.FinishTerm(Lucene.Net.Codecs.BlockTermState) is done, only if the term has at least one document.
Declaration
public override void StartTerm()