Class NumericComparator.NumericLeafComparator

    • Field Detail

      • enableSkipping

        private final boolean enableSkipping
      • maxDoc

        private final int maxDoc
      • minValueAsBytes

        private final byte[] minValueAsBytes
      • maxValueAsBytes

        private final byte[] maxValueAsBytes
      • iteratorCost

        private long iteratorCost
      • maxDocVisited

        private int maxDocVisited
      • updateCounter

        private int updateCounter
      • currentSkipInterval

        private int currentSkipInterval
      • tryUpdateFailCount

        private int tryUpdateFailCount
    • 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

        If 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 context
        field - - field name
        Returns:
        numeric doc values for the field in this segment.
        Throws:
        java.io.IOException - If there is a low-level I/O error
      • copy

        public void copy​(int slot,
                         int doc)
                  throws java.io.IOException
        Description copied from interface: LeafFieldComparator
        This 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:
        copy in interface LeafFieldComparator
        Parameters:
        slot - which slot to copy the hit to
        doc - docID relative to current reader
        Throws:
        java.io.IOException
      • setScorer

        public void setScorer​(Scorable scorer)
                       throws java.io.IOException
        Description copied from interface: LeafFieldComparator
        Sets the Scorer to use in case a document's score is needed.
        Specified by:
        setScorer in interface LeafFieldComparator
        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.IOException
        Description copied from interface: LeafFieldComparator
        Informs this leaf comparator that hits threshold is reached. This method is called from a collector when hits threshold is reached.
        Specified by:
        setHitsThresholdReached in interface LeafFieldComparator
        Throws:
        java.io.IOException
      • updateCompetitiveIterator

        private void updateCompetitiveIterator()
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • updateSkipInterval

        private void updateSkipInterval​(boolean success)
      • competitiveIterator

        public DocIdSetIterator competitiveIterator()
        Description copied from interface: LeafFieldComparator
        Returns a competitive iterator
        Specified by:
        competitiveIterator in interface LeafFieldComparator
        Returns:
        an iterator over competitive docs that are stronger than already collected docs or null if 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)