Description
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.
public interface QueryPhaseExtension {
void beforeScoreCollection(SearchContext context);
void afterScoreCollection(SearchContext context);
}
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
Metadata
Metadata
Assignees
Type
Projects
Status