-
Notifications
You must be signed in to change notification settings - Fork 78
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
Fix explain exception in hybrid queries with partial subquery matches #1123
Merged
martin-gaievski
merged 4 commits into
opensearch-project:main
from
martin-gaievski:fixed_exception_explain_in_hq_for_multiple_subqueries
Jan 22, 2025
Merged
Fix explain exception in hybrid queries with partial subquery matches #1123
martin-gaievski
merged 4 commits into
opensearch-project:main
from
martin-gaievski:fixed_exception_explain_in_hq_for_multiple_subqueries
Jan 22, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1123 +/- ##
============================================
- Coverage 80.46% 80.42% -0.05%
Complexity 1214 1214
============================================
Files 93 93
Lines 4162 4163 +1
Branches 700 700
============================================
- Hits 3349 3348 -1
- Misses 543 545 +2
Partials 270 270 ☔ View full report in Codecov by Sentry. |
f041b80
to
2579aae
Compare
1c94aed
to
2654d8e
Compare
…queries Signed-off-by: Martin Gaievski <gaievski@amazon.com>
2654d8e
to
c8a7d72
Compare
owaiskazi19
reviewed
Jan 21, 2025
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.
LG overall
src/main/java/org/opensearch/neuralsearch/processor/ExplanationResponseProcessor.java
Outdated
Show resolved
Hide resolved
…nResponseProcessor.java Co-authored-by: Owais Kazi <owaiskazi19@gmail.com> Signed-off-by: Martin Gaievski <gaievski@amazon.com>
owaiskazi19
approved these changes
Jan 22, 2025
heemin32
reviewed
Jan 22, 2025
src/main/java/org/opensearch/neuralsearch/processor/ExplanationResponseProcessor.java
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/ExplanationResponseProcessor.java
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/normalization/ScoreNormalizationUtil.java
Show resolved
Hide resolved
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
heemin32
approved these changes
Jan 22, 2025
…ubqueries Signed-off-by: Martin Gaievski <gaievski@amazon.com>
junqiu-lei
approved these changes
Jan 22, 2025
8c743ec
into
opensearch-project:main
36 of 40 checks passed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport 2.x
Label will add auto workflow to backport PR to 2.x branch
Bug Fixes
Changes to a system or product designed to handle a programming bug/glitch
v2.19.0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Hybrid query fails with runtime exception in some cases when used with
explain
flag. To get the error you need to design a hybrid query in a way that documents will match only some of multiple subqueries from hybrid query, and does not match other sub-queries.Example of such scenario:
2 sub-queries, search hit had top match in sub-query 1 and low score in query 2, such that in sub-query2 results this document is below the "size".
In this example if score of
multi_match
query is high and score ofneural
is very low explain should still show two matches. This is becauseneural
will have positive score for any document, even if that document is below top K semantically similar documents.Reason for the error is incorrect assumption that we took during implementation that search hit will have matches in every sub-query. In case of only partial match that leads to the index out of bounds exception because collections with explanation details and search hit details are of different sizes.
Example of query I used to reproduce the problem:
and this is response I got
following exception is in the log
I ran this query for a
trec-covid
dataset https://huggingface.co/datasets/nreimers/trec-covid on a cluster with 3 data nodes and 12 shards.This fix affects response format for both "by query" and "by document id" requests with explain.
Below are examples of both responses after my change:
explain in "by query" mode
example response for "explain by doc id" query
Related Issues
#658
Check List
--signoff
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.