public class TermRangeFilter extends MultiTermQueryWrapperFilter<TermRangeQuery>
This filter matches the documents looking for terms that fall into the
supplied range according to Byte.compareTo(Byte)
, It is not intended
for numerical ranges; use NumericRangeFilter
instead.
If you construct a large number of range filters with different ranges but on the
same field, FieldCacheRangeFilter
may have significantly better performance.
query
Constructor and Description |
---|
TermRangeFilter(String fieldName,
BytesRef lowerTerm,
BytesRef upperTerm,
boolean includeLower,
boolean includeUpper) |
Modifier and Type | Method and Description |
---|---|
BytesRef |
getLowerTerm()
Returns the lower value of this range filter
|
BytesRef |
getUpperTerm()
Returns the upper value of this range filter
|
boolean |
includesLower()
Returns
true if the lower endpoint is inclusive |
boolean |
includesUpper()
Returns
true if the upper endpoint is inclusive |
static TermRangeFilter |
Less(String fieldName,
BytesRef upperTerm)
Constructs a filter for field
fieldName matching
less than or equal to upperTerm . |
static TermRangeFilter |
More(String fieldName,
BytesRef lowerTerm)
Constructs a filter for field
fieldName matching
greater than or equal to lowerTerm . |
static TermRangeFilter |
newStringRange(String field,
String lowerTerm,
String upperTerm,
boolean includeLower,
boolean includeUpper)
Factory that creates a new TermRangeFilter using Strings for term text.
|
equals, getDocIdSet, getField, hashCode, toString
public TermRangeFilter(String fieldName, BytesRef lowerTerm, BytesRef upperTerm, boolean includeLower, boolean includeUpper)
fieldName
- The field this range applies tolowerTerm
- The lower bound on this rangeupperTerm
- The upper bound on this rangeincludeLower
- Does this range include the lower bound?includeUpper
- Does this range include the upper bound?IllegalArgumentException
- if both terms are null or if
lowerTerm is null and includeLower is true (similar for upperTerm
and includeUpper)public static TermRangeFilter newStringRange(String field, String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper)
public static TermRangeFilter Less(String fieldName, BytesRef upperTerm)
fieldName
matching
less than or equal to upperTerm
.public static TermRangeFilter More(String fieldName, BytesRef lowerTerm)
fieldName
matching
greater than or equal to lowerTerm
.public BytesRef getLowerTerm()
public BytesRef getUpperTerm()
public boolean includesLower()
true
if the lower endpoint is inclusivepublic boolean includesUpper()
true
if the upper endpoint is inclusiveCopyright © 2000-2012 Apache Software Foundation. All Rights Reserved.