From 1375cc93a86a5d2e0453d59638b75e168edd13d2 Mon Sep 17 00:00:00 2001 From: maarab7 <44259533+maarab7@users.noreply.github.com> Date: Thu, 18 Jul 2019 12:51:27 +0400 Subject: [PATCH] Fix parameter value for calling data.advanceExact (#44205) While the code works perfectly well for a single segment, it returns the wrong values for multiple segments. E.g. If we have 500 docs in one segment and if we want to get the doc id = 280 then data.advanceExact(topDocs.scoreDocs[i].doc) works fine. If we have two segments, say, with first segment having docs 1-200 and the second segment having docs 201-500, then 280 is fetched from the second segment but is actually 480. Subtracting the docBase (280-200) takes us to the correct document which is 80 in the second segment and actually 280. --- .../elasticsearch/example/rescore/ExampleRescoreBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/examples/rescore/src/main/java/org/elasticsearch/example/rescore/ExampleRescoreBuilder.java b/plugins/examples/rescore/src/main/java/org/elasticsearch/example/rescore/ExampleRescoreBuilder.java index 7f4855f8880..14f4d4f8ba3 100644 --- a/plugins/examples/rescore/src/main/java/org/elasticsearch/example/rescore/ExampleRescoreBuilder.java +++ b/plugins/examples/rescore/src/main/java/org/elasticsearch/example/rescore/ExampleRescoreBuilder.java @@ -189,7 +189,7 @@ public class ExampleRescoreBuilder extends RescorerBuilder