Class TermsEnum
Iterator to seek (SeekCeil(BytesRef), SeekExact(BytesRef)) or step through (Next() terms to obtain frequency information (DocFreq), DocsEnum or DocsAndPositionsEnum for the current term (Docs(IBits, DocsEnum)).
Term enumerations are always ordered by Comparer. Each term in the enumeration is greater than the one before it.
The TermsEnum is unpositioned when you first obtain it
and you must first successfully call Next() or one
of the Seek
methods.
@lucene.experimental
Inheritance
Assembly: DistributedLucene.Net.dll
Syntax
public abstract class TermsEnum : object, IBytesRefIterator
Constructors
Name | Description |
---|---|
TermsEnum() | Sole constructor. (For invocation by subclass constructors, typically implicit.) |
Fields
Name | Description |
---|---|
EMPTY | An empty TermsEnum for quickly returning an empty instance e.g. in MultiTermQuery Please note: this enum should be unmodifiable, but it is currently possible to add Attributes to it. This should not be a problem, as the enum is always empty and the existence of unused Attributes does not matter. |
Properties
Name | Description |
---|---|
Attributes | Returns the related attributes. |
Comparer | |
DocFreq | Returns the number of documents containing the current term. Do not call this when the enum is unpositioned. |
Ord | Returns ordinal position for current term. This is an
optional property (the codec may throw |
Term | Returns current term. Do not call this when the enum is unpositioned. |
TotalTermFreq | Returns the total number of occurrences of this term across all documents (the sum of the Freq for each doc that has this term). This will be -1 if the codec doesn't support this measure. Note that, like other term measures, this measure does not take deleted documents into account. |
Methods
Name | Description |
---|---|
Docs(IBits, DocsEnum) | Get DocsEnum for the current term. Do not
call this when the enum is unpositioned. This method
will not return |
Docs(IBits, DocsEnum, DocsFlags) | Get DocsEnum for the current term, with
control over whether freqs are required. Do not
call this when the enum is unpositioned. This method
will not return |
DocsAndPositions(IBits, DocsAndPositionsEnum) | Get DocsAndPositionsEnum for the current term.
Do not call this when the enum is unpositioned. This
method will return |
DocsAndPositions(IBits, DocsAndPositionsEnum, DocsAndPositionsFlags) | Get DocsAndPositionsEnum for the current term,
with control over whether offsets and payloads are
required. Some codecs may be able to optimize their
implementation when offsets and/or payloads are not required.
Do not call this when the enum is unpositioned. This
will return |
GetTermState() | Expert: Returns the TermsEnums internal state to position the TermsEnum without re-seeking the term dictionary. NOTE: A seek by GetTermState() might not capture the AttributeSource's state. Callers must maintain the AttributeSource states separately |
Next() | |
SeekCeil(BytesRef) | Seeks to the specified term, if it exists, or to the next (ceiling) term. Returns TermsEnum.SeekStatus to indicate whether exact term was found, a different term was found, or EOF was hit. The target term may be before or after the current term. If this returns END, the enum is unpositioned. |
SeekExact(BytesRef) | Attempts to seek to the exact term, returning
|
SeekExact(BytesRef, TermState) | Expert: Seeks a specific position by TermState previously obtained from GetTermState(). Callers should maintain the TermState to use this method. Low-level implementations may position the TermsEnum without re-seeking the term dictionary. Seeking by TermState should only be used iff the state was obtained from the same TermsEnum instance. NOTE: Using this method with an incompatible TermState might leave this TermsEnum in undefined state. On a segment level TermState instances are compatible only iff the source and the target TermsEnum operate on the same field. If operating on segment level, TermState instances must not be used across segments. NOTE: A seek by TermState might not restore the AttributeSource's state. AttributeSource states must be maintained separately if this method is used. |
SeekExact(Int64) | Seeks to the specified term by ordinal (position) as
previously returned by Ord. The target |