Save This Page
Home » lucene-3.0.1-src » org.apache » lucene » search » [javadoc | source]
org.apache.lucene.search
public class: RangeQuery [javadoc | source]
java.lang.Object
   org.apache.lucene.search.Query
      org.apache.lucene.search.RangeQuery

All Implemented Interfaces:
    Cloneable, Serializable

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:
Constructor:
 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.
    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.
 public RangeQuery(Term lowerTerm,
    Term upperTerm,
    boolean inclusive,
    Collator collator) 
    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 from org.apache.lucene.search.RangeQuery Summary:
equals,   getCollator,   getField,   getLowerTerm,   getUpperTerm,   hashCode,   isInclusive,   rewrite,   toString
Methods from org.apache.lucene.search.Query:
clone,   combine,   createWeight,   equals,   extractTerms,   getBoost,   getSimilarity,   hashCode,   mergeBooleanQueries,   rewrite,   setBoost,   toString,   toString,   weight
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.lucene.search.RangeQuery Detail:
 public boolean equals(Object o) 
    Returns true iff o is equal to this.
 public Collator getCollator() 
    Returns the collator used to determine range inclusion, if any.
 public String getField() 
    Returns the field name for this query
 public Term getLowerTerm() 
    Returns the lower term of this range query
 public Term getUpperTerm() 
    Returns the upper term of this range query
 public int hashCode() 
    Returns a hash code value for this object.
 public boolean isInclusive() 
    Returns true if the range query is inclusive
 public Query rewrite(IndexReader reader) throws IOException 
 public String toString(String field) 
    Prints a user-readable version of this query.