Access SearchContext from a Rescorer

(Shai Erera) #1

Hi. I am implementing a custom Rescorer. Currently, RescorerBuilder.innerBuild() receives the QueryShardContext. However, my rescorer needs to have the source query, rather than a rescore_query. Is there any way to obtain that using the current API? If not, will you be open to change the API such that the Rescorer, or RescorerBuilder will receive the SearchContext, which does include the query?

My Rescorer creates a language model out of the top-K docs returned by the original query, and for that I also need to know the terms of the original query.

For now I got around this by having my rescorer take another query parameter, like the QueryRescorer, however it would be better if I can avoid that, since that way the user won't be able to pass one query for matching the documents, and another query for building the language model. And even if that made sense, I'd still want to get access to the original query to combine the two.

If you're open to an API change (Java side only of course), I'm willing to push a PR.

(Shai Erera) #2

Has anyone had a chance to look into this?

(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.