org.apache.lucene.search.spans

Class SpanNearQuery

Implemented Interfaces:
Cloneable, Serializable

public class SpanNearQuery
extends SpanQuery

Matches spans which are near one another. One can specify slop, the maximum number of intervening unmatched positions, as well as whether matches are required to be in-order.
See Also:
Serialized Form

Constructor Summary

SpanNearQuery(SpanQuery[] clauses, int slop, boolean inOrder)
Construct a SpanNearQuery.

Method Summary

boolean
equals(Object o)
Returns true iff o is equal to this.
SpanQuery[]
getClauses()
Return the clauses whose spans are matched.
String
getField()
Returns the name of the field matched by this query.
int
getSlop()
Return the maximum number of intervening unmatched positions permitted.
Spans
getSpans(IndexReader reader)
Expert: Returns the matches for this query in an index.
Collection
getTerms()
Returns a collection of all terms matched by this query.
int
hashCode()
boolean
isInOrder()
Return true if matches are required to be in-order.
Query
rewrite(IndexReader reader)
String
toString(String field)

Methods inherited from class org.apache.lucene.search.spans.SpanQuery

createWeight, getField, getSpans, getTerms

Methods inherited from class org.apache.lucene.search.Query

clone, combine, createWeight, extractTerms, getBoost, getSimilarity, mergeBooleanQueries, rewrite, setBoost, toString, toString, weight

Constructor Details

SpanNearQuery

public SpanNearQuery(SpanQuery[] clauses,
                     int slop,
                     boolean inOrder)
Construct a SpanNearQuery. Matches spans matching a span from each clause, with up to slop total unmatched positions between them. * When inOrder is true, the spans from each clause must be * ordered as in clauses.

Method Details

equals

public boolean equals(Object o)
Returns true iff o is equal to this.

getClauses

public SpanQuery[] getClauses()
Return the clauses whose spans are matched.

getField

public String getField()
Returns the name of the field matched by this query.
Overrides:
getField in interface SpanQuery

getSlop

public int getSlop()
Return the maximum number of intervening unmatched positions permitted.

getSpans

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

getTerms

public Collection getTerms()
Returns a collection of all terms matched by this query.
Overrides:
getTerms in interface SpanQuery

hashCode

public int hashCode()

isInOrder

public boolean isInOrder()
Return true if matches are required to be in-order.

rewrite

public Query rewrite(IndexReader reader)
            throws IOException
Overrides:
rewrite in interface Query

toString

public String toString(String field)
Overrides:
toString in interface Query

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