cpoerschke commented on a change in pull request #475: URL: https://github.com/apache/solr/pull/475#discussion_r774683646
########## File path: solr/contrib/ltr/src/java/org/apache/solr/ltr/interleaving/LTRInterleavingRescorer.java ########## @@ -112,8 +108,8 @@ public TopDocs rescore(IndexSearcher searcher, TopDocs firstPassTopDocs, return reRankedPerModel; } - public void scoreFeatures(IndexSearcher indexSearcher, - int topN, LTRScoringQuery.ModelWeight[] modelWeights, ScoreDoc[] hits, List<LeafReaderContext> leaves, + private void scoreFeatures(IndexSearcher indexSearcher, + LTRScoringQuery.ModelWeight[] modelWeights, ScoreDoc[] hits, List<LeafReaderContext> leaves, Review comment: This here could be considered backwards incompatible (signature and behaviour change to a public method) but if #473 first marked the public method deprecated (in a prior Solr release) then it could be considered a backwards compatible change. ########## File path: solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRRescorer.java ########## @@ -153,8 +149,8 @@ public TopDocs rescore(IndexSearcher searcher, TopDocs firstPassTopDocs, return hits; } - public void scoreFeatures(IndexSearcher indexSearcher, - int topN, LTRScoringQuery.ModelWeight modelWeight, ScoreDoc[] hits, List<LeafReaderContext> leaves, + private void scoreFeatures(IndexSearcher indexSearcher, + LTRScoringQuery.ModelWeight modelWeight, ScoreDoc[] hits, List<LeafReaderContext> leaves, Review comment: This here could be considered backwards incompatible (signature and behaviour change to a public method) but if #473 first marked the public method deprecated (in a prior Solr release) then it could be considered a backwards compatible change. ########## File path: solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRRescorer.java ########## @@ -196,11 +190,35 @@ protected static void logSingleHit(IndexSearcher indexSearcher, LTRScoringQuery. } } + /** + * Scores a single document and returns it. + */ + protected static ScoreDoc scoreSingleHit(int docBase, ScoreDoc hit, int docID, LTRScoringQuery.ModelWeight.ModelScorer scorer) throws IOException { + // Scorer for a LTRScoringQuery.ModelWeight should never be null since we always have to + // call score + // even if no feature scorers match, since a model might use that info to + // return a + // non-zero score. Same applies for the case of advancing a LTRScoringQuery.ModelWeight.ModelScorer + // past the target + // doc since the model algorithm still needs to compute a potentially + // non-zero score from blank features. + assert (scorer != null); + final int targetDoc = docID - docBase; + scorer.docID(); + scorer.iterator().advance(targetDoc); + + scorer.getDocInfo().setOriginalDocScore(hit.score); + hit.score = scorer.score(); + return hit; + } + /** * Scores a single document and returns true if the document's feature info should be logged via the * {@link #logSingleHit(IndexSearcher, org.apache.solr.ltr.LTRScoringQuery.ModelWeight, int, LTRScoringQuery)} * method. Feature info logging is only necessary for the topN documents. + * @deprecated From Solr 9.2.0 onwards this method will be removed. */ + @Deprecated Review comment: This method is now unused but would be retained for (say) one Solr release for backwards compatibility. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org