public class RangeQuery extends Query
[010 TO 120]
but only if the QueryParser has
the useOldRangeQuery property set to true. The QueryParser default behaviour is to use
the newer ConstantScoreRangeQuery class. This is generally preferable because:
ConstantScoreRangeQuery
,
Serialized FormConstructor and Description |
---|
RangeQuery(Term lowerTerm,
Term upperTerm,
boolean inclusive)
Constructs a query selecting all terms greater than
lowerTerm but less than upperTerm . |
RangeQuery(Term lowerTerm,
Term upperTerm,
boolean inclusive,
Collator collator)
Constructs a query selecting all terms greater than
lowerTerm but less than upperTerm . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Returns true iff
o is equal to this. |
Collator |
getCollator()
Returns the collator used to determine range inclusion, if any.
|
String |
getField()
Returns the field name for this query
|
Term |
getLowerTerm()
Returns the lower term of this range query
|
Term |
getUpperTerm()
Returns the upper term of this range query
|
int |
hashCode()
Returns a hash code value for this object.
|
boolean |
isInclusive()
Returns
true if the range query is inclusive |
Query |
rewrite(IndexReader reader)
Expert: called to re-write queries into primitive queries.
|
String |
toString(String field)
Prints a user-readable version of this query.
|
clone, combine, createWeight, extractTerms, getBoost, getSimilarity, mergeBooleanQueries, setBoost, toString, weight
public RangeQuery(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.lowerTerm
- The Term at the lower end of the rangeupperTerm
- The Term at the upper end of the rangeinclusive
- If true, both lowerTerm
and
upperTerm
will themselves be included in the range.public RangeQuery(Term lowerTerm, Term upperTerm, boolean inclusive, Collator collator)
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.
If collator
is not null, it will be used to decide whether
index terms are within the given range, rather than using the Unicode code
point order in which index terms are stored.
WARNING: Using this constructor and supplying a non-null
value in the collator
parameter will cause every single
index Term in the Field referenced by lowerTerm and/or upperTerm to be
examined. Depending on the number of index Terms in this Field, the
operation could be very slow.
lowerTerm
- The Term at the lower end of the rangeupperTerm
- The Term at the upper end of the rangeinclusive
- If true, both lowerTerm
and
upperTerm
will themselves be included in the range.collator
- The collator to use to collate index Terms, to determine
their membership in the range bounded by lowerTerm
and
upperTerm
.public Query rewrite(IndexReader reader) throws IOException
Query
rewrite
in class Query
IOException
public String getField()
public Term getLowerTerm()
public Term getUpperTerm()
public boolean isInclusive()
true
if the range query is inclusivepublic Collator getCollator()
public boolean equals(Object o)
o
is equal to this.Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.