iprithv commented on code in PR #16069:
URL: https://github.com/apache/lucene/pull/16069#discussion_r3270464351
##########
lucene/core/src/java/org/apache/lucene/search/MaxScoreBulkScorer.java:
##########
@@ -164,12 +175,52 @@ private void scoreInnerWindow(
}
}
- private void scoreInnerWindowWithFilter(
+ private void scoreInnerWindowWithBitsetFilter(
LeafCollector collector, Bits acceptDocs, int max, DisiWrapper filter)
throws IOException {
+ DisiWrapper top = essentialQueue.top();
+ assert top.doc < max;
+ while (top.doc < filter.doc) {
+ // Must use the iterator as `top` might be a two-phase iterator
+ top.doc = top.iterator.advance(filter.doc);
+ top = essentialQueue.updateTop();
+ }
- // TODO: Sometimes load the filter into a bitset and use the more
optimized execution paths with
- // this bitset as `acceptDocs`
+ // Only score an inner window, after that we'll check if the min
competitive score has
+ // increased enough for a more favorable partitioning to be used.
+ int innerWindowMin = top.doc;
+ int innerWindowMax = MathUtil.unsignedMin(max, innerWindowMin +
INNER_WINDOW_SIZE);
+ if (top.doc >= max) {
+ return;
+ }
+ int innerWindowSize = innerWindowMax - innerWindowMin;
+ if (filterWindowMatches == null) {
+ filterWindowMatches = new FixedBitSet(INNER_WINDOW_SIZE);
+ } else {
+ filterWindowMatches.clear(0, innerWindowSize);
+ }
+ if (filter.doc < innerWindowMax) {
+ if (filter.doc < innerWindowMin) {
+ filter.doc = filter.approximation.advance(innerWindowMin);
+ }
+ if (filter.doc < innerWindowMax) {
+ filter.approximation.intoBitSet(innerWindowMax, filterWindowMatches,
innerWindowMin);
+ filter.doc = filter.approximation.docID();
+ }
+ }
+
+ filterBits.set(filterWindowMatches, innerWindowMin, acceptDocs);
Review Comment:
Done, thanks!
--
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]