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 ClassesNested classes/interfaces inherited from class org.elasticsearch.search.sort.BucketedSort
BucketedSort.ExtraData, BucketedSort.ForDoubles, BucketedSort.ForFloats, BucketedSort.ForLongs, BucketedSort.ResultBuilder<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intThe maximum size of buckets this can store.Fields inherited from class org.elasticsearch.search.sort.BucketedSort
bigArrays, extra, NOOP_EXTRA_DATA -
Constructor Summary
ConstructorsConstructorDescriptionForFloats(BigArrays bigArrays, SortOrder sortOrder, DocValueFormat format, int bucketSize, BucketedSort.ExtraData extra) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbetterThan(long lhs, long rhs)trueif the entry at indexlhsis "better" than the entry atrhs.protected intgetNextGatherOffset(long rootIndex)Get the next index that should be "gathered" for a bucket rooted atrootIndex.protected SortValuegetValue(long index)Get the value at an index.protected voidgrowValues(long minSize)Grow the BigArray backing this sort to account for new buckets.protected voidsetNextGatherOffset(long rootIndex, int offset)Set the next index that should be "gathered" for a bucket rooted atrootIndex.protected voidswap(long lhs, long rhs)Swap the data at two indices.protected BigArrayvalues()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 have23bits 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:BucketedSortThe BigArray backing this sort.- Specified by:
valuesin classBucketedSort
-
growValues
protected final void growValues(long minSize)Description copied from class:BucketedSortGrow the BigArray backing this sort to account for new buckets. This will only be called if the array is too small.- Specified by:
growValuesin classBucketedSort
-
getNextGatherOffset
protected final int getNextGatherOffset(long rootIndex)Description copied from class:BucketedSortGet the next index that should be "gathered" for a bucket rooted atrootIndex.- Specified by:
getNextGatherOffsetin classBucketedSort
-
setNextGatherOffset
protected final void setNextGatherOffset(long rootIndex, int offset)Description copied from class:BucketedSortSet the next index that should be "gathered" for a bucket rooted atrootIndex.- Specified by:
setNextGatherOffsetin classBucketedSort
-
getValue
Description copied from class:BucketedSortGet the value at an index.- Specified by:
getValuein classBucketedSort
-
betterThan
protected final boolean betterThan(long lhs, long rhs)Description copied from class:BucketedSorttrueif the entry at indexlhsis "better" than the entry atrhs. "Better" in this means "lower" forSortOrder.ASCand "higher" forSortOrder.DESC.- Specified by:
betterThanin classBucketedSort
-
swap
protected final void swap(long lhs, long rhs)Description copied from class:BucketedSortSwap the data at two indices.- Specified by:
swapin classBucketedSort
-