msfroh commented on code in PR #12383: URL: https://github.com/apache/lucene/pull/12383#discussion_r1240365451
########## lucene/queries/src/test/org/apache/lucene/queries/function/TestFunctionScoreQuery.java: ########## @@ -322,6 +329,19 @@ private void assertInnerScoreMode( ScoreMode expectedScoreMode, ScoreMode inputScoreMode, DoubleValuesSource valueSource) throws IOException { final AtomicReference<ScoreMode> scoreModeInWeight = new AtomicReference<ScoreMode>(); + final AtomicBoolean scorerCalled = new AtomicBoolean(); + searcher.setSimilarity(new Similarity() { // Wrapping existing similarity for testing + @Override + public long computeNorm(FieldInvertState state) { + return getDefaultSimilarity().computeNorm(state); + } + + @Override + public SimScorer scorer(float boost, CollectionStatistics collectionStats, TermStatistics... termStats) { + scorerCalled.set(true); + return getDefaultSimilarity().scorer(boost, collectionStats, termStats); + } + }); Review Comment: Instead of explicitly using `getDefaultSimilarity()` here, maybe you should get the `IndexSearcher`'s existing `Similarity`? Of course, it looks like this method gets called multiple times, so you could end up wrapping the `Similarity` again and again. -- 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