org.apache.lucene.search.spans
Class SpanTermQuery

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

public class SpanTermQuery
extends SpanQuery

Matches spans containing a term.

See Also:
Serialized Form

Field Summary
private  Term term
           
private  int termLength
           
 
Constructor Summary
SpanTermQuery(Term term)
          Construct a SpanTermQuery matching the named term's spans.
SpanTermQuery(Term term, int termLength)
          Construct a SpanTermQuery matching the named term's spans, using the specified stop-word set.
 
Method Summary
 String getField()
          Returns the name of the field matched by this query.
 Spans getSpans(IndexReader reader, Searcher searcher)
          Expert: Returns the matches for this query in an index.
 Term getTerm()
          Return the term whose spans are matched.
 int getTermLength()
          Return the length of the term in positions (typically 1)
 Collection getTerms()
          Returns a collection of all terms matched by this query.
 String toString(String field)
           
 
Methods inherited from class SpanQuery
createWeight, getSpanRecording, setSpanRecording
 
Methods inherited from class Query
clone, combine, extractTerms, getBoost, getSimilarity, mergeBooleanQueries, rewrite, setBoost, toString, weight
 
Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

term

private Term term

termLength

private int termLength
Constructor Detail

SpanTermQuery

public SpanTermQuery(Term term)
Construct a SpanTermQuery matching the named term's spans.


SpanTermQuery

public SpanTermQuery(Term term,
                     int termLength)
Construct a SpanTermQuery matching the named term's spans, using the specified stop-word set.

Method Detail

getTerm

public Term getTerm()
Return the term whose spans are matched.


getTermLength

public int getTermLength()
Return the length of the term in positions (typically 1)


getField

public String getField()
Description copied from class: SpanQuery
Returns the name of the field matched by this query.

Specified by:
getField in class SpanQuery

getTerms

public Collection getTerms()
Description copied from class: SpanQuery
Returns a collection of all terms matched by this query.

Specified by:
getTerms in class SpanQuery

toString

public String toString(String field)
Specified by:
toString in class Query

getSpans

public Spans getSpans(IndexReader reader,
                      Searcher searcher)
               throws IOException
Description copied from class: SpanQuery
Expert: Returns the matches for this query in an index. Used internally to search for spans.

Specified by:
getSpans in class SpanQuery
Throws:
IOException