Skip to content

Hybrid query should call rewrite before creating weight #1268

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

Merged

Conversation

harshavamsi
Copy link
Contributor

@harshavamsi harshavamsi commented Apr 14, 2025

Description

We should always be calling #rewrite before we create query weight from IndexSearcher

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

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.

@harshavamsi
Copy link
Contributor Author

@heemin32 @martin-gaievski @navneet1v I found this when I was debugging an issue where changes in core were breaking tests in Hybrid search. We should always be calling rewrite and pass the rewritten value when creating weight

Signed-off-by: Harsha Vamsi Kalluri <[email protected]>
Signed-off-by: Harsha Vamsi Kalluri <[email protected]>
@@ -117,6 +117,7 @@ public void testQuerySpecs() {
assertTrue(querySpecs.stream().anyMatch(spec -> HybridQueryBuilder.NAME.equals(spec.getName().getPreferredName())));
}

@AwaitsFix(bugUrl = "https://github.com/opensearch-project/neural-search/pull/1268")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not entirely sure why this test is failing, will open a new issue

Copy link
Member

@vibrantvarun vibrantvarun Apr 14, 2025

Choose a reason for hiding this comment

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

opensearch-project/OpenSearch#17611. This PR is the reason behind the test failure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah you're right!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is an issue with onboarding to the new feature flag framework, see opensearch-project/OpenSearch#17940. For the time being we are skipping this test

Signed-off-by: Harsha Vamsi Kalluri <[email protected]>
Copy link
Member

@vibrantvarun vibrantvarun left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @harshavamsi for the quick fix.

@vibrantvarun vibrantvarun merged commit 5f2fbb4 into opensearch-project:main Apr 14, 2025
50 of 53 checks passed
Copy link

codecov bot commented Apr 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (d686474) to head (b33163d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #1268       +/-   ##
============================================
- Coverage     81.43%       0   -81.44%     
============================================
  Files           127       0      -127     
  Lines          5672       0     -5672     
  Branches        916       0      -916     
============================================
- Hits           4619       0     -4619     
+ Misses          698       0      -698     
+ Partials        355       0      -355     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants