Package org.elasticsearch.search.sort
Class SortValue
java.lang.Object
org.elasticsearch.search.sort.SortValue
- All Implemented Interfaces:
Comparable<SortValue>
,NamedWriteable
,Writeable
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 TypeMethodDescriptionint
protected abstract int
Compare this sort value to another sort value of the same type.abstract boolean
abstract 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 Object
getKey()
The java object representing the sort value.abstract int
hashCode()
static List<NamedWriteableRegistry.Entry>
Get the list of NamedWriteables that this class needs.abstract 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 String
toString()
org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, DocValueFormat format)
Write the key as xcontent.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.common.io.stream.NamedWriteable
getWriteableName
-
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 interfaceComparable<SortValue>
-
toXContent
public final org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, DocValueFormat format) throws IOExceptionWrite the key as xcontent.- Throws:
IOException
-
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 IOExceptionWrite the key as xcontent using the most native type possible.- Throws:
IOException
-
compareToSameType
Compare this sort value to another sort value of the same type. -
equals
-
hashCode
public abstract int hashCode() -
toString
-
numberValue
Return this SortValue as a boxed Number orDouble.NaN
if it isn't a number. Or if it is actuallyDouble.NaN
.
-