Skip to content

Commit

Permalink
Revert small optimization
Browse files Browse the repository at this point in the history
Signed-off-by: Harsha Vamsi Kalluri <[email protected]>
  • Loading branch information
harshavamsi committed Jul 24, 2024
1 parent 80a30b5 commit 533fd1e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,18 @@ public final ApproximateConstantScoreWeight createWeight(IndexSearcher searcher,
private final ArrayUtil.ByteArrayComparator comparator = ArrayUtil.getUnsignedComparator(pointRangeQuery.getBytesPerDim());

private boolean matches(byte[] packedValue) {
return relate(packedValue, packedValue) != PointValues.Relation.CELL_OUTSIDE_QUERY;
for (int dim = 0; dim < pointRangeQuery.getNumDims(); dim++) {
int offset = dim * pointRangeQuery.getBytesPerDim();
if (comparator.compare(packedValue, offset, pointRangeQuery.getLowerPoint(), offset) < 0) {
// Doc's value is too low, in this dimension
return false;
}
if (comparator.compare(packedValue, offset, pointRangeQuery.getUpperPoint(), offset) > 0) {
// Doc's value is too high, in this dimension
return false;
}
}
return true;
}

private PointValues.Relation relate(byte[] minPackedValue, byte[] maxPackedValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,7 @@ public void visit(QueryVisitor queryVisitor) {

@Override
public boolean equals(Object o) {
if (!sameClassAs(o)) {
return false;
}
ApproximateScoreQuery that = (ApproximateScoreQuery) o;
return originalQuery.equals(that.originalQuery) && approximationQuery.equals(that.approximationQuery);
return sameClassAs(o);
}

@Override
Expand Down

0 comments on commit 533fd1e

Please sign in to comment.