mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
Previously this code was duplicated across the 3 different topdocs variants we have. It also had no real unittest (where we tested with holes in the results) which caused a sneaky bug where the comparison used `result.size()` vs `results.size()` causing several NPEs downstream. This change adds a static method to fill the top docs that is shared across all variants and adds a unittest that would have caught the issue very quickly. Closes #19356 Closes #23357