Package org.elasticsearch.search.sort
Class BucketedSort.ForFloats
java.lang.Object
org.elasticsearch.search.sort.BucketedSort
org.elasticsearch.search.sort.BucketedSort.ForFloats
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.elasticsearch.core.Releasable
- Enclosing class:
- BucketedSort
Superclass for implementations of BucketedSort for
float
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
Modifier and TypeFieldDescriptionstatic int
The maximum size of buckets this can store.Fields inherited from class org.elasticsearch.search.sort.BucketedSort
bigArrays, extra, NOOP_EXTRA_DATA
-
Constructor Summary
ConstructorDescriptionForFloats(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.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, needsScores
-
Field Details
-
MAX_BUCKET_SIZE
public static final int MAX_BUCKET_SIZEThe maximum size of buckets this can store. This is because we store the next offset to write to in a float and floats only have23
bits of mantissa so they can't accurate store values higher than2 ^ 24
.
-
-
Constructor Details
-
ForFloats
public ForFloats(BigArrays bigArrays, SortOrder sortOrder, DocValueFormat format, int bucketSize, BucketedSort.ExtraData extra)
-
-
Method Details
-
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
-