Skip to content
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

Add sub query explanations in DisjunctionMaxQuery#explain on no-match #13362

Conversation

timgrein
Copy link
Contributor

@timgrein timgrein commented May 12, 2024

Closes #13357

Description

#13357 states that it's useful to have the explanations of the sub queries of DisjuncationMaxQuery present, even if the document didn't match. Considering that other queries like CoveringQuery also include explanations, if the document didn't match I've adjusted the logic according to the issue's proposal.

Also added tests for explain (match and no match case). I've also adjusted CheckHits#verifyExplanation to only check sub explanations, if the overall explanation returned a hit and scores need to be checked.

@timgrein timgrein changed the title Always add sub query explanations to DisjunctionMaxQuery Always add sub query explanations in DisjunctionMaxQuery May 12, 2024
@timgrein timgrein changed the title Always add sub query explanations in DisjunctionMaxQuery Always add sub query explanations in DisjunctionMaxQuery#explain May 12, 2024
@timgrein timgrein changed the title Always add sub query explanations in DisjunctionMaxQuery#explain Add sub query explanations in DisjunctionMaxQuery#explain on no-match May 12, 2024
@jpountz
Copy link
Contributor

jpountz commented May 14, 2024

This could make explanations harder to read for large queries, e.g. queries produced through rewriting. I wonder about doing something in-between such as only including the non-matching subs if the query doesn't match, what do you think?

@timgrein
Copy link
Contributor Author

This could make explanations harder to read for large queries, e.g. queries produced through rewriting. I wonder about doing something in-between such as only including the non-matching subs if the query doesn't match, what do you think?

Fair point! Adjusted the PR accordingly and added an additional test for the in-between behavior.

Copy link
Contributor

@jpountz jpountz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Can you add a CHANGES entry under 9.11 / Improvements?

@timgrein
Copy link
Contributor Author

Thanks for the reviews! Added it to the improvement section ✅ @jpountz

@jpountz jpountz merged commit 8e5409c into apache:main May 14, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance DisjunctionMaxQuery explanation to include details in case there was no match
3 participants