Class RangeQuery
- java.lang.Object
-
- org.apache.lucene.search.Query
-
- org.apache.jackrabbit.core.query.lucene.RangeQuery
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Transformable
,TransformConstants
- Direct Known Subclasses:
LocalNameRangeQuery
public class RangeQuery extends Query implements Transformable
Implements a variant of the lucene classorg.apache.lucene.search.RangeQuery
. This class does not rewrite to basicTermQuery
but will calculate the matching documents itself. That way aTooManyClauses
can be avoided.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.apache.jackrabbit.core.query.lucene.TransformConstants
TRANSFORM_LOWER_CASE, TRANSFORM_NONE, TRANSFORM_UPPER_CASE
-
-
Constructor Summary
Constructors Constructor Description RangeQuery(Term lowerTerm, Term upperTerm, boolean inclusive, int transform, org.apache.jackrabbit.core.query.lucene.PerQueryCache cache)
Creates a new RangeQuery.RangeQuery(Term lowerTerm, Term upperTerm, boolean inclusive, org.apache.jackrabbit.core.query.lucene.PerQueryCache cache)
Creates a new RangeQuery.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Weight
createWeight(Searcher searcher)
Creates theWeight
for this query.void
extractTerms(Set<Term> terms)
Query
rewrite(IndexReader reader)
Tries to rewrite this query into a standard lucene RangeQuery.void
setTransformation(int transformation)
Sets the transformation.String
toString(String field)
Returns a string representation of this query.
-
-
-
Constructor Detail
-
RangeQuery
public RangeQuery(Term lowerTerm, Term upperTerm, boolean inclusive, org.apache.jackrabbit.core.query.lucene.PerQueryCache cache)
Creates a new RangeQuery. The lower or the upper term may benull
, but not both!- Parameters:
lowerTerm
- the lower term of the interval, ornull
upperTerm
- the upper term of the interval, ornull
.inclusive
- iftrue
the interval is inclusive.
-
RangeQuery
public RangeQuery(Term lowerTerm, Term upperTerm, boolean inclusive, int transform, org.apache.jackrabbit.core.query.lucene.PerQueryCache cache)
Creates a new RangeQuery. The lower or the upper term may benull
, but not both!- Parameters:
lowerTerm
- the lower term of the interval, ornull
upperTerm
- the upper term of the interval, ornull
.inclusive
- iftrue
the interval is inclusive.transform
- how term enums are transformed when read from the index.
-
-
Method Detail
-
setTransformation
public void setTransformation(int transformation)
Sets the transformation. Must be one of the following values:- Specified by:
setTransformation
in interfaceTransformable
- Parameters:
transformation
- a transform constant.
-
rewrite
public Query rewrite(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 classQuery
- Parameters:
reader
- the index reader.- Returns:
- the rewritten query or this query if rewriting is not possible.
- Throws:
IOException
- if an error occurs.
-
createWeight
public Weight createWeight(Searcher searcher)
Creates theWeight
for this query.- Overrides:
createWeight
in classQuery
- Parameters:
searcher
- the searcher to use for theWeight
.- Returns:
- the
Weigth
for this query.
-
extractTerms
public void extractTerms(Set<Term> terms)
- Overrides:
extractTerms
in classQuery
-
-