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 booleanequals(Object o)abstract DocIdSetgetDocIdSet(AtomicReaderContext context, Bits acceptDocs)This method is implemented for each data typeStringgetField()Returns the field name for this filterBytesRefgetLowerVal()Returns the lower value of this range filterBytesRefgetUpperVal()Returns the upper value of this range filterinthashCode()booleanincludesLower()Returnstrueif the lower endpoint is inclusivebooleanincludesUpper()Returnstrueif 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).StringtoString()
-
-
-
Method Detail
-
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.
-
getField
public String 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
public BytesRef getLowerVal()
Returns the lower value of this range filter
-
getUpperVal
public BytesRef getUpperVal()
Returns the upper value of this range filter
-
-