Class WildcardQuery
- java.lang.Object
-
- org.apache.lucene.search.Query
-
- org.apache.jackrabbit.core.query.lucene.WildcardQuery
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Transformable
,TransformConstants
- Direct Known Subclasses:
WildcardNameQuery
public class WildcardQuery extends Query implements Transformable
Implements a wildcard query on a lucene field with an embedded property name and a pattern.Wildcards are:
%
: matches zero or more characters_
: matches exactly one character
- 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 WildcardQuery(String field, String propName, String pattern, int transform, org.apache.jackrabbit.core.query.lucene.PerQueryCache cache)
Creates a newWildcardQuery
.WildcardQuery(String field, String propName, String pattern, org.apache.jackrabbit.core.query.lucene.PerQueryCache cache)
Creates a newWildcardQuery
.
-
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)
Either rewrites this query to a lucene MultiTermQuery or in case of a TooManyClauses exception to a custom jackrabbit query implementation that uses a BitSet to collect all hits.void
setTransformation(int transformation)
Sets the transformation.String
toString(String field)
Returns a string representation of this query.
-
-
-
Constructor Detail
-
WildcardQuery
public WildcardQuery(String field, String propName, String pattern, int transform, org.apache.jackrabbit.core.query.lucene.PerQueryCache cache)
Creates a newWildcardQuery
.- Parameters:
field
- the name of the field to search.propName
- name of the property to search.pattern
- the wildcard pattern.transform
- how property values are transformed before they are matched using thepattern
.
-
WildcardQuery
public WildcardQuery(String field, String propName, String pattern, org.apache.jackrabbit.core.query.lucene.PerQueryCache cache)
Creates a newWildcardQuery
.- Parameters:
field
- the name of the field to search.propName
- name of the property to search.pattern
- the wildcard pattern.
-
-
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
Either rewrites this query to a lucene MultiTermQuery or in case of a TooManyClauses exception to a custom jackrabbit query implementation that uses a BitSet to collect all hits.- Overrides:
rewrite
in classQuery
- Parameters:
reader
- the index reader to use for the search.- Returns:
- the rewritten query.
- Throws:
IOException
- if an error occurs while reading from the index.
-
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
-
-