Package org.elasticsearch.search.sort
Class SortValue
java.lang.Object
org.elasticsearch.search.sort.SortValue
- All Implemented Interfaces:
java.lang.Comparable<SortValue>
,NamedWriteable
,Writeable
public abstract class SortValue extends java.lang.Object implements NamedWriteable, java.lang.Comparable<SortValue>
A
Comparable
, DocValueFormat
aware wrapper around a sort value.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Method Summary
Modifier and Type Method Description int
compareTo(SortValue other)
protected abstract int
compareToSameType(SortValue obj)
Compare this sort value to another sort value of the same type.abstract boolean
equals(java.lang.Object obj)
abstract java.lang.String
format(DocValueFormat format)
Format this value using the provided format.static SortValue
from(double d)
Get a SortValue for a double.static SortValue
from(long l)
Get a SortValue for a long.static SortValue
from(org.apache.lucene.util.BytesRef bytes)
Get a SortValue for bytes.abstract java.lang.Object
getKey()
The java object representing the sort value.abstract int
hashCode()
static java.util.List<NamedWriteableRegistry.Entry>
namedWriteables()
Get the list of NamedWriteables that this class needs.abstract java.lang.Number
numberValue()
Return this SortValue as a boxed Number.protected abstract org.elasticsearch.common.xcontent.XContentBuilder
rawToXContent(org.elasticsearch.common.xcontent.XContentBuilder builder)
Write the key as xcontent using the most native type possible.abstract java.lang.String
toString()
org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, DocValueFormat format)
Write the key as xcontent.
-
Method Details
-
from
Get a SortValue for a double. -
from
Get a SortValue for a long. -
from
Get a SortValue for bytes. Callers should be sure that they have aBytesRef.deepCopyOf(org.apache.lucene.util.BytesRef)
of any mutable references. -
namedWriteables
Get the list of NamedWriteables that this class needs. -
compareTo
- Specified by:
compareTo
in interfacejava.lang.Comparable<SortValue>
-
toXContent
public final org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, DocValueFormat format) throws java.io.IOExceptionWrite the key as xcontent.- Throws:
java.io.IOException
-
getKey
public abstract java.lang.Object getKey()The java object representing the sort value. -
format
Format this value using the provided format. -
rawToXContent
protected abstract org.elasticsearch.common.xcontent.XContentBuilder rawToXContent(org.elasticsearch.common.xcontent.XContentBuilder builder) throws java.io.IOExceptionWrite the key as xcontent using the most native type possible.- Throws:
java.io.IOException
-
compareToSameType
Compare this sort value to another sort value of the same type. -
equals
public abstract boolean equals(java.lang.Object obj)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public abstract int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
toString
public abstract java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
numberValue
public abstract java.lang.Number numberValue()Return this SortValue as a boxed Number.
-