Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class TermQuery

    A Query that matches documents containing a term. this may be combined with other terms with a BooleanQuery.

    Inheritance
    object
    Query
    TermQuery
    Inherited Members
    Query.Boost
    Query.ToString()
    Query.Rewrite(IndexReader)
    Query.Clone()
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Lucene.Net.Search
    Assembly: Lucene.Net.dll
    Syntax
    public class TermQuery : Query

    Constructors

    TermQuery(Term)

    Constructs a query for the term t.

    Declaration
    public TermQuery(Term t)
    Parameters
    Type Name Description
    Term t

    TermQuery(Term, TermContext)

    Expert: constructs a TermQuery that will use the provided docFreq instead of looking up the docFreq against the searcher.

    Declaration
    public TermQuery(Term t, TermContext states)
    Parameters
    Type Name Description
    Term t
    TermContext states

    TermQuery(Term, int)

    Expert: constructs a TermQuery that will use the provided docFreq instead of looking up the docFreq against the searcher.

    Declaration
    public TermQuery(Term t, int docFreq)
    Parameters
    Type Name Description
    Term t
    int docFreq

    Properties

    Term

    Returns the term of this query.

    Declaration
    public virtual Term Term { get; }
    Property Value
    Type Description
    Term

    Methods

    CreateWeight(IndexSearcher)

    Expert: Constructs an appropriate Weight implementation for this query.

    Only implemented by primitive queries, which re-write to themselves.
    Declaration
    public override Weight CreateWeight(IndexSearcher searcher)
    Parameters
    Type Name Description
    IndexSearcher searcher
    Returns
    Type Description
    Weight
    Overrides
    Query.CreateWeight(IndexSearcher)

    Equals(object)

    Returns true if o is equal to this.

    Declaration
    public override bool Equals(object o)
    Parameters
    Type Name Description
    object o
    Returns
    Type Description
    bool
    Overrides
    Query.Equals(object)

    ExtractTerms(ISet<Term>)

    Expert: adds all terms occurring in this query to the terms set. Only works if this query is in its rewritten (Rewrite(IndexReader)) form.

    Declaration
    public override void ExtractTerms(ISet<Term> terms)
    Parameters
    Type Name Description
    ISet<Term> terms
    Overrides
    Query.ExtractTerms(ISet<Term>)
    Exceptions
    Type Condition
    InvalidOperationException

    If this query is not yet rewritten

    GetHashCode()

    Returns a hash code value for this object.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    Query.GetHashCode()

    ToString(string)

    Prints a user-readable version of this query.

    Declaration
    public override string ToString(string field)
    Parameters
    Type Name Description
    string field
    Returns
    Type Description
    string
    Overrides
    Query.ToString(string)
    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.