From b63313232f0476dd13893b2892cbd0985f7295e0 Mon Sep 17 00:00:00 2001 From: expani Date: Wed, 18 Dec 2024 14:21:04 -0800 Subject: [PATCH] Fixed QueryPhaseTests#minScoreOptimisation by not delegating setWeight to underlying delegate Signed-off-by: expani --- .../org/opensearch/common/lucene/MinimumScoreCollector.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/src/main/java/org/opensearch/common/lucene/MinimumScoreCollector.java b/server/src/main/java/org/opensearch/common/lucene/MinimumScoreCollector.java index 6167663536946..901f9e820ad3f 100644 --- a/server/src/main/java/org/opensearch/common/lucene/MinimumScoreCollector.java +++ b/server/src/main/java/org/opensearch/common/lucene/MinimumScoreCollector.java @@ -40,6 +40,7 @@ import org.apache.lucene.search.Scorable; import org.apache.lucene.search.ScoreCachingWrappingScorer; import org.apache.lucene.search.ScoreMode; +import org.apache.lucene.search.Weight; import java.io.IOException; @@ -81,6 +82,11 @@ public void collect(int doc) throws IOException { }); } + @Override + public void setWeight(Weight weight) { + // Not redirecting to delegate collector to maintain same behaviour when this extended SimpleCollector. + } + @Override public ScoreMode scoreMode() { return in.scoreMode() == ScoreMode.TOP_SCORES ? ScoreMode.TOP_SCORES : ScoreMode.COMPLETE;