Fixed search_after for hybrid query - #1939
Merged
heemin32 merged 1 commit intoAug 10, 2026
Merged
Conversation
PR Reviewer Guide 🔍(Review updated until commit 309a5d8)Here are some key observations to aid the review process:
|
martin-gaievski
force-pushed
the
fix/1934-hybrid-sort-search-after-nosuchelement
branch
from
August 8, 2026 22:49
94f7703 to
23cfff3
Compare
|
Persistent review updated to latest commit 23cfff3 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1939 +/- ##
============================================
- Coverage 83.45% 83.43% -0.02%
- Complexity 3884 3885 +1
============================================
Files 291 291
Lines 13819 13821 +2
Branches 2294 2295 +1
============================================
Hits 11532 11532
- Misses 1454 1456 +2
Partials 833 833 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Guard against NoSuchElementException in ScoreCombiner.getDocIdSortFieldsMap when a shard returns no results for a hybrid query with sort/search_after. An exhausted shard arrives with an empty top docs list but a non-zero total hits count, which slipped past the totalHits==0 guard and hit getFirst() on an empty list. Return early when the list is empty (behavior-equivalent: an empty list iterates zero times and yields an empty map). Adds a unit test that reproduces the crash before the fix and passes after. Fixes opensearch-project#1934 Signed-off-by: Martin Gaievski <gaievski@amazon.com>
martin-gaievski
force-pushed
the
fix/1934-hybrid-sort-search-after-nosuchelement
branch
from
August 9, 2026 00:41
23cfff3 to
309a5d8
Compare
|
Persistent review updated to latest commit 309a5d8 |
martin-gaievski
marked this pull request as ready for review
August 9, 2026 01:36
martin-gaievski
requested review from
VijayanB,
bzhangam,
chishui,
heemin32,
jmazanec15,
junqiu-lei,
minalsha,
model-collapse,
naveentatikonda,
navneet1v,
owaiskazi19,
sean-zheng-amazon,
vamshin,
vibrantvarun,
yuye-aws,
zane-neo and
zhichao-aws
as code owners
August 9, 2026 01:36
bzhangam
approved these changes
Aug 10, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Added null check for topFieldDocs in scorecombiner for hybrid query, this avoids NPE when search_after and sort both are enabled.
Related Issues
Resolves #1934
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.