Class TermVectorsWriter
Codec API for writing term vectors:
- For every document, Start
Document(Int32) is called, informing the Codec how many fields will be written. - Start
Field(Field is called for each field in the document, informing the codec how many terms will be written for that field, and whether or not positions, offsets, or payloads are enabled.Info, Int32, Boolean, Boolean, Boolean) - Within each field, Start
Term(Bytes is called for each term.Ref, Int32) - If offsets and/or positions are enabled, then
Add
Position(Int32, Int32, Int32, Bytes will be called for each term occurrence.Ref) - After all documents have been written, Finish(Field
Infos, Int32) is called for verification/sanity-checks. - Finally the writer is disposed (Dispose(Boolean))
Namespace: Lucene.Net.Codecs
Assembly: Lucene.Net.dll
Syntax
public abstract class TermVectorsWriter : IDisposable
Constructors
| Improve this Doc View SourceTermVectorsWriter()
Sole constructor. (For invocation by subclass constructors, typically implicit.)
Declaration
protected TermVectorsWriter()
Properties
| Improve this Doc View SourceComparer
Return the IComparer<BytesRef> used to sort terms before feeding to this API.
Declaration
public abstract IComparer<BytesRef> Comparer { get; }
Property Value
Type | Description |
---|---|
IComparer<Bytes |
Methods
| Improve this Doc View SourceAbort()
Aborts writing entirely, implementation should remove any partially-written files, etc.
Declaration
public abstract void Abort()
AddAllDocVectors(Fields, MergeState)
Safe (but, slowish) default method to write every vector field in the document.
Declaration
protected void AddAllDocVectors(Fields vectors, MergeState mergeState)
Parameters
Type | Name | Description |
---|---|---|
Fields | vectors | |
Merge |
mergeState |
AddPosition(Int32, Int32, Int32, BytesRef)
Adds a term position
and offsets.
Declaration
public abstract void AddPosition(int position, int startOffset, int endOffset, BytesRef payload)
Parameters
Type | Name | Description |
---|---|---|
System. |
position | |
System. |
startOffset | |
System. |
endOffset | |
Bytes |
payload |
AddProx(Int32, DataInput, DataInput)
Called by Index
This is an expert API that allows the codec to consume positions and offsets directly from the indexer.
The default implementation calls Add
NOTE: this API is extremely expert and subject to change or removal!!!
Declaration
public virtual void AddProx(int numProx, DataInput positions, DataInput offsets)
Parameters
| 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. |
disposing |
Finish(FieldInfos, Int32)
Called before Dispose(Boolean), passing in the number
of documents that were written. Note that this is
intentionally redundant (equivalent to the number of
calls to Start
Declaration
public abstract void Finish(FieldInfos fis, int numDocs)
Parameters
Type | Name | Description |
---|---|---|
Field |
fis | |
System. |
numDocs |
FinishDocument()
Called after a doc and all its fields have been added.
Declaration
public virtual void FinishDocument()
FinishField()
Called after a field and all its terms have been added.
Declaration
public virtual void FinishField()
FinishTerm()
Called after a term and all its positions have been added.
Declaration
public virtual void FinishTerm()
Merge(MergeState)
Merges in the term vectors from the readers in
mergeState
. The default implementation skips
over deleted documents, and uses Start
Declaration
public virtual int Merge(MergeState mergeState)
Parameters
Type | Name | Description |
---|---|---|
Merge |
mergeState |
Returns
Type | Description |
---|---|
System. |
StartDocument(Int32)
Called before writing the term vectors of the document.
StartnumVectorFields
times. Note that if term
vectors are enabled, this is called even if the document
has no vector fields, in this case numVectorFields
will be zero.
Declaration
public abstract void StartDocument(int numVectorFields)
Parameters
Type | Name | Description |
---|---|---|
System. |
numVectorFields |
StartField(FieldInfo, Int32, Boolean, Boolean, Boolean)
Called before writing the terms of the field.
StartnumTerms
times.
Declaration
public abstract void StartField(FieldInfo info, int numTerms, bool positions, bool offsets, bool payloads)
Parameters
Type | Name | Description |
---|---|---|
Field |
info | |
System. |
numTerms | |
System. |
positions | |
System. |
offsets | |
System. |
payloads |
StartTerm(BytesRef, Int32)
Adds a term
and its term frequency freq
.
If this field has positions and/or offsets enabled, then
Addfreq
times respectively.
Declaration
public abstract void StartTerm(BytesRef term, int freq)
Parameters
Type | Name | Description |
---|---|---|
Bytes |
term | |
System. |
freq |