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 basicTermQuerybut will calculate the matching documents itself. That way aTooManyClausescan 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 WeightcreateWeight(Searcher searcher)Creates theWeightfor this query.voidextractTerms(Set<Term> terms)Queryrewrite(IndexReader reader)Tries to rewrite this query into a standard lucene RangeQuery.voidsetTransformation(int transformation)Sets the transformation.StringtoString(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, ornullupperTerm- the upper term of the interval, ornull.inclusive- iftruethe 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, ornullupperTerm- the upper term of the interval, ornull.inclusive- iftruethe 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:
setTransformationin 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:
rewritein 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 theWeightfor this query.- Overrides:
createWeightin classQuery- Parameters:
searcher- the searcher to use for theWeight.- Returns:
- the
Weigthfor this query.
-
extractTerms
public void extractTerms(Set<Term> terms)
- Overrides:
extractTermsin classQuery
-
-