jainankitk commented on code in PR #14267:
URL: https://github.com/apache/lucene/pull/14267#discussion_r2021794022


##########
lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java:
##########
@@ -129,6 +141,16 @@ public final Weight createWeight(IndexSearcher searcher, 
ScoreMode scoreMode, fl
 
       private boolean matches(byte[] packedValue) {
         int offset = 0;
+
+        if (equalValues) {
+          for (int dim = 0; dim < numDims; dim++, offset += bytesPerDim) {
+            if (comparator.compare(packedValue, offset, lowerPoint, offset) != 
0) {
+              return false;
+            }
+          }
+          return true;
+        }

Review Comment:
   Given we know about `equalValues` being true/false while initializing the 
`PointRangeQuery`, I would have a separate weight object, instead of having 
this additional logic when `lowerPoint != upperPoint`. For example :
   
   ```
    @Override
     public final Weight createWeight(IndexSearcher searcher, ScoreMode 
scoreMode, float boost)
         throws IOException {
       if (this.equalValues) {
         return new ConstantScoreWeight(this, boost) {....}
       }
       // We don't use RandomAccessWeight here: it's no good to approximate 
with "match all docs".
       // This is an inverted structure and should be used in the first pass:
       return new ConstantScoreWeight(this, boost) {....}
    }
   ```



-- 
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