jpountz commented on code in PR #12383: URL: https://github.com/apache/lucene/pull/12383#discussion_r1244710448
########## 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: I don't have a strong opinion, in that case maybe just leave a comment saying that this mtehod is not expected to be called since scores are not needed, to help readers understand that it's not about making this query produce null scores. -- 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