romseygeek commented on code in PR #16069:
URL: https://github.com/apache/lucene/pull/16069#discussion_r3282278847
##########
lucene/core/src/java/org/apache/lucene/search/MaxScoreBulkScorer.java:
##########
@@ -200,25 +267,27 @@ private void scoreInnerWindowWithFilter(
boolean match =
(acceptDocs == null || acceptDocs.get(doc))
&& (filter.twoPhaseView == null ||
filter.twoPhaseView.matches());
- double score = 0;
- do {
- if (match) {
- score += top.scorer.score();
- }
- top.doc = top.iterator.nextDoc();
- top = essentialQueue.updateTop();
- } while (top.doc == doc);
-
- if (match) {
- docAndScoreAccBuffer.grow(docAndScoreAccBuffer.size + 1);
- docAndScoreAccBuffer.docs[docAndScoreAccBuffer.size] = doc;
- docAndScoreAccBuffer.scores[docAndScoreAccBuffer.size] = score;
- docAndScoreAccBuffer.size++;
- }
+ collectScores(top, doc, match);
Review Comment:
This doesn't need to be a separate method now that it's only called from here
##########
lucene/core/src/java/org/apache/lucene/search/MaxScoreBulkScorer.java:
##########
@@ -184,6 +188,69 @@ private void scoreInnerWindowWithFilter(
int innerWindowMax = MathUtil.unsignedMin(max, innerWindowMin +
INNER_WINDOW_SIZE);
docAndScoreAccBuffer.size = 0;
+ if (filterMatches == null) {
+ fillScoreBufferViaLeapFrog(top, acceptDocs, innerWindowMax);
+ } else {
+ fillScoreBufferViaBitSet(top, acceptDocs, innerWindowMax);
+ }
+
+ scoreNonEssentialClauses(collector, docAndScoreAccBuffer,
firstEssentialScorer);
+ }
+
+ private void fillScoreBufferViaBitSet(DisiWrapper top, Bits acceptDocs, int
innerWindowMax)
+ throws IOException {
+ filterMatches.clear();
+ int innerWindowMin = top.doc;
+ if (filter.doc < innerWindowMax) {
+ if (filter.doc < innerWindowMin) {
+ filter.doc = filter.approximation.advance(innerWindowMin);
+ }
+ if (filter.doc < innerWindowMax) {
+ filter.approximation.intoBitSet(innerWindowMax, filterMatches,
innerWindowMin);
+ filter.doc = filter.approximation.docID();
+ }
+ }
+ if (acceptDocs != null) {
+ acceptDocs.applyMask(filterMatches, innerWindowMin);
+ }
+
+ int innerWindowSize = innerWindowMax - innerWindowMin;
+ // Collect matches of essential clauses into a bitset, checking filter via
bitset lookup
+ do {
Review Comment:
This is all shared code with `scoreInnerWindowMultipleEssentialClauses` now,
isn't it? Can we re-use that method, and maybe add an `offset` to adjust the
acceptDocs bitset calls.
--
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]