jpountz commented on code in PR #14970:
URL: https://github.com/apache/lucene/pull/14970#discussion_r2219663347


##########
lucene/core/src/java/org/apache/lucene/search/MaxScoreBulkScorer.java:
##########
@@ -381,9 +423,20 @@ private void scoreNonEssentialClauses(
       scorer.doc = scorer.iterator.docID();
     }
 
-    for (int i = 0; i < buffer.size; ++i) {
-      scorable.score = (float) buffer.scores[i];
-      collector.collect(buffer.docs[i]);
+    // The collector already filters hits whose score is less than the min 
competitive score, but
+    // doing it here is a bit more efficient.
+    int[] docs = buffer.docs;
+    docAndScoreBuffer.growNoCopy(buffer.size);
+    float[] scores = docAndScoreBuffer.features;
+    int size = buffer.size;

Review Comment:
   I don't think it does. I wanted to avoid copying doc IDs from 
`docAndScoreAccBuffer` to `docAndScoreBuffer`, so I directly took doc IDs from 
`docAndScoreAccBuffer` and only copied scores into the `float[]` of 
`docAndScoreBuffer`. Since it's using arrays from different `Buffer` objects, I 
found extracting variables clearer.



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

Reply via email to