Package org.apache.lucene.search
Class DocTermOrdsRangeFilter
- java.lang.Object
-
- org.apache.lucene.search.Filter
-
- org.apache.lucene.search.DocTermOrdsRangeFilter
-
public abstract class DocTermOrdsRangeFilter extends Filter
A range filter built on top of a cached multi-valued term field (inFieldCache
).Like
FieldCacheRangeFilter
, this is just a specialized range query versus using a TermRangeQuery withDocTermOrdsRewriteMethod
: it will only do two ordinal to term lookups.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
abstract DocIdSet
getDocIdSet(AtomicReaderContext context, Bits acceptDocs)
This method is implemented for each data typeString
getField()
Returns the field name for this filterBytesRef
getLowerVal()
Returns the lower value of this range filterBytesRef
getUpperVal()
Returns the upper value of this range filterint
hashCode()
boolean
includesLower()
Returnstrue
if the lower endpoint is inclusiveboolean
includesUpper()
Returnstrue
if the upper endpoint is inclusivestatic DocTermOrdsRangeFilter
newBytesRefRange(String field, BytesRef lowerVal, BytesRef upperVal, boolean includeLower, boolean includeUpper)
Creates a BytesRef range filter usingFieldCache.getTermsIndex(org.apache.lucene.index.AtomicReader, java.lang.String)
.String
toString()
-
-
-
Method Detail
-
getDocIdSet
public abstract DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) throws IOException
This method is implemented for each data type- Specified by:
getDocIdSet
in classFilter
- Parameters:
context
- aAtomicReaderContext
instance opened on the index currently searched on. Note, it is likely that the provided reader info does not represent the whole underlying index i.e. if the index has more than one segment the given reader only represents a single segment. The provided context is always an atomic context, so you can callAtomicReader.fields()
on the context's reader, for example.acceptDocs
- Bits that represent the allowable docs to match (typically deleted docs but possibly filtering other documents)- Returns:
- a DocIdSet that provides the documents which should be permitted or
prohibited in search results. NOTE:
null
should be returned if the filter doesn't accept any documents otherwise internal optimization might not apply in the case an emptyDocIdSet
is returned. - Throws:
IOException
-
newBytesRefRange
public static DocTermOrdsRangeFilter newBytesRefRange(String field, BytesRef lowerVal, BytesRef upperVal, boolean includeLower, boolean includeUpper)
Creates a BytesRef range filter usingFieldCache.getTermsIndex(org.apache.lucene.index.AtomicReader, java.lang.String)
. This works with all fields containing zero or one term in the field. The range can be half-open by setting one of the values tonull
.
-
getField
public String getField()
Returns the field name for this filter
-
includesLower
public boolean includesLower()
Returnstrue
if the lower endpoint is inclusive
-
includesUpper
public boolean includesUpper()
Returnstrue
if the upper endpoint is inclusive
-
getLowerVal
public BytesRef getLowerVal()
Returns the lower value of this range filter
-
getUpperVal
public BytesRef getUpperVal()
Returns the upper value of this range filter
-
-