Package org.elasticsearch.search.sort
Class BucketedSort.ForLongs
java.lang.Object
org.elasticsearch.search.sort.BucketedSort
org.elasticsearch.search.sort.BucketedSort.ForLongs
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.elasticsearch.core.Releasable
- Enclosing class:
- BucketedSort
Superclass for implementations of BucketedSort for
long
keys.-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.search.sort.BucketedSort
BucketedSort.ExtraData, BucketedSort.ForDoubles, BucketedSort.ForFloats, BucketedSort.ForLongs, BucketedSort.ResultBuilder<T>
-
Field Summary
Fields inherited from class org.elasticsearch.search.sort.BucketedSort
bigArrays, extra, NOOP_EXTRA_DATA
-
Constructor Summary
ConstructorDescriptionForLongs(BigArrays bigArrays, SortOrder sortOrder, DocValueFormat format, int bucketSize, BucketedSort.ExtraData extra)
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
betterThan(long lhs, long rhs)
true
if the entry at indexlhs
is "better" than the entry atrhs
.protected int
getNextGatherOffset(long rootIndex)
Get the next index that should be "gathered" for a bucket rooted atrootIndex
.protected SortValue
getValue(long index)
Get the value at an index.protected void
growValues(long minSize)
Grow the BigArray backing this sort to account for new buckets.boolean
Does this sort need scores? Most don't, but sorting on_score
does.protected void
setNextGatherOffset(long rootIndex, int offset)
Set the next index that should be "gathered" for a bucket rooted atrootIndex
.protected void
swap(long lhs, long rhs)
Swap the data at two indices.protected BigArray
values()
The BigArray backing this sort.Methods inherited from class org.elasticsearch.search.sort.BucketedSort
close, debugFormat, forLeaf, getBucketSize, getFormat, getOrder, getValues, getValues, inHeapMode, initGatherOffsets
-
Constructor Details
-
ForLongs
public ForLongs(BigArrays bigArrays, SortOrder sortOrder, DocValueFormat format, int bucketSize, BucketedSort.ExtraData extra)
-
-
Method Details
-
needsScores
public final boolean needsScores()Description copied from class:BucketedSort
Does this sort need scores? Most don't, but sorting on_score
does.- Specified by:
needsScores
in classBucketedSort
-
values
Description copied from class:BucketedSort
The BigArray backing this sort.- Specified by:
values
in classBucketedSort
-
growValues
protected final void growValues(long minSize)Description copied from class:BucketedSort
Grow the BigArray backing this sort to account for new buckets. This will only be called if the array is too small.- Specified by:
growValues
in classBucketedSort
-
getNextGatherOffset
protected final int getNextGatherOffset(long rootIndex)Description copied from class:BucketedSort
Get the next index that should be "gathered" for a bucket rooted atrootIndex
.- Specified by:
getNextGatherOffset
in classBucketedSort
-
setNextGatherOffset
protected final void setNextGatherOffset(long rootIndex, int offset)Description copied from class:BucketedSort
Set the next index that should be "gathered" for a bucket rooted atrootIndex
.- Specified by:
setNextGatherOffset
in classBucketedSort
-
getValue
Description copied from class:BucketedSort
Get the value at an index.- Specified by:
getValue
in classBucketedSort
-
betterThan
protected final boolean betterThan(long lhs, long rhs)Description copied from class:BucketedSort
true
if the entry at indexlhs
is "better" than the entry atrhs
. "Better" in this means "lower" forSortOrder.ASC
and "higher" forSortOrder.DESC
.- Specified by:
betterThan
in classBucketedSort
-
swap
protected final void swap(long lhs, long rhs)Description copied from class:BucketedSort
Swap the data at two indices.- Specified by:
swap
in classBucketedSort
-