-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Omit maxScoreCollector for field collapsing when sort by score descending #19181
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
Omit maxScoreCollector for field collapsing when sort by score descending #19181
Conversation
…ding Signed-off-by: Binlong Gao <[email protected]>
Signed-off-by: Binlong Gao <[email protected]>
Signed-off-by: Binlong Gao <[email protected]>
❌ Gradle check result for 23018ff: 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? |
❕ Gradle check result for 23018ff: 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. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #19181 +/- ##
============================================
+ Coverage 72.84% 72.87% +0.02%
+ Complexity 69857 69823 -34
============================================
Files 5674 5674
Lines 320901 320911 +10
Branches 46394 46397 +3
============================================
+ Hits 233756 233856 +100
+ Misses 68205 68116 -89
+ Partials 18940 18939 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
server/src/main/java/org/opensearch/search/query/TopDocsCollectorContext.java
Show resolved
Hide resolved
Signed-off-by: Binlong Gao <[email protected]>
❌ Gradle check result for 82eb922: 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? |
❌ Gradle check result for c5b8098: 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? |
server/src/main/java/org/opensearch/search/query/TopDocsCollectorContext.java
Show resolved
Hide resolved
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.
LGTM, thanks @gaobinlong
…ding (opensearch-project#19181) * Omit maxScoreCollector for field collapsing when sort by score descending Signed-off-by: Binlong Gao <[email protected]> * Modify change log Signed-off-by: Binlong Gao <[email protected]> * Add yaml rest test Signed-off-by: Binlong Gao <[email protected]> --------- Signed-off-by: Binlong Gao <[email protected]>
Description
Similar to SimpleTopDocsCollectorContext, we can omit the MaxScoreCollector when sorting by score in CollapsingTopDocsCollectorContext, this can reduce the search latency and cpu usage.
By a benchmark test against the big5 index and other indices, this change can achieve 10%-20% performance improvement in both concurrent segment search enabled and disabled.
The query DSL on big5 index is:
, the benchmark result:
In addition, this PR fixes the bug that max_score is null when we have multiple sort fields and _score is used as a primary sort.
Related Issues
Resolves #19179 and partly resolves #19180.
Check List
- [ ] 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.