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 java.lang.Number>
public abstract class NumericComparator.NumericLeafComparator extends java.lang.Object implements LeafFieldComparator
Leaf comparator forNumericComparatorthat provides skipping functionality
-
-
Field Summary
Fields Modifier and Type Field Description private DocIdSetIteratorcompetitiveIteratorprotected NumericDocValuesdocValuesprivate booleanenableSkippingprivate longiteratorCostprivate intmaxDocprivate intmaxDocVisitedprivate byte[]maxValueAsBytesprivate byte[]minValueAsBytesprivate PointValuespointValuesprivate intupdateCounter
-
Constructor Summary
Constructors Constructor Description NumericLeafComparator(LeafReaderContext context)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description DocIdSetIteratorcompetitiveIterator()Returns a competitive iteratorvoidcopy(int slot, int doc)This method is called when a new hit is competitive.protected abstract voidencodeBottom(byte[] packedValue)protected abstract voidencodeTop(byte[] packedValue)protected NumericDocValuesgetNumericDocValues(LeafReaderContext context, java.lang.String field)Retrieves the NumericDocValues for the field in this segmentprotected abstract booleanisMissingValueCompetitive()voidsetBottom(int slot)Set the bottom slot, ie the "weakest" (sorted last) entry in the queue.voidsetHitsThresholdReached()Informs this leaf comparator that hits threshold is reached.voidsetScorer(Scorable scorer)Sets the Scorer to use in case a document's score is needed.private voidupdateCompetitiveIterator()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.lucene.search.LeafFieldComparator
compareBottom, compareTop
-
-
-
-
Field Detail
-
docValues
protected final NumericDocValues docValues
-
pointValues
private final PointValues pointValues
-
enableSkipping
private final boolean enableSkipping
-
maxDoc
private final int maxDoc
-
minValueAsBytes
private final byte[] minValueAsBytes
-
maxValueAsBytes
private final byte[] maxValueAsBytes
-
competitiveIterator
private DocIdSetIterator competitiveIterator
-
iteratorCost
private long iteratorCost
-
maxDocVisited
private int maxDocVisited
-
updateCounter
private int updateCounter
-
-
Constructor Detail
-
NumericLeafComparator
public NumericLeafComparator(LeafReaderContext context) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getNumericDocValues
protected NumericDocValues getNumericDocValues(LeafReaderContext context, java.lang.String field) throws java.io.IOException
Retrieves the NumericDocValues for the field in this segment- Throws:
java.io.IOException
-
setBottom
public void setBottom(int slot) throws java.io.IOExceptionDescription 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:
java.io.IOException
-
copy
public void copy(int slot, int doc) throws java.io.IOExceptionDescription 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:
java.io.IOException
-
setScorer
public void setScorer(Scorable scorer) throws java.io.IOException
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:
java.io.IOException
-
setHitsThresholdReached
public void setHitsThresholdReached() throws java.io.IOExceptionDescription 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:
java.io.IOException
-
updateCompetitiveIterator
private void updateCompetitiveIterator() throws java.io.IOException- Throws:
java.io.IOException
-
competitiveIterator
public DocIdSetIterator 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.
-
isMissingValueCompetitive
protected abstract boolean isMissingValueCompetitive()
-
encodeBottom
protected abstract void encodeBottom(byte[] packedValue)
-
encodeTop
protected abstract void encodeTop(byte[] packedValue)
-
-