Package org.apache.lucene.queries.spans
Class SpanNotQuery
- java.lang.Object
-
- org.apache.lucene.search.Query
-
- org.apache.lucene.queries.spans.SpanQuery
-
- org.apache.lucene.queries.spans.SpanNotQuery
-
public final class SpanNotQuery extends SpanQuery
Removes matches which overlap with another SpanQuery or which are within x tokens before or y tokens after another SpanQuery.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
SpanNotQuery.SpanNotWeight
Creates SpanNotQuery scorer instances
-
Constructor Summary
Constructors Constructor Description SpanNotQuery(SpanQuery include, SpanQuery exclude)
Construct a SpanNotQuery matching spans frominclude
which have no overlap with spans fromexclude
.SpanNotQuery(SpanQuery include, SpanQuery exclude, int dist)
Construct a SpanNotQuery matching spans frominclude
which have no overlap with spans fromexclude
withindist
tokens ofinclude
.SpanNotQuery(SpanQuery include, SpanQuery exclude, int pre, int post)
Construct a SpanNotQuery matching spans frominclude
which have no overlap with spans fromexclude
withinpre
tokens before orpost
tokens ofinclude
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SpanWeight
createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)
boolean
equals(Object other)
Returns true iffo
is equal to this.SpanQuery
getExclude()
Return the SpanQuery whose matches must not overlap those returned.String
getField()
Returns the name of the field matched by this query.SpanQuery
getInclude()
Return the SpanQuery whose matches are filtered.int
hashCode()
Query
rewrite(IndexSearcher indexSearcher)
String
toString(String field)
void
visit(QueryVisitor visitor)
-
Methods inherited from class org.apache.lucene.queries.spans.SpanQuery
getTermStates, getTermStates
-
Methods inherited from class org.apache.lucene.search.Query
classHash, rewrite, sameClassAs, toString
-
-
-
-
Constructor Detail
-
SpanNotQuery
public SpanNotQuery(SpanQuery include, SpanQuery exclude)
Construct a SpanNotQuery matching spans frominclude
which have no overlap with spans fromexclude
.
-
SpanNotQuery
public SpanNotQuery(SpanQuery include, SpanQuery exclude, int dist)
Construct a SpanNotQuery matching spans frominclude
which have no overlap with spans fromexclude
withindist
tokens ofinclude
. Inversely, a negativedist
value may be used to specify a certain amount of allowable overlap.
-
SpanNotQuery
public SpanNotQuery(SpanQuery include, SpanQuery exclude, int pre, int post)
Construct a SpanNotQuery matching spans frominclude
which have no overlap with spans fromexclude
withinpre
tokens before orpost
tokens ofinclude
. Inversely, negative values forpre
and/orpost
allow a certain amount of overlap to occur.
-
-
Method Detail
-
getInclude
public SpanQuery getInclude()
Return the SpanQuery whose matches are filtered.
-
getExclude
public SpanQuery getExclude()
Return the SpanQuery whose matches must not overlap those returned.
-
getField
public String getField()
Description copied from class:SpanQuery
Returns the name of the field matched by this query.
-
createWeight
public SpanWeight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException
- Specified by:
createWeight
in classSpanQuery
- Throws:
IOException
-
rewrite
public Query rewrite(IndexSearcher indexSearcher) throws IOException
- Overrides:
rewrite
in classQuery
- Throws:
IOException
-
visit
public void visit(QueryVisitor visitor)
-
equals
public boolean equals(Object other)
Returns true iffo
is equal to this.
-
-