Class NumericComparator<T extends Number>

Direct Known Subclasses:
DoubleComparator, FloatComparator, IntComparator, LongComparator

public abstract class NumericComparator<T extends Number> extends FieldComparator<T>
Abstract numeric comparator for comparing numeric values. This comparator provides a skipping functionality – an iterator that can skip over non-competitive documents.

Parameter field provided in the constructor is used as a field name in the default implementations of the methods getNumericDocValues and getPointValues to retrieve doc values and points. You can pass a dummy value for a field name (e.g. when sorting by script), but in this case you must override both of these methods.

  • Field Details

    • missingValue

      protected final T extends Number missingValue
    • field

      protected final String field
    • reverse

      protected final boolean reverse
    • topValueSet

      protected boolean topValueSet
    • singleSort

      protected boolean singleSort
    • hitsThresholdReached

      protected boolean hitsThresholdReached
    • queueFull

      protected boolean queueFull
  • Constructor Details

    • NumericComparator

      protected NumericComparator(String field, T missingValue, boolean reverse, boolean enableSkipping, int bytesCount)
  • Method Details

    • setTopValue

      public void setTopValue(T value)
      Description copied from class: FieldComparator
      Record the top value, for future calls to LeafFieldComparator.compareTop(int). This is only called for searches that use searchAfter (deep paging), and is called before any calls to FieldComparator.getLeafComparator(LeafReaderContext).
      Specified by:
      setTopValue in class FieldComparator<T extends Number>
    • 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.
      setSingleSort in class FieldComparator<T extends Number>
    • 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.
      disableSkipping in class FieldComparator<T extends Number>