public class RangeFilter extends Filter
This code borrows heavily from RangeQuery
, but is implemented as a Filter
Constructor and Description |
---|
RangeFilter(String fieldName,
String lowerTerm,
String upperTerm,
boolean includeLower,
boolean includeUpper) |
RangeFilter(String fieldName,
String lowerTerm,
String upperTerm,
boolean includeLower,
boolean includeUpper,
Collator collator)
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. |
Modifier and Type | Method and Description |
---|---|
BitSet |
bits(IndexReader reader)
Deprecated.
Use
getDocIdSet(IndexReader) instead. |
boolean |
equals(Object o)
Returns true if
o is equal to this. |
DocIdSet |
getDocIdSet(IndexReader reader)
Returns a DocIdSet with documents that should be
permitted in search results.
|
int |
hashCode()
Returns a hash code value for this object.
|
static RangeFilter |
Less(String fieldName,
String upperTerm)
Constructs a filter for field
fieldName matching
less than or equal to upperTerm . |
static RangeFilter |
More(String fieldName,
String lowerTerm)
Constructs a filter for field
fieldName matching
greater than or equal to lowerTerm . |
String |
toString() |
public RangeFilter(String fieldName, String lowerTerm, String 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 RangeFilter(String fieldName, String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper, Collator collator)
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 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?collator
- The collator to use when determining range inclusion; set
to null to use Unicode code point ordering instead of collation.IllegalArgumentException
- if both terms are null or if
lowerTerm is null and includeLower is true (similar for upperTerm
and includeUpper)public static RangeFilter Less(String fieldName, String upperTerm)
fieldName
matching
less than or equal to upperTerm
.public static RangeFilter More(String fieldName, String lowerTerm)
fieldName
matching
greater than or equal to lowerTerm
.public BitSet bits(IndexReader reader) throws IOException
getDocIdSet(IndexReader)
instead.bits
in class Filter
IOException
public DocIdSet getDocIdSet(IndexReader reader) throws IOException
getDocIdSet
in class Filter
IOException
DocIdBitSet
public boolean equals(Object o)
o
is equal to this.Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.