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

Fix: visit of inner query for FunctionScoreQueryBuilder #15404

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jdnvn
Copy link

@jdnvn jdnvn commented Aug 25, 2024

Description

Similar to #14739, but implements the visit method in FunctionScoreQueryBuilder to allow subqueries to be processed properly.

Related Issues

Resolves #15403
Similar to #15034

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

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.

Copy link
Contributor

✅ Gradle check result for 7bac688: SUCCESS

Copy link
Contributor

❕ Gradle check result for d8e8390: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

Copy link

codecov bot commented Aug 25, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 71.92%. Comparing base (6152afe) to head (3258eea).
Report is 16 commits behind head on main.

Files Patch % Lines
...query/functionscore/FunctionScoreQueryBuilder.java 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #15404      +/-   ##
============================================
- Coverage     71.95%   71.92%   -0.03%     
+ Complexity    63254    63229      -25     
============================================
  Files          5224     5224              
  Lines        296079   296083       +4     
  Branches      42763    42764       +1     
============================================
- Hits         213030   212946      -84     
- Misses        65550    65671     +121     
+ Partials      17499    17466      -33     

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

Comment on lines +711 to +715
public void visit(QueryBuilderVisitor visitor) {
visitor.accept(this);
if (query != null) {
visitor.getChildVisitor(BooleanClause.Occur.MUST).accept(query);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick -- it looks like the FunctionScoreQueryBuilder constructors guarantee that query can never be null, so the check is unnecessary.

Copy link
Author

Choose a reason for hiding this comment

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

A similar comment was made here, and the author opted to keep the null check to pass tests and keep consistent with the other implementations. Let me know and I can change it if you feel otherwise.

Copy link
Member

Choose a reason for hiding this comment

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

I think for unit test case purpose (Keeping method isolated) a null check would be fine

@jdnvn jdnvn requested a review from msfroh September 1, 2024 16:03
Copy link
Contributor

github-actions bot commented Sep 1, 2024

❌ Gradle check result for 39b50b9: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented Sep 1, 2024

❌ Gradle check result for 378b984: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@yuye-aws
Copy link
Member

@jdnvn Can you fix the DCO and gradle check?

@opensearch-trigger-bot
Copy link
Contributor

This PR is stalled because it has been open for 30 days with no activity.

@opensearch-trigger-bot opensearch-trigger-bot bot added the stalled Issues that have stalled label Oct 12, 2024
@yuye-aws
Copy link
Member

@msfroh Can you rerun the gradle checks?

@msfroh
Copy link
Collaborator

msfroh commented Oct 14, 2024

@jdnvn It looks like one of your commits is unsigned. That's breaking the DCO check.

You can git rebase -i to interactively rebase, say pick for the first commit and squash for the rest to collapse down to one commit. Then either keep ones of the sign-offs or do git commit --amend -s to sign off the single commit. Then you can git push -f to your fork.

@msfroh
Copy link
Collaborator

msfroh commented Oct 14, 2024

Since we've had at least one release since this PR was opened, we'll need to rebase it onto the latest main branch to pick up new version constants. I can take care of that during my business hours (US PDT) tomorrow.

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

Copy link
Member

@dbwiddis dbwiddis left a comment

Choose a reason for hiding this comment

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

LGTM!

@opensearch-trigger-bot
Copy link
Contributor

This PR is stalled because it has been open for 30 days with no activity.

@opensearch-trigger-bot opensearch-trigger-bot bot added the stalled Issues that have stalled label Nov 18, 2024
@kodieg
Copy link

kodieg commented Dec 4, 2024

Will this change make into the next release?

@dblock
Copy link
Member

dblock commented Dec 4, 2024

Will this change make into the next release?

Someone needs to rebase this PR against main and iterate it to green. Looks like @jdnvn is unfortunately MIA, care to help?

@kodieg
Copy link

kodieg commented Dec 5, 2024

Opened a new PR #16776

@kodieg
Copy link

kodieg commented Dec 10, 2024

@dblock I rebased today and it seems that all tests has passed. #16776

Should I do anything else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch bug Something isn't working Search:Query Capabilities stalled Issues that have stalled v2.17.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Cannot make use of default_model_id in function_score query type
10 participants