mirror of https://github.com/apache/lucene.git
Minor offset tracking tweak in PointRangeQuery #matches and #relate (#13599)
This commit is contained in:
parent
4d04cc26a9
commit
5aa1aa98ea
|
@ -128,8 +128,8 @@ public abstract class PointRangeQuery extends Query {
|
||||||
private final ByteArrayComparator comparator = ArrayUtil.getUnsignedComparator(bytesPerDim);
|
private final ByteArrayComparator comparator = ArrayUtil.getUnsignedComparator(bytesPerDim);
|
||||||
|
|
||||||
private boolean matches(byte[] packedValue) {
|
private boolean matches(byte[] packedValue) {
|
||||||
for (int dim = 0; dim < numDims; dim++) {
|
int offset = 0;
|
||||||
int offset = dim * bytesPerDim;
|
for (int dim = 0; dim < numDims; dim++, offset += bytesPerDim) {
|
||||||
if (comparator.compare(packedValue, offset, lowerPoint, offset) < 0) {
|
if (comparator.compare(packedValue, offset, lowerPoint, offset) < 0) {
|
||||||
// Doc's value is too low, in this dimension
|
// Doc's value is too low, in this dimension
|
||||||
return false;
|
return false;
|
||||||
|
@ -145,9 +145,9 @@ public abstract class PointRangeQuery extends Query {
|
||||||
private Relation relate(byte[] minPackedValue, byte[] maxPackedValue) {
|
private Relation relate(byte[] minPackedValue, byte[] maxPackedValue) {
|
||||||
|
|
||||||
boolean crosses = false;
|
boolean crosses = false;
|
||||||
|
int offset = 0;
|
||||||
|
|
||||||
for (int dim = 0; dim < numDims; dim++) {
|
for (int dim = 0; dim < numDims; dim++, offset += bytesPerDim) {
|
||||||
int offset = dim * bytesPerDim;
|
|
||||||
|
|
||||||
if (comparator.compare(minPackedValue, offset, upperPoint, offset) > 0
|
if (comparator.compare(minPackedValue, offset, upperPoint, offset) > 0
|
||||||
|| comparator.compare(maxPackedValue, offset, lowerPoint, offset) < 0) {
|
|| comparator.compare(maxPackedValue, offset, lowerPoint, offset) < 0) {
|
||||||
|
|
Loading…
Reference in New Issue