sgup432 commented on code in PR #12383: URL: https://github.com/apache/lucene/pull/12383#discussion_r1244104004
########## 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: Yeah calling existing IndexSearcher's similarity here could result in infinite recursion. So either would have to store existing similarity at the start or just use default one here. The latter one seems okay to me. -- 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