Is your feature request related to a problem? Please describe
The current implementation of MultiCollector in Lucene has limitations that can lead to several undesirable side effects in OpenSearch, including:
high latencies in search
runtime errors
incorrect search hits
the limitation is in method public ScoreMode scoreMode(), in case of multiple collectors (which is the typical use case for MultiCollector) the score mode can fall back to ScoreMode.COMPLETE or ScoreMode.COMPLETE_NO_SCORES. This can happen in case score modes are not the same among all the collectors.
To address this issue, I propose allowing clients to specify the score mode for EMPTY_CONTEXT. This enhancement will maintain the original functionality of allowing callers to omit the default top docs collector (as introduced in PR #13481) while providing more flexibility and control over the score mode.
Is your feature request related to a problem? Please describe
The current implementation of MultiCollector in Lucene has limitations that can lead to several undesirable side effects in OpenSearch, including:
the limitation is in method public ScoreMode scoreMode(), in case of multiple collectors (which is the typical use case for MultiCollector) the score mode can fall back to ScoreMode.COMPLETE or ScoreMode.COMPLETE_NO_SCORES. This can happen in case score modes are not the same among all the collectors.
One specific scenario affected by this limitation is when a client uses EMPTY_CONTEXT from QueryCollectorContext. The EMPTY_CONTEXT is initialized by EMPTY_COLLECTOR, which has a hardcoded score mode value as COMPLETE_NO_SCORES.
Describe the solution you'd like
To address this issue, I propose allowing clients to specify the score mode for EMPTY_CONTEXT. This enhancement will maintain the original functionality of allowing callers to omit the default top docs collector (as introduced in PR #13481) while providing more flexibility and control over the score mode.
Related component
Search
Describe alternatives you've considered
No response
Additional context
No response