mirror of https://github.com/apache/lucene.git
Remove unnecessary NaN checks from LongRange#verifyAndEncode (#12008)
This commit is contained in:
parent
8671e29929
commit
e34234ca6c
|
@ -157,6 +157,8 @@ Improvements
|
|||
* GITHUB#11860: Improve storage efficiency of connections in the HNSW graph that Lucene uses for
|
||||
vector search. (Ben Trent)
|
||||
|
||||
* GITHUB#12008: Clean up LongRange#verifyAndEncode logic to remove unnecessary NaN checks. (Greg Miller)
|
||||
|
||||
* GITHUB#12003: Minor cleanup/improvements to IndexSortSortedNumericDocValuesRangeQuery. (Greg Miller)
|
||||
|
||||
Bug Fixes
|
||||
|
|
|
@ -127,20 +127,12 @@ public class LongRange extends Field {
|
|||
}
|
||||
|
||||
/**
|
||||
* encode the ranges into a sortable byte array ({@code Double.NaN} not allowed)
|
||||
* encode the ranges into a sortable byte array
|
||||
*
|
||||
* <p>example for 4 dimensions (8 bytes per dimension value): minD1 ... minD4 | maxD1 ... maxD4
|
||||
*/
|
||||
static void verifyAndEncode(long[] min, long[] max, byte[] bytes) {
|
||||
for (int d = 0, i = 0, j = min.length * BYTES; d < min.length; ++d, i += BYTES, j += BYTES) {
|
||||
if (Double.isNaN(min[d])) {
|
||||
throw new IllegalArgumentException(
|
||||
"invalid min value (" + Double.NaN + ")" + " in LongRange");
|
||||
}
|
||||
if (Double.isNaN(max[d])) {
|
||||
throw new IllegalArgumentException(
|
||||
"invalid max value (" + Double.NaN + ")" + " in LongRange");
|
||||
}
|
||||
if (min[d] > max[d]) {
|
||||
throw new IllegalArgumentException(
|
||||
"min value (" + min[d] + ") is greater than max value (" + max[d] + ")");
|
||||
|
|
Loading…
Reference in New Issue