Documentation of 'org.apache.lucene.search.RangeQuery' Java class
RangeQuery
org.apache.lucene.search

Class RangeQuery

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable


    public class RangeQuery
    extends Query
    A Query that matches documents within an exclusive range. A RangeQuery is built by QueryParser for input like [010 TO 120] but only if the QueryParser has the useOldRangeQuery property set to true. The QueryParser default behaviour is to use the newer ConstantScoreRangeQuery class. This is generally preferable because:
    • It is faster than RangeQuery
    • Unlike RangeQuery, it does not cause a BooleanQuery.TooManyClauses exception if the range of values is large
    • Unlike RangeQuery it does not influence scoring based on the scarcity of individual terms that may match
    See Also:
    ConstantScoreRangeQuery, Serialized Form
    • Constructor Detail

      • RangeQuery

        public RangeQuery(Term lowerTerm,
                          Term upperTerm,
                          boolean inclusive)
        Constructs a query selecting all terms greater than lowerTerm but less than upperTerm. There must be at least one term and either term may be null, in which case there is no bound on that side, but if there are two terms, both terms must be for the same field.
    • Method Detail

      • rewrite

        public Query rewrite(IndexReader reader)
                      throws java.io.IOException
        Description copied from class: Query
        Expert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys.
        Overrides:
        rewrite in class Query
        Throws:
        java.io.IOException
      • getField

        public java.lang.String getField()
        Returns the field name for this query
      • getLowerTerm

        public Term getLowerTerm()
        Returns the lower term of this range query
      • getUpperTerm

        public Term getUpperTerm()
        Returns the upper term of this range query
      • isInclusive

        public boolean isInclusive()
        Returns true if the range query is inclusive
      • toString

        public java.lang.String toString(java.lang.String field)
        Prints a user-readable version of this query.
        Specified by:
        toString in class Query
      • equals

        public boolean equals(java.lang.Object o)
        Returns true iff o is equal to this.
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Returns a hash code value for this object.
        Overrides:
        hashCode in class java.lang.Object

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.