Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class MultiTermsEnum

    Exposes TermsEnum API, merged from TermsEnum API of sub-segments. This does a merge sort, by term text, of the sub-readers.

    Note

    This API is experimental and might change in incompatible ways in the next release.

    Inheritance
    object
    TermsEnum
    MultiTermsEnum
    Implements
    IBytesRefEnumerator
    Inherited Members
    TermsEnum.Attributes
    TermsEnum.SeekExact(BytesRef, TermState)
    TermsEnum.Docs(IBits, DocsEnum)
    TermsEnum.DocsAndPositions(IBits, DocsAndPositionsEnum)
    TermsEnum.GetTermState()
    TermsEnum.EMPTY
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Lucene.Net.Index
    Assembly: Lucene.Net.dll
    Syntax
    public sealed class MultiTermsEnum : TermsEnum, IBytesRefEnumerator

    Constructors

    MultiTermsEnum(ReaderSlice[])

    Initializes a new instance of MultiTermsEnum with the specified slices.

    Declaration
    public MultiTermsEnum(ReaderSlice[] slices)
    Parameters
    Type Name Description
    ReaderSlice[] slices

    Which sub-reader slices we should merge.

    Exceptions
    Type Condition
    ArgumentNullException

    slices is null.

    Properties

    Comparer

    Return the BytesRef Comparer used to sort terms provided by the iterator. This may return null if there are no items or the iterator is not sorted. Callers may invoke this method many times, so it's best to cache a single instance & reuse it.

    Declaration
    public override IComparer<BytesRef> Comparer { get; }
    Property Value
    Type Description
    IComparer<BytesRef>
    Overrides
    TermsEnum.Comparer

    DocFreq

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

    Declaration
    public override int DocFreq { get; }
    Property Value
    Type Description
    int
    Overrides
    TermsEnum.DocFreq
    See Also
    END

    MatchArray

    Returns sub-reader slices positioned to the current term.

    Declaration
    public MultiTermsEnum.TermsEnumWithSlice[] MatchArray { get; }
    Property Value
    Type Description
    TermsEnumWithSlice[]

    MatchCount

    Returns how many sub-reader slices contain the current term.

    Declaration
    public int MatchCount { get; }
    Property Value
    Type Description
    int
    See Also
    MatchArray

    Ord

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

    Declaration
    public override long Ord { get; }
    Property Value
    Type Description
    long
    Overrides
    TermsEnum.Ord

    Term

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

    Declaration
    public override BytesRef Term { get; }
    Property Value
    Type Description
    BytesRef
    Overrides
    TermsEnum.Term

    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 override long TotalTermFreq { get; }
    Property Value
    Type Description
    long
    Overrides
    TermsEnum.TotalTermFreq

    Methods

    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 override 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
    Overrides
    TermsEnum.Docs(IBits, DocsEnum, DocsFlags)
    See Also
    Docs(IBits, DocsEnum)

    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 override 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
    Overrides
    TermsEnum.DocsAndPositions(IBits, DocsAndPositionsEnum, DocsAndPositionsFlags)

    MoveNext()

    Moves to the next item in the TermsEnum.

    The default implementation can and should be overridden with a more optimized version.
    Declaration
    public override bool MoveNext()
    Returns
    Type Description
    bool

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

    Overrides
    TermsEnum.MoveNext()

    Reset(TermsEnumIndex[])

    The terms array must be newly created TermsEnum, ie MoveNext() has not yet been called.

    Declaration
    public TermsEnum Reset(MultiTermsEnum.TermsEnumIndex[] termsEnumsIndex)
    Parameters
    Type Name Description
    TermsEnumIndex[] termsEnumsIndex
    Returns
    Type Description
    TermsEnum

    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 override TermsEnum.SeekStatus SeekCeil(BytesRef term)
    Parameters
    Type Name Description
    BytesRef term
    Returns
    Type Description
    TermsEnum.SeekStatus
    Overrides
    TermsEnum.SeekCeil(BytesRef)

    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 override bool SeekExact(BytesRef term)
    Parameters
    Type Name Description
    BytesRef term
    Returns
    Type Description
    bool
    Overrides
    TermsEnum.SeekExact(BytesRef)

    SeekExact(long)

    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 override void SeekExact(long ord)
    Parameters
    Type Name Description
    long ord
    Overrides
    TermsEnum.SeekExact(long)

    ToString()

    Returns a string that represents the current object.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string that represents the current object.

    Overrides
    object.ToString()

    Implements

    IBytesRefEnumerator
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.