dweiss commented on PR #16307:
URL: https://github.com/apache/lucene/pull/16307#issuecomment-4905822682
LLM says this, sorry I can't offer more help.
```
The mechanism
The DV drill‑down goes SortedNumericDocValuesRangeQuery → (no skipper)
DocValuesValueRangeIterator, a two‑phase iterator whose matches() must confirm
that a value is in range. For
dense ranges the bulk scorer is DenseConjunctionBulkScorer. In scoreWindow
(DenseConjunctionBulkScorer.java:193‑208) it buckets clauses:
int docIdRunEnd = w.docIDRunEnd();
if (w.docID() > min || docIdRunEnd < minRunEndThreshold) {
windowClauses.add(w); // needs per-doc matches() confirmation
} else {
minDocIDRunEnd = Math.min(minDocIDRunEnd, docIdRunEnd); // treated as
FULLY MATCHING
}
...
if (acceptDocs == null && windowClauses.isEmpty()) {
collector.collectRange(min, minDocIDRunEnd); // collect WITHOUT
calling matches()
For a width‑1 window (max == min+1, i.e. a partition boundary),
minRunEndThreshold = min(min+2048, max) = min+1. The clause sits at w.docID()
== min, so:
- Before #16307: docIDRunEnd() == min < min+1 → goes to windowClauses →
matches() is confirmed. Correct.
- After #16307: docIDRunEnd() == min+1 >= min+1 → goes to the "fully
matching" bucket → collectRange(min, min+1) collects the boundary doc without
confirming matches().
That boundary doc has the field (so the approximation is positioned on it)
but its value may be out of range — it gets counted anyway → the ±1. The
default docIDRunEnd()
optimistically assumes the current (unconfirmed) doc matches, which is
fine for ReqExclBulkScorer (which calls it only after matches()), but
DenseConjunctionBulkScorer consults it
before confirmation.
```
--
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]