• API

    Show / Hide Table of Contents

    Class TermsEnum

    Enumerator to seek (SeekCeil(BytesRef), SeekExact(BytesRef)) or step through (MoveNext() terms to obtain Term, 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 MoveNext() or one of the Seek methods.

    This is a Lucene.NET EXPERIMENTAL API, use at your own risk
    Inheritance
    System.Object
    TermsEnum
    FilterAtomicReader.FilterTermsEnum
    FilteredTermsEnum
    MultiTermsEnum
    FuzzyTermsEnum
    Implements
    IBytesRefEnumerator
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Lucene.Net.Index
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class TermsEnum : IBytesRefEnumerator, IBytesRefIterator

    Constructors

    | Improve this Doc View Source

    TermsEnum()

    Sole constructor. (For invocation by subclass constructors, typically implicit.)

    Declaration
    protected TermsEnum()

    Fields

    | Improve this Doc View Source

    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.

    Declaration
    public static readonly TermsEnum EMPTY
    Field Value
    Type Description
    TermsEnum

    Properties

    | Improve this Doc View Source

    Attributes

    Returns the related attributes.

    Declaration
    public virtual AttributeSource Attributes { get; }
    Property Value
    Type Description
    AttributeSource
    | Improve this Doc View Source

    Comparer

    Declaration
    public abstract IComparer<BytesRef> Comparer { get; }
    Property Value
    Type Description
    System.Collections.Generic.IComparer<BytesRef>
    | Improve this Doc View Source

    DocFreq

    Returns the number of documents containing the current term. Do not call this when the enum is unpositioned.

    Declaration
    public abstract int DocFreq { get; }
    Property Value
    Type Description
    System.Int32
    See Also
    END
    | Improve this Doc View Source

    Ord

    Returns ordinal position for current term. This is an optional property (the codec may throw System.NotSupportedException. Do not call this when the enum is unpositioned.

    Declaration
    public abstract long Ord { get; }
    Property Value
    Type Description
    System.Int64
    | Improve this Doc View Source

    Term

    Returns current term. Do not call this when the enum is unpositioned.

    Declaration
    public abstract BytesRef Term { get; }
    Property Value
    Type Description
    BytesRef
    | Improve this Doc View Source

    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.

    Declaration
    public abstract long TotalTermFreq { get; }
    Property Value
    Type Description
    System.Int64

    Methods

    | Improve this Doc View Source

    Docs(IBits, DocsEnum)

    Get DocsEnum for the current term. Do not call this when the enum is unpositioned. This method will not return null.

    Declaration
    public DocsEnum Docs(IBits liveDocs, DocsEnum reuse)
    Parameters
    Type Name Description
    IBits liveDocs

    Unset bits are documents that should not be returned

    DocsEnum reuse

    Pass a prior DocsEnum for possible reuse

    Returns
    Type Description
    DocsEnum
    | Improve this Doc View Source

    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 null.

    Declaration
    public abstract DocsEnum Docs(IBits liveDocs, DocsEnum reuse, DocsFlags flags)
    Parameters
    Type Name Description
    IBits liveDocs

    Unset bits are documents that should not be returned

    DocsEnum reuse

    Pass a prior DocsEnum for possible reuse

    DocsFlags flags

    Specifies which optional per-document values you require; DocsFlags

    Returns
    Type Description
    DocsEnum
    See Also
    Docs(IBits, DocsEnum)
    | Improve this Doc View Source

    DocsAndPositions(IBits, DocsAndPositionsEnum)

    Get DocsAndPositionsEnum for the current term. Do not call this when the enum is unpositioned. This method will return null if positions were not indexed.

    Declaration
    public DocsAndPositionsEnum DocsAndPositions(IBits liveDocs, DocsAndPositionsEnum reuse)
    Parameters
    Type Name Description
    IBits liveDocs

    Unset bits are documents that should not be returned

    DocsAndPositionsEnum reuse

    Pass a prior DocsAndPositionsEnum for possible reuse

    Returns
    Type Description
    DocsAndPositionsEnum
    See Also
    DocsAndPositions(IBits, DocsAndPositionsEnum, DocsAndPositionsFlags)
    | Improve this Doc View Source

    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 null if positions were not indexed.

    Declaration
    public abstract DocsAndPositionsEnum DocsAndPositions(IBits liveDocs, DocsAndPositionsEnum reuse, DocsAndPositionsFlags flags)
    Parameters
    Type Name Description
    IBits liveDocs

    Unset bits are documents that should not be returned

    DocsAndPositionsEnum reuse

    Pass a prior DocsAndPositionsEnum for possible reuse

    DocsAndPositionsFlags flags

    Specifies which optional per-position values you require; see DocsAndPositionsFlags.

    Returns
    Type Description
    DocsAndPositionsEnum
    | Improve this Doc View Source

    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

    Declaration
    public virtual TermState GetTermState()
    Returns
    Type Description
    TermState
    See Also
    TermState
    SeekExact(BytesRef, TermState)
    | Improve this Doc View Source

    MoveNext()

    Moves to the next item in the TermsEnum.

    The default implementation can and should be overridden with a more optimized version.

    Declaration
    public abstract bool MoveNext()
    Returns
    Type Description
    System.Boolean

    true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.

    | Improve this Doc View Source

    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.

    Declaration
    public abstract TermsEnum.SeekStatus SeekCeil(BytesRef text)
    Parameters
    Type Name Description
    BytesRef text
    Returns
    Type Description
    TermsEnum.SeekStatus
    | Improve this Doc View Source

    SeekExact(BytesRef)

    Attempts to seek to the exact term, returning true if the term is found. If this returns false, the enum is unpositioned. For some codecs, SeekExact(BytesRef) may be substantially faster than SeekCeil(BytesRef).

    Declaration
    public virtual bool SeekExact(BytesRef text)
    Parameters
    Type Name Description
    BytesRef text
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    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.

    Declaration
    public virtual void SeekExact(BytesRef term, TermState state)
    Parameters
    Type Name Description
    BytesRef term

    the term the TermState corresponds to

    TermState state

    the TermState

    | Improve this Doc View Source

    SeekExact(Int64)

    Seeks to the specified term by ordinal (position) as previously returned by Ord. The target ord may be before or after the current ord, and must be within bounds.

    Declaration
    public abstract void SeekExact(long ord)
    Parameters
    Type Name Description
    System.Int64 ord

    Explicit Interface Implementations

    | Improve this Doc View Source

    IBytesRefEnumerator.Current

    Declaration
    BytesRef IBytesRefEnumerator.Current { get; }
    Returns
    Type Description
    BytesRef

    Implements

    IBytesRefEnumerator
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)