From 4d72772df727c5a6873a75eb2ecb82e8cd14fe47 Mon Sep 17 00:00:00 2001 From: Martin Gaievski Date: Mon, 20 Nov 2023 16:21:30 -0800 Subject: [PATCH] Fixed compilation errors after latest core upgrade Signed-off-by: Martin Gaievski --- .../java/org/apache/lucene/BoundedLinearFeatureQuery.java | 8 +++++--- .../opensearch/neuralsearch/plugin/NeuralSearchTests.java | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/apache/lucene/BoundedLinearFeatureQuery.java b/src/main/java/org/apache/lucene/BoundedLinearFeatureQuery.java index 617662363..a914f3156 100644 --- a/src/main/java/org/apache/lucene/BoundedLinearFeatureQuery.java +++ b/src/main/java/org/apache/lucene/BoundedLinearFeatureQuery.java @@ -48,6 +48,7 @@ import org.apache.lucene.search.Explanation; import org.apache.lucene.search.ImpactsDISI; import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.MaxScoreCache; import org.apache.lucene.search.Query; import org.apache.lucene.search.QueryVisitor; import org.apache.lucene.search.ScoreMode; @@ -170,7 +171,8 @@ public float score(float freq, long norm) { } }; final ImpactsEnum impacts = termsEnum.impacts(PostingsEnum.FREQS); - final ImpactsDISI impactsDisi = new ImpactsDISI(impacts, impacts, scorer); + MaxScoreCache maxScoreCache = new MaxScoreCache(impacts, scorer); + final ImpactsDISI impactsDisi = new ImpactsDISI(impacts, maxScoreCache); return new Scorer(this) { @@ -191,12 +193,12 @@ public DocIdSetIterator iterator() { @Override public int advanceShallow(int target) throws IOException { - return impactsDisi.advanceShallow(target); + return impactsDisi.getMaxScoreCache().advanceShallow(target); } @Override public float getMaxScore(int upTo) throws IOException { - return impactsDisi.getMaxScore(upTo); + return impactsDisi.getMaxScoreCache().getMaxScore(upTo); } @Override diff --git a/src/test/java/org/opensearch/neuralsearch/plugin/NeuralSearchTests.java b/src/test/java/org/opensearch/neuralsearch/plugin/NeuralSearchTests.java index 69791681e..32901cf12 100644 --- a/src/test/java/org/opensearch/neuralsearch/plugin/NeuralSearchTests.java +++ b/src/test/java/org/opensearch/neuralsearch/plugin/NeuralSearchTests.java @@ -11,6 +11,7 @@ import java.util.Map; import java.util.Optional; +import org.opensearch.indices.IndicesService; import org.opensearch.ingest.IngestService; import org.opensearch.ingest.Processor; import org.opensearch.neuralsearch.processor.NeuralQueryEnricherProcessor; @@ -66,7 +67,8 @@ public void testProcessors() { null, mock(IngestService.class), null, - null + null, + mock(IndicesService.class) ); Map processors = plugin.getProcessors(processorParams); assertNotNull(processors);