sgup432 commented on code in PR #12383: URL: https://github.com/apache/lucene/pull/12383#discussion_r1244286188
########## 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 checked AssertingScorer logic, seems like it only has some assertion logic which might not get executed during actual application run. Plus this issue wouldn't have surfaced if assertingScorer had that logic, as in that case score wouldn't have been called when needScore was false? So looks we might have to keep it like this. -- 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