Class SortValue

java.lang.Object
org.elasticsearch.search.sort.SortValue
All Implemented Interfaces:
Comparable<SortValue>, NamedWriteable, Writeable

public abstract class SortValue extends Object implements NamedWriteable, Comparable<SortValue>
A Comparable, DocValueFormat aware wrapper around a sort value.
  • Method Details

    • from

      public static SortValue from(double d)
      Get a SortValue for a double.
    • from

      public static SortValue from(long l)
      Get a SortValue for a long.
    • from

      public static SortValue from(org.apache.lucene.util.BytesRef bytes)
      Get a SortValue for bytes. Callers should be sure that they have a BytesRef.deepCopyOf(org.apache.lucene.util.BytesRef) of any mutable references.
    • namedWriteables

      public static List<NamedWriteableRegistry.Entry> namedWriteables()
      Get the list of NamedWriteables that this class needs.
    • compareTo

      public final int compareTo(SortValue other)
      Specified by:
      compareTo in interface Comparable<SortValue>
    • toXContent

      public final org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, DocValueFormat format) throws IOException
      Write the key as xcontent.
      Throws:
      IOException
    • getKey

      public abstract Object getKey()
      The java object representing the sort value.
    • format

      public abstract String format(DocValueFormat format)
      Format this value using the provided format.
    • rawToXContent

      protected abstract org.elasticsearch.xcontent.XContentBuilder rawToXContent(org.elasticsearch.xcontent.XContentBuilder builder) throws IOException
      Write the key as xcontent using the most native type possible.
      Throws:
      IOException
    • compareToSameType

      protected abstract int compareToSameType(SortValue obj)
      Compare this sort value to another sort value of the same type.
    • equals

      public abstract boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public abstract int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public abstract String toString()
      Overrides:
      toString in class Object
    • numberValue

      public abstract Number numberValue()
      Return this SortValue as a boxed Number or Double.NaN if it isn't a number. Or if it is actually Double.NaN.