org.apache.jackrabbit.core.query.lucene
Class RangeQuery

java.lang.Object
  extended byorg.apache.lucene.search.Query
      extended byorg.apache.jackrabbit.core.query.lucene.RangeQuery
All Implemented Interfaces:
Cloneable, Serializable

public class RangeQuery
extends org.apache.lucene.search.Query

Implements a variant of the lucene class RangeQuery. This class does not rewrite to basic TermQuery but will calculate the matching documents itself. That way a TooManyClauses can be avoided.

See Also:
Serialized Form

Constructor Summary
RangeQuery(org.apache.lucene.index.Term lowerTerm, org.apache.lucene.index.Term upperTerm, boolean inclusive)
          Creates a new RangeQuery.
 
Method Summary
protected  org.apache.lucene.search.Weight createWeight(org.apache.lucene.search.Searcher searcher)
          Creates the Weight for this query.
 org.apache.lucene.search.Query rewrite(org.apache.lucene.index.IndexReader reader)
          Tries to rewrite this query into a standard lucene RangeQuery.
 String toString(String field)
          Returns a string representation of this query.
 
Methods inherited from class org.apache.lucene.search.Query
clone, combine, getBoost, getSimilarity, mergeBooleanQueries, setBoost, toString, weight
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RangeQuery

public RangeQuery(org.apache.lucene.index.Term lowerTerm,
                  org.apache.lucene.index.Term upperTerm,
                  boolean inclusive)
Creates a new RangeQuery. The lower or the upper term may be null, but not both!

Parameters:
lowerTerm - the lower term of the interval, or null
upperTerm - the upper term of the interval, or null.
inclusive - if true the interval is inclusive.
Method Detail

rewrite

public org.apache.lucene.search.Query rewrite(org.apache.lucene.index.IndexReader reader)
                                       throws IOException
Tries to rewrite this query into a standard lucene RangeQuery. This rewrite might fail with a TooManyClauses exception. If that happens, we use our own implementation.

Parameters:
reader - the index reader.
Returns:
the rewritten query or this query if rewriting is not possible.
Throws:
IOException - if an error occurs.

createWeight

protected org.apache.lucene.search.Weight createWeight(org.apache.lucene.search.Searcher searcher)
Creates the Weight for this query.

Parameters:
searcher - the searcher to use for the Weight.
Returns:
the Weigth for this query.

toString

public String toString(String field)
Returns a string representation of this query.

Parameters:
field - the field name for which to create a string representation.
Returns:
a string representation of this query.


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.