Class PostingsWriterBase
Extension of PostingsConsumer to support pluggable term dictionaries.
This class contains additional hooks to interact with the provided term dictionaries such as BlockTreeTermsWriter. If you want to re-use an existing implementation and are only interested in customizing the format of the postings list, extend this class instead.
Note
This API is experimental and might change in incompatible ways in the next release.
Implements
Inherited Members
Namespace: Lucene.Net.Codecs
Assembly: Lucene.Net.dll
Syntax
public abstract class PostingsWriterBase : PostingsConsumer, IDisposable
Constructors
| Improve this Doc View SourcePostingsWriterBase()
Sole constructor. (For invocation by subclass constructors, typically implicit.)
Declaration
protected PostingsWriterBase()
Methods
| Improve this Doc View SourceDispose()
Disposes all resources used by this object.
Declaration
public void Dispose()
Dispose(Boolean)
Implementations must override and should dispose all resources used by this instance.
Declaration
protected abstract void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
EncodeTerm(Int64[], DataOutput, FieldInfo, BlockTermState, Boolean)
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.
NOTE: sometimes long[] might contain "don't care" values that are unused, e.g. the pointer to postings list may not be defined for some terms but is defined for others, if it is designed to inline some postings data in term dictionary. In this case, the postings writer should always use the last value, so that each element in metadata long[] remains monotonic.
Declaration
public abstract void EncodeTerm(long[] longs, DataOutput out, FieldInfo fieldInfo, BlockTermState state, bool absolute)
Parameters
Type | Name | Description |
---|---|---|
System.Int64[] | longs | |
DataOutput | out | |
FieldInfo | fieldInfo | |
BlockTermState | state | |
System.Boolean | absolute |
FinishTerm(BlockTermState)
Finishes the current term. The provided BlockTermState contains the term's summary statistics, and will holds metadata from PBF when returned.
Declaration
public abstract void FinishTerm(BlockTermState state)
Parameters
Type | Name | Description |
---|---|---|
BlockTermState | state |
Init(IndexOutput)
Called once after startup, before any terms have been
added. Implementations typically write a header to
the provided termsOut
.
Declaration
public abstract void Init(IndexOutput termsOut)
Parameters
Type | Name | Description |
---|---|---|
IndexOutput | termsOut |
NewTermState()
Return a newly created empty TermState
Declaration
public abstract BlockTermState NewTermState()
Returns
Type | Description |
---|---|
BlockTermState |
SetField(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.
Declaration
public abstract int SetField(FieldInfo fieldInfo)
Parameters
Type | Name | Description |
---|---|---|
FieldInfo | fieldInfo |
Returns
Type | Description |
---|---|
System.Int32 |
StartTerm()
Start a new term. Note that a matching call to FinishTerm(BlockTermState) is done, only if the term has at least one document.
Declaration
public abstract void StartTerm()