Skip to content

Commit 31aa673

Browse files
jimcziomricohenn
authored andcommitted
Leverage scorer supplier in QueryFeatureExtractor (elastic#125259)
Follow up of elastic#125103 that leverages scorer supplier to create queries optimised to run on top docs only.
1 parent 2610234 commit 31aa673

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

docs/changelog/125259.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 125259
2+
summary: Leverage scorer supplier in `QueryFeatureExtractor`
3+
area: Ranking
4+
type: enhancement
5+
issues: []

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/inference/ltr/QueryFeatureExtractor.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@ public void setNextReader(LeafReaderContext segmentContext) throws IOException {
4747
if (weight == null) {
4848
continue;
4949
}
50-
Scorer scorer = weight.scorer(segmentContext);
51-
if (scorer != null) {
52-
subScorers.add(new FeatureDisiWrapper(scorer, featureNames.get(i)));
50+
var scorerSupplier = weight.scorerSupplier(segmentContext);
51+
if (scorerSupplier != null) {
52+
var scorer = scorerSupplier.get(0L);
53+
if (scorer != null) {
54+
subScorers.add(new FeatureDisiWrapper(scorer, featureNames.get(i)));
55+
}
5356
}
5457
}
5558
approximation = subScorers.size() > 0 ? new DisjunctionDISIApproximation(subScorers) : null;

0 commit comments

Comments
 (0)