Class NumericComparator.NumericLeafComparator
java.lang.Object
org.apache.lucene.search.comparators.NumericComparator.NumericLeafComparator
- All Implemented Interfaces:
LeafFieldComparator
- Direct Known Subclasses:
DoubleComparator.DoubleLeafComparator,FloatComparator.FloatLeafComparator,IntComparator.IntLeafComparator,LongComparator.LongLeafComparator
- Enclosing class:
NumericComparator<T extends Number>
public abstract class NumericComparator.NumericLeafComparator
extends Object
implements LeafFieldComparator
Leaf comparator for
NumericComparator that provides skipping functionality-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract longReturns a competitive iteratorvoidcopy(int slot, int doc) This method is called when a new hit is competitive.protected NumericDocValuesgetNumericDocValues(LeafReaderContext context, String field) Retrieves the NumericDocValues for the field in this segmentvoidsetBottom(int slot) Set the bottom slot, ie the "weakest" (sorted last) entry in the queue.voidInforms this leaf comparator that hits threshold is reached.voidSets the Scorer to use in case a document's score is needed.protected abstract longMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.search.LeafFieldComparator
compareBottom, compareTop
-
Field Details
-
docValues
-
-
Constructor Details
-
NumericLeafComparator
- Throws:
IOException
-
-
Method Details
-
getNumericDocValues
protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field) throws IOException Retrieves the NumericDocValues for the field in this segmentIf you override this method, you should probably always disable skipping as the comparator uses values from the points index to build its competitive iterators, and assumes that the values in doc values and points are the same.
- Parameters:
context- – reader contextfield- - field name- Returns:
- numeric doc values for the field in this segment.
- Throws:
IOException- If there is a low-level I/O error
-
setBottom
Description copied from interface:LeafFieldComparatorSet the bottom slot, ie the "weakest" (sorted last) entry in the queue. WhenLeafFieldComparator.compareBottom(int)is called, you should compare against this slot. This will always be called beforeLeafFieldComparator.compareBottom(int).- Specified by:
setBottomin interfaceLeafFieldComparator- Parameters:
slot- the currently weakest (sorted last) slot in the queue- Throws:
IOException
-
copy
Description copied from interface:LeafFieldComparatorThis method is called when a new hit is competitive. You should copy any state associated with this document that will be required for future comparisons, into the specified slot.- Specified by:
copyin interfaceLeafFieldComparator- Parameters:
slot- which slot to copy the hit todoc- docID relative to current reader- Throws:
IOException
-
setScorer
Description copied from interface:LeafFieldComparatorSets the Scorer to use in case a document's score is needed.- Specified by:
setScorerin interfaceLeafFieldComparator- Parameters:
scorer- Scorer instance that you should use to obtain the current hit's score, if necessary.- Throws:
IOException
-
setHitsThresholdReached
Description copied from interface:LeafFieldComparatorInforms this leaf comparator that hits threshold is reached. This method is called from a collector when hits threshold is reached.- Specified by:
setHitsThresholdReachedin interfaceLeafFieldComparator- Throws:
IOException
-
competitiveIterator
Description copied from interface:LeafFieldComparatorReturns a competitive iterator- Specified by:
competitiveIteratorin interfaceLeafFieldComparator- Returns:
- an iterator over competitive docs that are stronger than already collected docs or
nullif such an iterator is not available for the current comparator or segment.
-
bottomAsComparableLong
protected abstract long bottomAsComparableLong() -
topAsComparableLong
protected abstract long topAsComparableLong()
-