salvatorecampagna opened a new pull request, #16860: URL: https://github.com/apache/lucene/pull/16860
## TL;DR `HistogramCollector` counted deleted documents when it collected a `PointRangeQuery` through the point tree. It now uses the point tree for that query only on segments without deletions. ## Summary `HistogramCollector#getLeafCollector` collects a `PointRangeQuery` by walking the point tree of the field. The walk does not consult live docs, so a deleted document inside the query range still lands in its bucket. The doc values collector only sees live matches, so it gives the right counts. The gate is now `canUsePointTree`. A `PointRangeQuery` uses the point tree only when `LeafReader#hasDeletions` is false. A match all query needed no change: `isMatchAll` compares `Weight#count` with `maxDoc`, and `count` returns the live doc count, so the check is already false on a segment with deletions. Example: 1536 docs with values `0..1535`, bucket width 512, values `5`, `1030` and `1031` deleted, query range `[1, 1535]`. | | Bucket 0 | Bucket 1 | Bucket 2 | |---|---|---|---| | Before | 511 | 512 | 512 | | After | 510 | 512 | 510 | A segment with deletions now takes the doc values path, which is slower than the point tree path. Segments without deletions keep the point tree path. The optimization in #15226 builds on this change. It can bring the point tree path back for segments with deletions by subtracting the deleted docs. Relates to #15226 ## Testing ``` ./gradlew :lucene:sandbox:test --tests "org.apache.lucene.sandbox.facet.plain.histograms.TestHistogramCollectorManager" -Ptests.asserts=true ./gradlew :lucene:sandbox:test --tests "org.apache.lucene.sandbox.facet.plain.histograms.TestHistogramCollectorManager" -Ptests.asserts=true -Ptests.iters=20 ``` -- 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]
