public class SpanRangeQuery extends SpanQuery
Modifier and Type | Field and Description |
---|---|
private boolean |
inclusive |
private Term |
lowerTerm |
private int |
termLimit |
private static int |
TERMS_TO_REPORT
Limit on the number of terms to report on an error
|
private Term |
upperTerm |
Constructor and Description |
---|
SpanRangeQuery(Term lowerTerm,
Term upperTerm,
boolean inclusive)
Constructs a span query selecting all terms greater than
lowerTerm but less than upperTerm . |
SpanRangeQuery(Term lowerTerm,
Term upperTerm,
boolean inclusive,
int termLimit)
Constructs a span query selecting all terms greater than
lowerTerm but less than upperTerm . |
Modifier and Type | Method and Description |
---|---|
Query |
combine(Query[] queries) |
String |
getField()
Returns the field name for this query
|
Term |
getLowerTerm()
Returns the lower term of this range query
|
Spans |
getSpans(IndexReader reader,
Searcher searcher)
Should never be called on this query itself, only on the result of
rewrite(IndexReader) . |
int |
getTermLimit()
Returns the term limit, if any, for this range query
|
Collection |
getTerms()
Should never be called on this query itself, only on the result of
rewrite(IndexReader) . |
Term |
getUpperTerm()
Returns the upper term of this range query
|
boolean |
isInclusive()
Returns
true if the range query is inclusive |
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) |
createWeight, getSpanRecording, setSpanRecording
private int termLimit
private Term lowerTerm
private Term upperTerm
private boolean inclusive
private static final int TERMS_TO_REPORT
public SpanRangeQuery(Term lowerTerm, Term upperTerm, boolean inclusive)
lowerTerm
but less than upperTerm
.
There must be at least one term and either term may be null,
in which case there is no bound on that side, but if there are
two terms, both terms must be for the same field.public SpanRangeQuery(Term lowerTerm, Term upperTerm, boolean inclusive, int termLimit)
lowerTerm
but less than upperTerm
.
There must be at least one term and either term may be null,
in which case there is no bound on that side, but if there are
two terms, both terms must be for the same field. Applies
a limit on the total number of terms matched.public Query rewrite(IndexReader reader) throws IOException
rewrite
in class Query
IOException
protected boolean shouldSkipTerm(Term t)
public Query combine(Query[] queries)
combine
in class Query
public String getField()
public Term getLowerTerm()
public Term getUpperTerm()
public boolean isInclusive()
true
if the range query is inclusivepublic int getTermLimit()
public String toString(String field)
toString
in class Query
public Spans getSpans(IndexReader reader, Searcher searcher) throws IOException
rewrite(IndexReader)
.public Collection getTerms()
rewrite(IndexReader)
.