zacharymorn commented on a change in pull request #2141:
URL: https://github.com/apache/lucene-solr/pull/2141#discussion_r552385764



##########
File path: 
lucene/core/src/java/org/apache/lucene/search/Boolean2ScorerSupplier.java
##########
@@ -74,11 +74,13 @@ private long computeCost() {
       return minRequiredCost.getAsLong();
     } else {
       final Collection<ScorerSupplier> optionalScorers = 
subs.get(Occur.SHOULD);
-      final long shouldCost =
-          MinShouldMatchSumScorer.cost(
-              optionalScorers.stream().mapToLong(ScorerSupplier::cost),
-              optionalScorers.size(),
-              minShouldMatch);
+      // nocommit The cost calculation here copies that in WANDScorer's 
constructor, and may need to be adjusted?
+      final long shouldCost = scoreMode == ScoreMode.TOP_SCORES ?
+                              
optionalScorers.stream().mapToLong(ScorerSupplier::cost).sum() :
+                              MinShouldMatchSumScorer.cost(
+                                      
optionalScorers.stream().mapToLong(ScorerSupplier::cost),
+                                      optionalScorers.size(),
+                                      minShouldMatch);

Review comment:
       I see. Previously I wasn't entirely sure about the handling here. I've 
reverted the related changes and updated `WANDScorer` to share the same cost 
function with that of `minShouldMatchSumScorer`.




----------------------------------------------------------------
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.

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

Reply via email to