Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class TermContext

    Maintains a IndexReaderTermState view over IndexReader instances containing a single term. The TermContext doesn't track if the given TermState objects are valid, neither if the TermState instances refer to the same terms in the associated readers.

    Note

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

    Inheritance
    object
    TermContext
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Index
    Assembly: Lucene.Net.dll
    Syntax
    public sealed class TermContext

    Constructors

    TermContext(IndexReaderContext)

    Creates an empty TermContext from a IndexReaderContext

    Declaration
    public TermContext(IndexReaderContext context)
    Parameters
    Type Name Description
    IndexReaderContext context

    TermContext(IndexReaderContext, TermState, int, int, long)

    Creates a TermContext with an initial TermState, IndexReader pair.

    Declaration
    public TermContext(IndexReaderContext context, TermState state, int ord, int docFreq, long totalTermFreq)
    Parameters
    Type Name Description
    IndexReaderContext context
    TermState state
    int ord
    int docFreq
    long totalTermFreq

    Properties

    DocFreq

    expert: only available for queries that want to lie about docfreq

    Note

    This API is for internal purposes only and might change in incompatible ways in the next release.

    Declaration
    public int DocFreq { get; }
    Property Value
    Type Description
    int

    TopReaderContext

    Holds the IndexReaderContext of the top-level IndexReader, used internally only for asserting.

    Note

    This API is for internal purposes only and might change in incompatible ways in the next release.

    Declaration
    public IndexReaderContext TopReaderContext { get; }
    Property Value
    Type Description
    IndexReaderContext

    TotalTermFreq

    Returns the accumulated term frequency of all TermState instances passed to Register(TermState, int, int, long).

    Declaration
    public long TotalTermFreq { get; }
    Property Value
    Type Description
    long

    the accumulated term frequency of all TermState instances passed to Register(TermState, int, int, long).

    Methods

    Build(IndexReaderContext, Term)

    Creates a TermContext from a top-level IndexReaderContext and the given Term. this method will lookup the given term in all context's leaf readers and register each of the readers containing the term in the returned TermContext using the leaf reader's ordinal.

    Note: the given context must be a top-level context.
    Declaration
    public static TermContext Build(IndexReaderContext context, Term term)
    Parameters
    Type Name Description
    IndexReaderContext context
    Term term
    Returns
    Type Description
    TermContext

    Clear()

    Clears the TermContext internal state and removes all registered TermStates

    Declaration
    public void Clear()

    Get(int)

    Returns the TermState for an leaf ordinal or null if no TermState for the ordinal was registered.

    Declaration
    public TermState Get(int ord)
    Parameters
    Type Name Description
    int ord

    The readers leaf ordinal to get the TermState for.

    Returns
    Type Description
    TermState

    The TermState for the given readers ord or null if no TermState for the reader was registered

    Register(TermState, int, int, long)

    Registers and associates a TermState with an leaf ordinal. The leaf ordinal should be derived from a IndexReaderContext's leaf ord.

    Declaration
    public void Register(TermState state, int ord, int docFreq, long totalTermFreq)
    Parameters
    Type Name Description
    TermState state
    int ord
    int docFreq
    long totalTermFreq
    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.