org.apache.jackrabbit.core.query.lucene
Class RangeQuery
java.lang.Object
org.apache.lucene.search.Query
org.apache.jackrabbit.core.query.lucene.RangeQuery
- All Implemented Interfaces:
- Serializable, Cloneable, TransformConstants
public class RangeQuery
- extends org.apache.lucene.search.Query
- implements TransformConstants
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,
int transform)
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, extractTerms, getBoost, getSimilarity, mergeBooleanQueries, setBoost, toString, weight |
RangeQuery
public RangeQuery(org.apache.lucene.index.Term lowerTerm,
org.apache.lucene.index.Term upperTerm,
boolean inclusive,
int transform)
- 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.transform
- how term enums are transformed when read from the index.
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.
- Overrides:
rewrite
in class org.apache.lucene.search.Query
- 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.
- Overrides:
createWeight
in class org.apache.lucene.search.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.
- Specified by:
toString
in class org.apache.lucene.search.Query
- Parameters:
field
- the field name for which to create a string representation.
- Returns:
- a string representation of this query.
Copyright © 2004-2007 The Apache Software Foundation. All Rights Reserved.