Skip to content

Commit c3a8271

Browse files
committed
Leverage scorer supplier in QueryFeatureExtractor
Follow up of elastic#125103 that leverages scorer supplier to create queries optimised to run on top docs only.
1 parent 2f1c857 commit c3a8271

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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)