Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class TermRangeQuery

    A Query that matches documents within an range of terms.

    This query matches the documents looking for terms that fall into the supplied range according to CompareTo(byte). It is not intended for numerical ranges; use NumericRangeQuery instead.

    This query uses the CONSTANT_SCORE_AUTO_REWRITE_DEFAULT rewrite method.

    @since 2.9
    Inheritance
    object
    Query
    MultiTermQuery
    TermRangeQuery
    Inherited Members
    MultiTermQuery.m_field
    MultiTermQuery.m_rewriteMethod
    MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE
    MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE
    MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE
    MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT
    MultiTermQuery.Field
    MultiTermQuery.GetTermsEnum(Terms)
    MultiTermQuery.Rewrite(IndexReader)
    MultiTermQuery.MultiTermRewriteMethod
    Query.Boost
    Query.ToString()
    Query.CreateWeight(IndexSearcher)
    Query.ExtractTerms(ISet<Term>)
    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 TermRangeQuery : MultiTermQuery

    Constructors

    TermRangeQuery(string, BytesRef, BytesRef, bool, bool)

    Constructs a query selecting all terms greater/equal than lowerTerm but less/equal than upperTerm.

    If an endpoint is null, it is said to be "open". Either or both endpoints may be open. Open endpoints may not be exclusive (you can't select all but the first or last term without explicitly specifying the term to exclude.)
    Declaration
    public TermRangeQuery(string field, BytesRef lowerTerm, BytesRef upperTerm, bool includeLower, bool includeUpper)
    Parameters
    Type Name Description
    string field

    The field that holds both lower and upper terms.

    BytesRef lowerTerm

    The term text at the lower end of the range.

    BytesRef upperTerm

    The term text at the upper end of the range.

    bool includeLower

    If true, the lowerTerm is included in the range.

    bool includeUpper

    If true, the upperTerm is included in the range.

    Properties

    IncludesLower

    Returns true if the lower endpoint is inclusive

    Declaration
    public virtual bool IncludesLower { get; }
    Property Value
    Type Description
    bool

    IncludesUpper

    Returns true if the upper endpoint is inclusive

    Declaration
    public virtual bool IncludesUpper { get; }
    Property Value
    Type Description
    bool

    LowerTerm

    Returns the lower value of this range query

    Declaration
    public virtual BytesRef LowerTerm { get; }
    Property Value
    Type Description
    BytesRef

    UpperTerm

    Returns the upper value of this range query

    Declaration
    public virtual BytesRef UpperTerm { get; }
    Property Value
    Type Description
    BytesRef

    Methods

    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
    MultiTermQuery.Equals(object)

    GetHashCode()

    Serves as the default hash function.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code for the current object.

    Overrides
    MultiTermQuery.GetHashCode()

    GetTermsEnum(Terms, AttributeSource)

    Construct the enumeration to be used, expanding the pattern term. this method should only be called if the field exists (ie, implementations can assume the field does exist). this method should not return null (should instead return EMPTY if no terms match). The TermsEnum must already be positioned to the first matching term. The given AttributeSource is passed by the MultiTermQuery.RewriteMethod to provide attributes, the rewrite method uses to inform about e.g. maximum competitive boosts. this is currently only used by TopTermsRewrite<Q>.

    Declaration
    protected override TermsEnum GetTermsEnum(Terms terms, AttributeSource atts)
    Parameters
    Type Name Description
    Terms terms
    AttributeSource atts
    Returns
    Type Description
    TermsEnum
    Overrides
    MultiTermQuery.GetTermsEnum(Terms, AttributeSource)

    NewStringRange(string, string, string, bool, bool)

    Factory that creates a new TermRangeQuery using strings for term text.

    Declaration
    public static TermRangeQuery NewStringRange(string field, string lowerTerm, string upperTerm, bool includeLower, bool includeUpper)
    Parameters
    Type Name Description
    string field
    string lowerTerm
    string upperTerm
    bool includeLower
    bool includeUpper
    Returns
    Type Description
    TermRangeQuery

    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.