Class XNumericComparator<T extends Number>

java.lang.Object
org.apache.lucene.search.FieldComparator<T>
org.elasticsearch.lucene.comparators.XNumericComparator<T>
Direct Known Subclasses:
XLongComparator

public abstract class XNumericComparator<T extends Number> extends org.apache.lucene.search.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
    • pruning

      protected org.apache.lucene.search.Pruning pruning
  • Constructor Details

    • XNumericComparator

      protected XNumericComparator(String field, T missingValue, boolean reverse, org.apache.lucene.search.Pruning pruning, int bytesCount)
  • Method Details

    • setTopValue

      public void setTopValue(T value)
      Specified by:
      setTopValue in class org.apache.lucene.search.FieldComparator<T extends Number>
    • setSingleSort

      public void setSingleSort()
      Overrides:
      setSingleSort in class org.apache.lucene.search.FieldComparator<T extends Number>
    • disableSkipping

      public void disableSkipping()
      Overrides:
      disableSkipping in class org.apache.lucene.search.FieldComparator<T extends Number>
    • missingValueAsComparableLong

      protected abstract long missingValueAsComparableLong()
    • sortableBytesToLong

      protected abstract long sortableBytesToLong(byte[] bytes)
      Decode sortable bytes to long. It should be consistent with the codec that PointValues of this field is using.