-
Notifications
You must be signed in to change notification settings - Fork 72
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
Enable support for default model id on HybridQueryBuilder #541
Enable support for default model id on HybridQueryBuilder #541
Conversation
Signed-off-by: Varun Jain <varunudr@amazon.com>
Signed-off-by: Varun Jain <varunudr@amazon.com>
Test method name testVisit has been kept in hybridQueryBuilder to maintain name consistency with OpenSearch |
Signed-off-by: Varun Jain <varunudr@amazon.com>
Signed-off-by: Varun Jain <varunudr@amazon.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #541 +/- ##
============================================
+ Coverage 84.33% 84.39% +0.05%
- Complexity 533 535 +2
============================================
Files 40 40
Lines 1564 1570 +6
Branches 244 245 +1
============================================
+ Hits 1319 1325 +6
Misses 133 133
Partials 112 112 ☔ View full report in Codecov by Sentry. |
can we add integ test that would fail without changes in this PR? It can be something like: processor is set with the model id, we use hybrid query with neural query as one of sub-queries, do not specify model id in the query. My understanding without this change that is failing with a "missing model id" exception. We can even extend this to a re-indexing scenario, where I suppose similar error will be in reindexing call |
discussed offline with @vibrantvarun, test is already a part of this PR |
As per discussion with @martin-gaievski offline, Therefore after adding the visit method the visitor is able to parse inner subqueries of the hybrid query builder and add the missing model id in it. Thanks |
Signed-off-by: Varun Jain <varunudr@amazon.com>
This PR merge is dependent on opensearch-project/security#3959 |
* Enable support for default model id on HybridQueryBuilder Signed-off-by: Varun Jain <varunudr@amazon.com> * Adding tests and updating changelog.md Signed-off-by: Varun Jain <varunudr@amazon.com> * Optimizing code Signed-off-by: Varun Jain <varunudr@amazon.com> * modyfing the tests4 Signed-off-by: Varun Jain <varunudr@amazon.com> * Addressing Heemin comment Signed-off-by: Varun Jain <varunudr@amazon.com> --------- Signed-off-by: Varun Jain <varunudr@amazon.com> (cherry picked from commit 98e5534)
* Enable support for default model id on HybridQueryBuilder Signed-off-by: Varun Jain <varunudr@amazon.com> * Adding tests and updating changelog.md Signed-off-by: Varun Jain <varunudr@amazon.com> * Optimizing code Signed-off-by: Varun Jain <varunudr@amazon.com> * modyfing the tests4 Signed-off-by: Varun Jain <varunudr@amazon.com> * Addressing Heemin comment Signed-off-by: Varun Jain <varunudr@amazon.com> --------- Signed-off-by: Varun Jain <varunudr@amazon.com> (cherry picked from commit 98e5534) Co-authored-by: Varun Jain <varunudr@amazon.com>
* Enable support for default model id on HybridQueryBuilder Signed-off-by: Varun Jain <varunudr@amazon.com> * Adding tests and updating changelog.md Signed-off-by: Varun Jain <varunudr@amazon.com> * Optimizing code Signed-off-by: Varun Jain <varunudr@amazon.com> * modyfing the tests4 Signed-off-by: Varun Jain <varunudr@amazon.com> * Addressing Heemin comment Signed-off-by: Varun Jain <varunudr@amazon.com> --------- Signed-off-by: Varun Jain <varunudr@amazon.com>
Description
This PR enables the support for Default model Id in Hybrid Query Builder.
Premise:
A customer is facing an issue while using the feature of default model id when neural query is a part of hybrid query.
See example below
Reason:
NeuralQueryEnricher processor triggers a neural query visitor to visit all the querybuilders present in the search query and find the neuralquerybuilder and update the model id in it if not present. Visitor finds the visit method in the querybuilder and parses them. However, in hybridquerybuilder the definition of visit method was not there, therefore it was not able to parse the inner sub queries in it.
Issues Resolved
#539
Check List
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.