Class BytesRefComparator

  • All Implemented Interfaces:

    public abstract class BytesRefComparator
    extends Object
    implements Comparator<BytesRef>
    Specialized BytesRef comparator that StringSorter has optimizations for.
    NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
    • Field Detail

      • NATURAL

        public static final BytesRefComparator NATURAL
        Comparing ByteRefs in natual order.
    • Constructor Detail

      • BytesRefComparator

        protected BytesRefComparator​(int comparedBytesCount)
        Sole constructor.
        comparedBytesCount - the maximum number of bytes to compare.
    • Method Detail

      • byteAt

        protected abstract int byteAt​(BytesRef ref,
                                      int i)
        Return the unsigned byte to use for comparison at index i, or -1 if all bytes that are useful for comparisons are exhausted. This may only be called with a value of i between 0 included and comparedBytesCount excluded.
      • compare

        public int compare​(BytesRef o1,
                           BytesRef o2,
                           int k)
        Compare two bytes refs that first k bytes are already guaranteed to be equal.