vigyasharma commented on code in PR #13599:
URL: https://github.com/apache/lucene/pull/13599#discussion_r1693377964


##########
lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java:
##########
@@ -127,22 +127,8 @@ public final Weight createWeight(IndexSearcher searcher, 
ScoreMode scoreMode, fl
 
       private final ByteArrayComparator comparator = 
ArrayUtil.getUnsignedComparator(bytesPerDim);
 
-      private boolean matches(byte[] packedValue) {
-        for (int dim = 0; dim < numDims; dim++) {
-          int offset = dim * bytesPerDim;
-          if (comparator.compare(packedValue, offset, lowerPoint, offset) < 0) 
{
-            // Doc's value is too low, in this dimension
-            return false;
-          }
-          if (comparator.compare(packedValue, offset, upperPoint, offset) > 0) 
{
-            // Doc's value is too high, in this dimension
-            return false;
-          }
-        }
-        return true;
-      }
-
-      private Relation relate(byte[] minPackedValue, byte[] maxPackedValue) {
+      private Relation relateHelper(
+          byte[] minPackedValue, byte[] maxPackedValue, boolean 
needCrossOrInside) {

Review Comment:
   I don't see the point of this indirection with `boolean needCrossOrInside`. 
It makes the code less readable and doesn't seem to remove a whole lot of 
redundant code.. I'd rather we just add a comment that explains the extra check 
we do in `relate()`.
   
   I'm not deeply familiar with this part of Lucene, but it seems like the 
checks here can have some non-obvious overheads? What would be a good benchmark 
to surface them? Is it possible to extend an existing benchmark?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to