Skip to content

Fix exception when merging completion suggestions (#70414) #70633

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
merged 2 commits into from
Mar 22, 2021

Conversation

cbuescher
Copy link
Member

@cbuescher cbuescher commented Mar 22, 2021

Under certain circumstances we can get "array_index_out_of_bounds" exceptions in
the fetch phase when merging comletion suggestion results with additonal field
collapsing in place. We store the ScoreDoc array in the SortedTopDocs score docs
contain both regular search hits and completion suggestion results added in
SearchPhaseController#sortDocs, so when merging these we need to know the
correct array offset where the completion results begin. This is based on the
hits length calculated in SearchPhaseController#getHits, which doesn't take into
account that there might be suggestion results present when calculating the
number of hits. This change adds the number of suggestions to SortedTopDocs in
order to be able to later account for it when calculating the hits.

Closes #70328

Under certain circumstances we can get "array_index_out_of_bounds" exceptions in
the fetch phase when merging comletion suggestion results with additonal field
collapsing in place. We store the ScoreDoc array in the SortedTopDocs score docs
contain both regular search hits and completion suggestion results added in
SearchPhaseController#sortDocs, so when merging these we need to know the
correct array offset where the completion results begin. This is based on the
hits length calculated in SearchPhaseController#getHits, which doesn't take into
account that there might be suggestion results present when calculating the
number of hits. This change adds the number of suggestions to SortedTopDocs in
order to be able to later account for it when calculating the hits.

Closes elastic#70328
@cbuescher
Copy link
Member Author

@elasticmachine run elasticsearch-ci/bwc

@cbuescher
Copy link
Member Author

@elasticmachine update branch

@cbuescher cbuescher merged commit a359163 into elastic:7.x Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants