[Feature Request] Add extension points for pre/post collecting scores in QueryPhase #17593
Labels
enhancement
Enhancement or improvement to existing feature or request
Search
Search query, autocomplete ...etc
Is your feature request related to a problem? Please describe
Currently, the core OpenSearch is missing an extension point that allows registering new implementations of CollectorManager and performing post-processing, such as reducing collected results. Such a collector manager can be used in multiple scenarios for custom query types like hybrid queries.
Describe the solution you'd like
Extensions should be executed before and after scores are collected. A good place to integrate this is within the QueryPhase.execute() method, similar to what is done for AggregationProcessor.
New interface name can be QueryPhaseExtension, with methods for pre and post hook points.
QueryPhaseExtension can be registered in QueryPhaseSearcher and returned by new
queryPhaseExtensions()
method. Constructor for QueryPhase already accepts an instance of this class.Related component
Search
Describe alternatives you've considered
Today it's possible to use AggregationProcessor for the same. It's not a proper usage of this extension point, and can be changed at any time. Introducing a dedicated extension point for score collection will provide a more stable and intended solution.
Additional context
No response
The text was updated successfully, but these errors were encountered: