solr icon indicating copy to clipboard operation
solr copied to clipboard

SOLR-15873: factor out a ReRankRescorer class, simplify LTR[Interleaving]Rescorer code

Open cpoerschke opened this issue 4 years ago • 0 comments

(Keeping this PR as "draft" whilst the "keep or not keep" discussion in SOLR-15873 is underway and also because this PR includes the #470 changes.)

https://issues.apache.org/jira/browse/SOLR-15873

The Lucene Rescorer.rescore API signature takes three arguments: rescore(IndexSearcher searcher, TopDocs firstPassTopDocs, int topN)

The Solr ReRankCollector caps the number of documents that are passed to the rescore method so that topN == firstPassTopDocs.scoreDocs.length is always the case.

This pull request introduces a ReRankRescorer class for the specific ReRankCollector use case i.e. a two arguments API signature variant rescore(IndexSearcher searcher, TopDocs firstPassTopDocs) with non-support of the three argument variant.

Then the LTR[Interleaving]Rescorer logic can then be simplified by making use of the topN == firstPassTopDocs.scoreDocs.length condition.

Existing LTR[Interleaving]Rescorer APIs that support topN != firstPassTopDocs.scoreDocs.length are retained with @deprecated annotation for backwards compatibility and with the intention to remove them in the next or a subsequent Solr version.

cpoerschke avatar Dec 24 '21 12:12 cpoerschke