org.apache.lucene.search

Class RangeQuery

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:

Version: $Id: RangeQuery.java 520891 2007-03-21 13:58:47Z yonik $

See Also:

Constructor Summary
RangeQuery(Term lowerTerm, Term upperTerm, boolean inclusive)
Constructs a query selecting all terms greater than lowerTerm but less than upperTerm.
Method Summary
booleanequals(Object o)
Returns true iff o is equal to this.
StringgetField()
Returns the field name for this query
TermgetLowerTerm()
Returns the lower term of this range query
TermgetUpperTerm()
Returns the upper term of this range query
inthashCode()
Returns a hash code value for this object.
booleanisInclusive()
Returns true if the range query is inclusive
Queryrewrite(IndexReader reader)
StringtoString(String field)
Prints a user-readable version of this query.

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

equals

public boolean equals(Object o)
Returns true iff o is equal to this.

getField

public 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

hashCode

public int hashCode()
Returns a hash code value for this object.

isInclusive

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

rewrite

public Query rewrite(IndexReader reader)

toString

public String toString(String field)
Prints a user-readable version of this query.
Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.