Package org.apache.lucene.search
Class DocTermOrdsRangeFilter
java.lang.Object
org.apache.lucene.search.Filter
org.apache.lucene.search.DocTermOrdsRangeFilter
A range filter built on top of a cached multi-valued term field (in
FieldCache).
Like FieldCacheRangeFilter, this is just a specialized range query versus
using a TermRangeQuery with DocTermOrdsRewriteMethod: it will only do
two ordinal to term lookups.
-
Method Summary
Modifier and TypeMethodDescriptionfinal booleanabstract DocIdSetgetDocIdSet(AtomicReaderContext context, Bits acceptDocs) This method is implemented for each data typegetField()Returns the field name for this filterReturns the lower value of this range filterReturns the upper value of this range filterfinal inthashCode()booleanReturnstrueif the lower endpoint is inclusivebooleanReturnstrueif the upper endpoint is inclusivestatic DocTermOrdsRangeFilternewBytesRefRange(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).final StringtoString()
-
Method Details
-
getDocIdSet
public abstract DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) throws IOException This method is implemented for each data type- Specified by:
getDocIdSetin classFilter- Parameters:
context- aAtomicReaderContextinstance 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:
nullshould be returned if the filter doesn't accept any documents otherwise internal optimization might not apply in the case an emptyDocIdSetis 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. -
toString
-
equals
-
hashCode
public final int hashCode() -
getField
Returns the field name for this filter -
includesLower
public boolean includesLower()Returnstrueif the lower endpoint is inclusive -
includesUpper
public boolean includesUpper()Returnstrueif the upper endpoint is inclusive -
getLowerVal
Returns the lower value of this range filter -
getUpperVal
Returns the upper value of this range filter
-