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

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

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

Implements a wildcard query on a lucene field with an embedded property name and a pattern.

Wildcards are:

See Also:
Serialized Form

Constructor Summary
WildcardQuery(String field, String propName, String pattern)
          Creates a new WildcardQuery.
 
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)
          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.
 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

WildcardQuery

public WildcardQuery(String field,
                     String propName,
                     String pattern)
Creates a new WildcardQuery.

Parameters:
field - the name of the field to search.
propName - name of the property to search.
pattern - the wildcard pattern.
Method Detail

rewrite

public org.apache.lucene.search.Query rewrite(org.apache.lucene.index.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.

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

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.