sgup432 commented on code in PR #12383:
URL: https://github.com/apache/lucene/pull/12383#discussion_r1245969984


##########
lucene/core/src/java/org/apache/lucene/search/TermQuery.java:
##########
@@ -72,7 +72,16 @@ public TermWeight(
       if (termStats == null) {
         this.simScorer = null; // term doesn't exist in any segment, we won't 
use similarity at all
       } else {
-        this.simScorer = similarity.scorer(boost, collectionStats, termStats);
+        if (scoreMode.needsScores()) {

Review Comment:
   Added.



##########
lucene/core/src/java/org/apache/lucene/search/TermQuery.java:
##########
@@ -72,7 +72,16 @@ public TermWeight(
       if (termStats == null) {
         this.simScorer = null; // term doesn't exist in any segment, we won't 
use similarity at all
       } else {
-        this.simScorer = similarity.scorer(boost, collectionStats, termStats);
+        if (scoreMode.needsScores()) {
+          this.simScorer = similarity.scorer(boost, collectionStats, 
termStats);
+        } else {
+          this.simScorer = new Similarity.SimScorer() {
+            @Override
+            public float score(float freq, long norm) {
+              return 0f;

Review Comment:
   Added a comment.



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