msokolov commented on code in PR #12446:
URL: https://github.com/apache/lucene/pull/12446#discussion_r1271341275


##########
lucene/core/src/java/org/apache/lucene/search/MaxScoreBulkScorer.java:
##########
@@ -168,7 +171,17 @@ private boolean partitionScorers() {
       if (maxScoreSumFloat >= minCompetitiveScore) {
         break;
       }
+      essentialCost -= allScorers[firstEssentialScorer].cost;
     }
+
+    // See if we can further reduce the set of essential scorers while still 
being above the target
+    // cost.
+    while (firstEssentialScorer < allScorers.length - 1

Review Comment:
   Are the sub-scorers sorted in some way so that this will be stable and not 
dependent on some arbitrary insertion order?



##########
lucene/core/src/java/org/apache/lucene/search/BulkScorer.java:
##########
@@ -90,4 +90,13 @@ public abstract int score(LeafCollector collector, Bits 
acceptDocs, int min, int
 
   /** Same as {@link DocIdSetIterator#cost()} for bulk scorers. */
   public abstract long cost();
+
+  /**
+   * Optional operation: set the target cost. When set to a value that is less 
that {@link #cost()},

Review Comment:
   This is a neat idea! I am a little confused about some of the details 
though. One thing is I don't know if Scorer.cost() is always the number of 
documents the Scorer will match - or if it is even necessarily a count of 
documents? Maybe it is? Not sure if that matters here, but I wonder if we are 
now imposing a new requirement on the meaning of "cost".



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to