jainankitk commented on code in PR #14267: URL: https://github.com/apache/lucene/pull/14267#discussion_r2023189174
########## lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java: ########## @@ -120,381 +132,447 @@ public void visit(QueryVisitor visitor) { public final Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException { + if (this.equalValues) { // lowerPoint==upperPoint + return new SinglePointConstantScoreWeight(this, scoreMode, 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 MultiPointsConstantScoreWeight(this, scoreMode, boost); + } - return new ConstantScoreWeight(this, boost) { + /** + * Essentially, it is to reduce the number of comparisons. This is an optimization, used for the + * case of lowerPoint==upperPoint. + */ + protected class SinglePointConstantScoreWeight extends MultiPointsConstantScoreWeight { Review Comment: I am assuming we are reusing some of the methods from `MultiPointsConstantScoreWeight`. That's why we are extending from that class. May, I suggest creating class say `PointRangeQueryWeight` that extends from `ConstantScoreWeight`? And, both `SinglePointRangeQueryWeight` and `MultiPointRangeQueryWeight` extend from `PointRangeQueryWeight`? -- 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