Class TermOrdValComparator

    • Field Detail

      • ords

        final int[] ords
      • readerGen

        final int[] readerGen
      • currentReaderGen

        int currentReaderGen
      • field

        private final java.lang.String field
      • reverse

        private final boolean reverse
      • sortMissingLast

        private final boolean sortMissingLast
      • bottomSlot

        int bottomSlot
      • topValue

        BytesRef topValue
        Set by setTopValue.
      • missingSortCmp

        final int missingSortCmp
        -1 if missing values are sorted first, 1 if they are sorted last
      • singleSort

        private boolean singleSort
        Whether this is the only comparator.
      • canSkipDocuments

        private boolean canSkipDocuments
        Whether this comparator is allowed to skip documents.
      • hitsThresholdReached

        private boolean hitsThresholdReached
        Whether the collector is done with counting hits so that we can start skipping documents.
    • Constructor Detail

      • TermOrdValComparator

        public TermOrdValComparator​(int numHits,
                                    java.lang.String field,
                                    boolean sortMissingLast,
                                    boolean reverse,
                                    Pruning pruning)
        Creates this, with control over how missing values are sorted. Pass sortMissingLast=true to put missing values at the end.
    • Method Detail

      • disableSkipping

        public void disableSkipping()
        Description copied from class: FieldComparator
        Informs the comparator that the skipping of documents should be disabled. This function is called by TopFieldCollector in cases when the skipping functionality should not be applied or not necessary. An example could be when search sort is a part of the index sort, and can be already efficiently handled by TopFieldCollector, and doing extra work for skipping in the comparator is redundant.
        Overrides:
        disableSkipping in class FieldComparator<BytesRef>
      • setSingleSort

        public void setSingleSort()
        Description copied from class: FieldComparator
        Informs the comparator that sort is done on this single field. This is useful to enable some optimizations for skipping non-competitive documents.
        Overrides:
        setSingleSort in class FieldComparator<BytesRef>
      • compare

        public int compare​(int slot1,
                           int slot2)
        Description copied from class: FieldComparator
        Compare hit at slot1 with hit at slot2.
        Specified by:
        compare in class FieldComparator<BytesRef>
        Parameters:
        slot1 - first slot to compare
        slot2 - second slot to compare
        Returns:
        any N < 0 if slot2's value is sorted after slot1, any N > 0 if the slot2's value is sorted before slot1 and 0 if they are equal
      • getSortedDocValues

        protected SortedDocValues getSortedDocValues​(LeafReaderContext context,
                                                     java.lang.String field)
                                              throws java.io.IOException
        Retrieves the SortedDocValues for the field in this segment
        Throws:
        java.io.IOException
      • compareValues

        public int compareValues​(BytesRef val1,
                                 BytesRef val2)
        Description copied from class: FieldComparator
        Returns a negative integer if first is less than second, 0 if they are equal and a positive integer otherwise. Default impl to assume the type implements Comparable and invoke .compareTo; be sure to override this method if your FieldComparator's type isn't a Comparable or if your values may sometimes be null
        Overrides:
        compareValues in class FieldComparator<BytesRef>