org.apache.lucene.search.spans
Class SpanQuery

java.lang.Object
  extended by org.apache.lucene.search.Query
      extended by org.apache.lucene.search.spans.SpanQuery
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
SpanFirstQuery, SpanNearQuery, SpanNotQuery, SpanOrQuery, SpanRegexQuery, SpanTermQuery

public abstract class SpanQuery
extends Query

Base class for span-based queries.

See Also:
Serialized Form

Constructor Summary
SpanQuery()
           
 
Method Summary
protected  Weight createWeight(Searcher searcher)
          Expert: Constructs an appropriate Weight implementation for this query.
abstract  java.lang.String getField()
          Returns the name of the field matched by this query.
 PayloadSpans getPayloadSpans(IndexReader reader)
          Returns the matches for this query in an index, including access to any Payloads at those positions.
abstract  Spans getSpans(IndexReader reader)
          Expert: Returns the matches for this query in an index.
abstract  java.util.Collection getTerms()
          Deprecated. use extractTerms instead
 
Methods inherited from class org.apache.lucene.search.Query
clone, combine, extractTerms, getBoost, getSimilarity, mergeBooleanQueries, rewrite, setBoost, toString, toString, weight
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SpanQuery

public SpanQuery()
Method Detail

getSpans

public abstract Spans getSpans(IndexReader reader)
                        throws java.io.IOException
Expert: Returns the matches for this query in an index. Used internally to search for spans.

Throws:
java.io.IOException

getPayloadSpans

public PayloadSpans getPayloadSpans(IndexReader reader)
                             throws java.io.IOException
Returns the matches for this query in an index, including access to any Payloads at those positions. Implementing classes that want access to the payloads will need to implement this.

Parameters:
reader - The IndexReader to use to get spans/payloads
Returns:
null
Throws:
java.io.IOException - if there is an error accessing the payload WARNING: The status of the Payloads feature is experimental. The APIs introduced here might change in the future and will not be supported anymore in such a case.

getField

public abstract java.lang.String getField()
Returns the name of the field matched by this query.


getTerms

public abstract java.util.Collection getTerms()
Deprecated. use extractTerms instead

Returns a collection of all terms matched by this query.

See Also:
Query.extractTerms(Set)

createWeight

protected Weight createWeight(Searcher searcher)
                       throws java.io.IOException
Description copied from class: Query
Expert: Constructs an appropriate Weight implementation for this query.

Only implemented by primitive queries, which re-write to themselves.

Overrides:
createWeight in class Query
Throws:
java.io.IOException


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.