Leverage scorer supplier in QueryFeatureExtractor (#125259)

Follow up of #125103 that leverages scorer supplier to create queries optimised to run on top docs only.
This commit is contained in:
Jim Ferenczi 2025-03-20 11:22:45 +00:00 committed by GitHub
parent c58ac456b8
commit 22be0d957a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 3 deletions

View File

@ -0,0 +1,5 @@
pr: 125259
summary: Leverage scorer supplier in `QueryFeatureExtractor`
area: Ranking
type: enhancement
issues: []

View File

@ -47,9 +47,12 @@ public class QueryFeatureExtractor implements FeatureExtractor {
if (weight == null) {
continue;
}
Scorer scorer = weight.scorer(segmentContext);
if (scorer != null) {
subScorers.add(new FeatureDisiWrapper(scorer, featureNames.get(i)));
var scorerSupplier = weight.scorerSupplier(segmentContext);
if (scorerSupplier != null) {
var scorer = scorerSupplier.get(0L);
if (scorer != null) {
subScorers.add(new FeatureDisiWrapper(scorer, featureNames.get(i)));
}
}
}
approximation = subScorers.size() > 0 ? new DisjunctionDISIApproximation(subScorers) : null;