org.apache.lucene.search.spans
Class SpanWildcardQuery

Object
  extended by Query
      extended by SpanQuery
          extended by SpanTermQuery
              extended by SpanWildcardQuery
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
BigramSpanWildcardQuery

public class SpanWildcardQuery
extends SpanTermQuery

Matches spans containing a wildcard term.

See Also:
Serialized Form

Field Summary
private  int termLimit
          Limit on the total number of terms matched
private static int TERMS_TO_REPORT
          Limit on the number of terms to report on an error
 
Constructor Summary
SpanWildcardQuery(Term term)
          Construct a SpanWildcardTermQuery matching expanded terms
SpanWildcardQuery(Term term, int termLimit)
          Construct a SpanWildcardTermQuery matching expanded terms, but limiting the total number of terms matched.
 
Method Summary
 Spans getSpans(IndexReader reader, Searcher searcher)
          Should never be called on the wildcard query itself, only on the result of rewrite(IndexReader).
 int getTermLimit()
          Retrieve the term limit this was constructed with
 Query rewrite(IndexReader reader)
          This method is actually the workhorse of the class.
protected  boolean shouldSkipTerm(Term t)
          Enables derived classes to skip certain terms in the index (e.g. stop words, bi-grams, etc.)
 String toString(String field)
           
 
Methods inherited from class SpanTermQuery
getField, getTerm, getTermLength, getTerms
 
Methods inherited from class SpanQuery
createWeight, getSpanRecording, setSpanRecording
 
Methods inherited from class Query
clone, combine, extractTerms, getBoost, getSimilarity, mergeBooleanQueries, setBoost, toString, weight
 
Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

termLimit

private int termLimit
Limit on the total number of terms matched


TERMS_TO_REPORT

private static final int TERMS_TO_REPORT
Limit on the number of terms to report on an error

See Also:
Constant Field Values
Constructor Detail

SpanWildcardQuery

public SpanWildcardQuery(Term term)
Construct a SpanWildcardTermQuery matching expanded terms


SpanWildcardQuery

public SpanWildcardQuery(Term term,
                         int termLimit)
Construct a SpanWildcardTermQuery matching expanded terms, but limiting the total number of terms matched.

Method Detail

getTermLimit

public int getTermLimit()
Retrieve the term limit this was constructed with


rewrite

public Query rewrite(IndexReader reader)
              throws IOException
This method is actually the workhorse of the class. Rewrites the wildcard query as a large span OR query on all of the matching terms.

Overrides:
rewrite in class Query
Throws:
IOException

shouldSkipTerm

protected boolean shouldSkipTerm(Term t)
Enables derived classes to skip certain terms in the index (e.g. stop words, bi-grams, etc.) Default implementation doesn't skip any terms.


getSpans

public Spans getSpans(IndexReader reader,
                      Searcher searcher)
               throws IOException
Should never be called on the wildcard query itself, only on the result of rewrite(IndexReader).

Overrides:
getSpans in class SpanTermQuery
Throws:
IOException

toString

public String toString(String field)
Overrides:
toString in class SpanTermQuery