org.apache.lucene.search
Class RangeQuery

java.lang.Object
  extended by org.apache.lucene.search.Query
      extended by org.apache.lucene.search.RangeQuery
All Implemented Interfaces:
Serializable, Cloneable

Deprecated. Use TermRangeQuery for term ranges or NumericRangeQuery for numeric ranges instead. This class will be removed in Lucene 3.0.

public class RangeQuery
extends Query

A Query that matches documents within an exclusive range of terms.

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

This query uses MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE. If you want to change this, use the new TermRangeQuery instead.

See Also:
Serialized Form

Constructor Summary
RangeQuery(Term lowerTerm, Term upperTerm, boolean inclusive)
          Deprecated. Constructs a query selecting all terms greater than lowerTerm but less than upperTerm.
RangeQuery(Term lowerTerm, Term upperTerm, boolean inclusive, Collator collator)
          Deprecated. Constructs a query selecting all terms greater than lowerTerm but less than upperTerm.
 
Method Summary
 boolean equals(Object o)
          Deprecated. Returns true iff o is equal to this.
 Collator getCollator()
          Deprecated. Returns the collator used to determine range inclusion, if any.
 String getField()
          Deprecated. Returns the field name for this query
 Term getLowerTerm()
          Deprecated. Returns the lower term of this range query.
 Term getUpperTerm()
          Deprecated. Returns the upper term of this range query.
 int hashCode()
          Deprecated. Returns a hash code value for this object.
 boolean isInclusive()
          Deprecated. Returns true if the range query is inclusive
 Query rewrite(IndexReader reader)
          Deprecated. Expert: called to re-write queries into primitive queries.
 void setBoost(float b)
          Deprecated. Sets the boost for this query clause to b.
 String toString(String field)
          Deprecated. Prints a user-readable version of this query.
 
Methods inherited from class org.apache.lucene.search.Query
clone, combine, createWeight, extractTerms, getBoost, getSimilarity, mergeBooleanQueries, toString, weight
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RangeQuery

public RangeQuery(Term lowerTerm,
                  Term upperTerm,
                  boolean inclusive)
Deprecated. 
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.

Parameters:
lowerTerm - The Term at the lower end of the range
upperTerm - The Term at the upper end of the range
inclusive - If true, both lowerTerm and upperTerm will themselves be included in the range.

RangeQuery

public RangeQuery(Term lowerTerm,
                  Term upperTerm,
                  boolean inclusive,
                  Collator collator)
Deprecated. 
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.

If collator is not null, it will be used to decide whether index terms are within the given range, rather than using the Unicode code point order in which index terms are stored.

WARNING: Using this constructor and supplying a non-null value in the collator parameter will cause every single index Term in the Field referenced by lowerTerm and/or upperTerm to be examined. Depending on the number of index Terms in this Field, the operation could be very slow.

Parameters:
lowerTerm - The Term at the lower end of the range
upperTerm - The Term at the upper end of the range
inclusive - If true, both lowerTerm and upperTerm will themselves be included in the range.
collator - The collator to use to collate index Terms, to determine their membership in the range bounded by lowerTerm and upperTerm.
Method Detail

setBoost

public void setBoost(float b)
Deprecated. 
Description copied from class: Query
Sets the boost for this query clause to b. Documents matching this clause will (in addition to the normal weightings) have their score multiplied by b.

Overrides:
setBoost in class Query

rewrite

public Query rewrite(IndexReader reader)
              throws IOException
Deprecated. 
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:
IOException

getField

public String getField()
Deprecated. 
Returns the field name for this query


getLowerTerm

public Term getLowerTerm()
Deprecated. 
Returns the lower term of this range query.


getUpperTerm

public Term getUpperTerm()
Deprecated. 
Returns the upper term of this range query.


isInclusive

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


getCollator

public Collator getCollator()
Deprecated. 
Returns the collator used to determine range inclusion, if any.


toString

public String toString(String field)
Deprecated. 
Prints a user-readable version of this query.

Specified by:
toString in class Query

equals

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

Overrides:
equals in class Query

hashCode

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

Overrides:
hashCode in class Query


Copyright © 2000-2010 Apache Software Foundation. All Rights Reserved.