-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforce no-op setWeight on collectors that filter docs out #94886
Enforce no-op setWeight on collectors that filter docs out #94886
Conversation
MinimumScoreCollector and FilteredCollector filter documents out as part of their collection. The have an inner collector to delegate to, but they should never propagate the Weight to them otherwise the total hit count may not reflect the filtering. This commit clarifies this through an empty final setWeight method on both collectors and additional javadocs.
Pinging @elastic/es-search (Team:Search) |
run elasticsearch-ci/bwc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
These collectors did not have any existing unit tests, so I added simple ones where we can now also test that weight does not get propagated. This way we catch it if it ever happens. There is already a more end-to-end test for this in QueryPhaseTests but these are more specific to the individual collectors. |
run elasticsearch-ci/bwc |
MinimumScoreCollector and FilteredCollector filter documents out as part of their collection. The have an inner collector to delegate to, but they should never propagate the Weight to them otherwise the total hit count may not reflect the filtering. This commit clarifies this through an empty final setWeight method on both collectors and additional javadocs.