[Feature Request] Add extension point to allow customizations and/or extensions in Rescore processor #16183
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
It's not possible to use existing rescore functionality in scenarios when scores or ranks for search hits are adjusted after the query phase. Either resulting list will be changed (reshuffled) and final result will be irrelevant, or system will be throwing errors/exceptions. Some reasons for such behavior are strong assumption on internal format of query results, and no flexibility for changing when rescore will be called in context of search query lifecycle.
Describe the solution you'd like
Extensible RescoreProcessor, so from the plugin I'm able to provide my own implementation of it. We can have an interface with method public void process(SearchContext context), and class that we have today https://github.com/opensearch-project/OpenSearch/blob/main/server/src/main/java/org/opensearch/search/rescore/RescoreProcessor.java will be a default implementation. But in the plugin we can register more implementations of the same interface for particular query type.
This is different from extensibility that system provides today, with SearchPlugin.getRescorers() method. In that method you register a handler that will handle the rescore query of your custom type. What I want is the customization of the rescore flow for particular query type.
Related component
Search
Describe alternatives you've considered
There is a workaround for this gap: we can return rescore==false fro mthe QueryPhaseSearcher, and call RescoreContext.rescorer().rescore() directly from our code, mimicking implementation of RescoreProcessor.process().
Additional context
One scenario where such flexibility is needed is hybrid query, rescore should not mess the normalized and combined scores and work with specific format of top docs in query results.
The text was updated successfully, but these errors were encountered: