Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class Query

    The abstract base class for queries.

    Instantiable subclasses are:
    • TermQuery
    • BooleanQuery
    • WildcardQuery
    • PhraseQuery
    • PrefixQuery
    • MultiPhraseQuery
    • FuzzyQuery
    • RegexpQuery
    • TermRangeQuery
    • NumericRangeQuery
    • ConstantScoreQuery
    • DisjunctionMaxQuery
    • MatchAllDocsQuery

    See also the family of Span Queries (Lucene.Net.Search.Spans) and additional queries available in the Queries module
    Inheritance
    object
    Query
    BooleanQuery
    ConstantScoreQuery
    DisjunctionMaxQuery
    FilteredQuery
    MatchAllDocsQuery
    MultiPhraseQuery
    MultiTermQuery
    PhraseQuery
    SpanQuery
    TermQuery
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Lucene.Net.Search
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class Query

    Properties

    Boost

    Gets or Sets the boost for this query clause. Documents matching this clause will (in addition to the normal weightings) have their score multiplied by Boost. The boost is 1.0 by default.

    Declaration
    public virtual float Boost { get; set; }
    Property Value
    Type Description
    float

    Methods

    Clone()

    Returns a clone of this query.

    Declaration
    public virtual object Clone()
    Returns
    Type Description
    object

    CreateWeight(IndexSearcher)

    Expert: Constructs an appropriate Weight implementation for this query.

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

    Equals(object)

    Determines whether the specified object is equal to the current object.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    The object to compare with the current object.

    Returns
    Type Description
    bool

    true if the specified object is equal to the current object; otherwise, false.

    Overrides
    object.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 virtual void ExtractTerms(ISet<Term> terms)
    Parameters
    Type Name Description
    ISet<Term> terms
    Exceptions
    Type Condition
    InvalidOperationException

    If this query is not yet rewritten

    GetHashCode()

    Serves as the default hash function.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code for the current object.

    Overrides
    object.GetHashCode()

    Rewrite(IndexReader)

    Expert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys.

    Declaration
    public virtual Query Rewrite(IndexReader reader)
    Parameters
    Type Name Description
    IndexReader reader
    Returns
    Type Description
    Query

    ToString()

    Prints a query to a string.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    object.ToString()

    ToString(string)

    Prints a query to a string, with field assumed to be the default field and omitted.

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