MarcusSorealheis commented on code in PR #12245: URL: https://github.com/apache/lucene/pull/12245#discussion_r1186252316
########## lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java: ########## @@ -420,45 +420,10 @@ public Explanation explain(LeafReaderContext context, Weight childWeight, ScoreM } } } - - if (bestChild == null) { - switch (scoreMode) { - case None: - return Explanation.match( - this.score(), formatScoreExplanation(0, start, end, scoreMode), bestChild); - default: - return Explanation.match( - this.score(), formatScoreExplanation(0, start, end, scoreMode)); - } - } - - switch (scoreMode) { - case Avg: - return Explanation.match( - this.score(), formatScoreExplanation(matches, start, end, scoreMode), bestChild); - case Total: - if (matches > 0) { - return Explanation.match( - this.score(), formatScoreExplanation(matches, start, end, scoreMode), bestChild); - } - break; - case Max: - if (matches > 0) { - return Explanation.match( - this.score(), formatScoreExplanation(matches, start, end, scoreMode), bestChild); - } - break; - case Min: - if (matches > 0) { - return Explanation.match( - this.score(), formatScoreExplanation(matches, start, end, scoreMode), worstChild); - } - break; - default: - return Explanation.noMatch("Unexpected score mode: " + scoreMode); - } - - return Explanation.noMatch("No matches found"); + assert matches>0 : "No matches should be handled before."; Review Comment: Amazing. Very simple! We should probably add a few spaces, `assert matches > 0`. Otherwise, perfect. -- 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