mirror of https://github.com/apache/lucene.git
SOLR-10964: Reduce SolrIndexSearcher casting in LTRRescorer.
This commit is contained in:
parent
b123ebad48
commit
14ec46c7f8
|
@ -80,6 +80,8 @@ Other Changes
|
|||
|
||||
* SOLR-10748: Make stream.body configurable and disabled by default (janhoy)
|
||||
|
||||
* SOLR-10964: Reduce SolrIndexSearcher casting in LTRRescorer. (Christine Poerschke)
|
||||
|
||||
================== 7.0.0 ==================
|
||||
|
||||
Versions of Major Components
|
||||
|
|
|
@ -116,8 +116,7 @@ public class LTRRescorer extends Rescorer {
|
|||
final LTRScoringQuery.ModelWeight modelWeight = (LTRScoringQuery.ModelWeight) searcher
|
||||
.createNormalizedWeight(scoringQuery, true);
|
||||
|
||||
final SolrIndexSearcher solrIndexSearch = (SolrIndexSearcher) searcher;
|
||||
scoreFeatures(solrIndexSearch, firstPassTopDocs,topN, modelWeight, hits, leaves, reranked);
|
||||
scoreFeatures(searcher, firstPassTopDocs,topN, modelWeight, hits, leaves, reranked);
|
||||
// Must sort all documents that we reranked, and then select the top
|
||||
Arrays.sort(reranked, new Comparator<ScoreDoc>() {
|
||||
@Override
|
||||
|
@ -138,7 +137,7 @@ public class LTRRescorer extends Rescorer {
|
|||
return new TopDocs(firstPassTopDocs.totalHits, reranked, reranked[0].score);
|
||||
}
|
||||
|
||||
public void scoreFeatures(SolrIndexSearcher solrIndexSearch, TopDocs firstPassTopDocs,
|
||||
public void scoreFeatures(IndexSearcher indexSearcher, TopDocs firstPassTopDocs,
|
||||
int topN, LTRScoringQuery.ModelWeight modelWeight, ScoreDoc[] hits, List<LeafReaderContext> leaves,
|
||||
ScoreDoc[] reranked) throws IOException {
|
||||
|
||||
|
@ -183,8 +182,8 @@ public class LTRRescorer extends Rescorer {
|
|||
reranked[hitUpto] = hit;
|
||||
// if the heap is not full, maybe I want to log the features for this
|
||||
// document
|
||||
if (featureLogger != null) {
|
||||
featureLogger.log(hit.doc, scoringQuery, solrIndexSearch,
|
||||
if (featureLogger != null && indexSearcher instanceof SolrIndexSearcher) {
|
||||
featureLogger.log(hit.doc, scoringQuery, (SolrIndexSearcher)indexSearcher,
|
||||
modelWeight.getFeaturesInfo());
|
||||
}
|
||||
} else if (hitUpto == topN) {
|
||||
|
@ -200,8 +199,8 @@ public class LTRRescorer extends Rescorer {
|
|||
if (hit.score > reranked[0].score) {
|
||||
reranked[0] = hit;
|
||||
heapAdjust(reranked, topN, 0);
|
||||
if (featureLogger != null) {
|
||||
featureLogger.log(hit.doc, scoringQuery, solrIndexSearch,
|
||||
if (featureLogger != null && indexSearcher instanceof SolrIndexSearcher) {
|
||||
featureLogger.log(hit.doc, scoringQuery, (SolrIndexSearcher)indexSearcher,
|
||||
modelWeight.getFeaturesInfo());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue