gf2121 commented on code in PR #14312:
URL: https://github.com/apache/lucene/pull/14312#discussion_r1986764581


##########
lucene/core/src/java/org/apache/lucene/search/DenseConjunctionBulkScorer.java:
##########
@@ -117,6 +107,65 @@ private static int advance(FixedBitSet set, int i) {
     }
   }
 
+  private int scoreWindow(
+      LeafCollector collector, Bits acceptDocs, List<DocIdSetIterator> 
iterators, int min, int max)
+      throws IOException {
+
+    // Advance all iterators to the first doc that is greater than or equal to 
min. This is
+    // important as this is the only place where we can take advantage of a 
large gap between
+    // consecutive matches in any clause.
+    for (DocIdSetIterator iterator : iterators) {
+      if (iterator.docID() >= min) {
+        min = iterator.docID();
+      } else {
+        min = iterator.advance(min);
+      }
+    }
+    if (min >= max) {
+      return min;
+    }
+
+    int bitsetWindowMax = (int) Math.min(max, (long) min + WINDOW_SIZE);
+
+    if (acceptDocs == null) {
+      int minDocIDRunEnd = max;
+      for (DocIdSetIterator iterator : iterators) {
+        if (iterator.docID() > min) {
+          minDocIDRunEnd = min;
+          break;
+        } else {
+          minDocIDRunEnd = Math.min(minDocIDRunEnd, iterator.docIDRunEnd());
+        }
+      }
+
+      if (minDocIDRunEnd >= bitsetWindowMax) {

Review Comment:
   Immature idea:
   As we computed this `minDocIDRunEnd` anyway, can we just collect this range 
and update min to it? Probably like:
   
   ```
   if (minDocIDRunEnd > min + 1) {
     rangeDocIdStream.from = min;
     rangeDocIdStream.to = minDocIDRunEnd;
     collector.collect(rangeDocIdStream);
     min = minDocIDRunEnd;
     if (minDocIDRunEnd >= bitsetWindowMax) {
       // We have a large range of doc IDs that all match.
       return minDocIDRunEnd;
     }
   }
   ```
   
   I wouldn't expect this to help much since it only happens at the edge of the 
range, but it also doesn't seem to have side effects.



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