Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class FilteredTermsEnum

    Abstract class for enumerating a subset of all terms.

    Term enumerations are always ordered by Comparer. Each term in the enumeration is greater than all that precede it.

    Please note: Consumers of this enumeration cannot call Seek(), it is forward only; it throws NotSupportedException when a seeking method is called.
    Inheritance
    object
    TermsEnum
    FilteredTermsEnum
    SingleTermsEnum
    PrefixTermsEnum
    TermRangeTermsEnum
    Implements
    IBytesRefEnumerator
    Inherited Members
    TermsEnum.Docs(IBits, DocsEnum)
    TermsEnum.DocsAndPositions(IBits, DocsAndPositionsEnum)
    TermsEnum.EMPTY
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Index
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class FilteredTermsEnum : TermsEnum, IBytesRefEnumerator

    Constructors

    FilteredTermsEnum(TermsEnum)

    Creates a filtered TermsEnum on a terms enum.

    Declaration
    protected FilteredTermsEnum(TermsEnum tenum)
    Parameters
    Type Name Description
    TermsEnum tenum

    the terms enumeration to filter.

    FilteredTermsEnum(TermsEnum, bool)

    Creates a filtered TermsEnum on a terms enum.

    Declaration
    protected FilteredTermsEnum(TermsEnum tenum, bool startWithSeek)
    Parameters
    Type Name Description
    TermsEnum tenum

    the terms enumeration to filter.

    bool startWithSeek

    start with seek

    Properties

    Attributes

    Returns the related attributes, the returned AttributeSource is shared with the delegate TermsEnum.

    Declaration
    public override AttributeSource Attributes { get; }
    Property Value
    Type Description
    AttributeSource
    Overrides
    TermsEnum.Attributes

    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

    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

    Accept(BytesRef)

    Return if term is accepted, not accepted or the iteration should ended (and possibly seek).

    Declaration
    protected abstract FilteredTermsEnum.AcceptStatus Accept(BytesRef term)
    Parameters
    Type Name Description
    BytesRef term
    Returns
    Type Description
    FilteredTermsEnum.AcceptStatus

    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 bits, DocsEnum reuse, DocsFlags flags)
    Parameters
    Type Name Description
    IBits bits
    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 bits, DocsAndPositionsEnum reuse, DocsAndPositionsFlags flags)
    Parameters
    Type Name Description
    IBits bits
    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)

    GetTermState()

    Returns the filtered enums term state

    Declaration
    public override TermState GetTermState()
    Returns
    Type Description
    TermState
    Overrides
    TermsEnum.GetTermState()

    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()

    NextSeekTerm(BytesRef)

    On the first call to MoveNext() or if Accept(BytesRef) returns YES_AND_SEEK or NO_AND_SEEK, this method will be called to eventually seek the underlying TermsEnum to a new position. On the first call, currentTerm will be null, later calls will provide the term the underlying enum is positioned at. This method returns per default only one time the initial seek term and then null, so no repositioning is ever done.

    Override this method, if you want a more sophisticated TermsEnum, that repositions the iterator during enumeration. If this method always returns null the enum is empty.

    Please note: this method should always provide a greater term than the last enumerated term, else the behavior of this enum violates the contract for TermsEnums.
    Declaration
    protected virtual BytesRef NextSeekTerm(BytesRef currentTerm)
    Parameters
    Type Name Description
    BytesRef currentTerm
    Returns
    Type Description
    BytesRef

    SeekCeil(BytesRef)

    this enum does not support seeking!

    Declaration
    public override TermsEnum.SeekStatus SeekCeil(BytesRef term)
    Parameters
    Type Name Description
    BytesRef term
    Returns
    Type Description
    TermsEnum.SeekStatus
    Overrides
    TermsEnum.SeekCeil(BytesRef)
    Exceptions
    Type Condition
    NotSupportedException

    In general, subclasses do not support seeking.

    SeekExact(BytesRef)

    this enum does not support seeking!

    Declaration
    public override bool SeekExact(BytesRef term)
    Parameters
    Type Name Description
    BytesRef term
    Returns
    Type Description
    bool
    Overrides
    TermsEnum.SeekExact(BytesRef)
    Exceptions
    Type Condition
    NotSupportedException

    In general, subclasses do not support seeking.

    SeekExact(BytesRef, TermState)

    this enum does not support seeking!

    Declaration
    public override void SeekExact(BytesRef term, TermState state)
    Parameters
    Type Name Description
    BytesRef term
    TermState state
    Overrides
    TermsEnum.SeekExact(BytesRef, TermState)
    Exceptions
    Type Condition
    NotSupportedException

    In general, subclasses do not support seeking.

    SeekExact(long)

    this enum does not support seeking!

    Declaration
    public override void SeekExact(long ord)
    Parameters
    Type Name Description
    long ord
    Overrides
    TermsEnum.SeekExact(long)
    Exceptions
    Type Condition
    NotSupportedException

    In general, subclasses do not support seeking.

    SetInitialSeekTerm(BytesRef)

    Use this method to set the initial BytesRef to seek before iterating. This is a convenience method for subclasses that do not override NextSeekTerm(BytesRef). If the initial seek term is null (default), the enum is empty.

    You can only use this method, if you keep the default implementation of NextSeekTerm(BytesRef).
    Declaration
    protected void SetInitialSeekTerm(BytesRef term)
    Parameters
    Type Name Description
    BytesRef term

    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.