Minor offset tracking tweak in PointRangeQuery #matches and #relate (#13599)

This commit is contained in:
Ankit Jain 2024-08-10 02:20:47 +05:30 committed by GitHub
parent 4d04cc26a9
commit 5aa1aa98ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -128,8 +128,8 @@ public abstract class PointRangeQuery extends Query {
private final ByteArrayComparator comparator = ArrayUtil.getUnsignedComparator(bytesPerDim);
private boolean matches(byte[] packedValue) {
for (int dim = 0; dim < numDims; dim++) {
int offset = dim * bytesPerDim;
int offset = 0;
for (int dim = 0; dim < numDims; dim++, offset += bytesPerDim) {
if (comparator.compare(packedValue, offset, lowerPoint, offset) < 0) {
// Doc's value is too low, in this dimension
return false;
@ -145,9 +145,9 @@ public abstract class PointRangeQuery extends Query {
private Relation relate(byte[] minPackedValue, byte[] maxPackedValue) {
boolean crosses = false;
int offset = 0;
for (int dim = 0; dim < numDims; dim++) {
int offset = dim * bytesPerDim;
for (int dim = 0; dim < numDims; dim++, offset += bytesPerDim) {
if (comparator.compare(minPackedValue, offset, upperPoint, offset) > 0
|| comparator.compare(maxPackedValue, offset, lowerPoint, offset) < 0) {