From eccb3e52961698db1e3b4778810a87003d0349ee Mon Sep 17 00:00:00 2001 From: Tim Owen Date: Wed, 21 Sep 2022 15:04:25 +0100 Subject: [PATCH] Fixes for solr8 build such as missing imports and upstream changes --- .../apache/solr/search/facet/BitmapCollectorAgg.java | 1 + .../facet/FacetFieldProcessorByHashDVString.java | 6 ++++-- .../solr/search/facet/TermFrequencySlotAcc.java | 3 +-- .../processor/ConditionalUpsertProcessorFactory.java | 11 +++++++++-- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/search/facet/BitmapCollectorAgg.java b/solr/core/src/java/org/apache/solr/search/facet/BitmapCollectorAgg.java index f107582ee429..d01ad4af48a7 100644 --- a/solr/core/src/java/org/apache/solr/search/facet/BitmapCollectorAgg.java +++ b/solr/core/src/java/org/apache/solr/search/facet/BitmapCollectorAgg.java @@ -12,6 +12,7 @@ import org.apache.solr.search.FunctionQParser; import org.apache.solr.search.SyntaxError; import org.apache.solr.search.ValueSourceParser; +import org.apache.solr.search.facet.SlotAcc.FuncSlotAcc; import org.roaringbitmap.buffer.ImmutableRoaringBitmap; import org.roaringbitmap.buffer.MutableRoaringBitmap; diff --git a/solr/core/src/java/org/apache/solr/search/facet/FacetFieldProcessorByHashDVString.java b/solr/core/src/java/org/apache/solr/search/facet/FacetFieldProcessorByHashDVString.java index 465996897e19..bbd47202e970 100644 --- a/solr/core/src/java/org/apache/solr/search/facet/FacetFieldProcessorByHashDVString.java +++ b/solr/core/src/java/org/apache/solr/search/facet/FacetFieldProcessorByHashDVString.java @@ -27,6 +27,7 @@ import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.SortedDocValues; import org.apache.lucene.index.SortedSetDocValues; +import org.apache.lucene.search.ScoreMode; import org.apache.lucene.search.SimpleCollector; import org.apache.lucene.util.BitUtil; import org.apache.lucene.util.BytesRef; @@ -34,6 +35,7 @@ import org.apache.solr.common.util.SimpleOrderedMap; import org.apache.solr.schema.SchemaField; import org.apache.solr.search.DocSetUtil; +import org.apache.solr.search.facet.SlotAcc.CountSlotAcc; import org.apache.solr.search.facet.SlotAcc.SlotContext; /** @@ -188,7 +190,7 @@ private void collectDocs() throws IOException { SortedSetDocValues values = null; HashMap segOrdinalValueCache; // avoid repeated lookups of the same ordinal, in this seg - @Override public boolean needsScores() { return false; } + @Override public ScoreMode scoreMode() { return ScoreMode.COMPLETE_NO_SCORES; } @Override protected void doSetNextReader(LeafReaderContext ctx) throws IOException { @@ -223,7 +225,7 @@ public void collect(int segDoc) throws IOException { SortedDocValues values = null; HashMap segOrdinalValueCache; // avoid repeated lookups of the same ordinal, in this seg - @Override public boolean needsScores() { return false; } + @Override public ScoreMode scoreMode() { return ScoreMode.COMPLETE_NO_SCORES; } @Override protected void doSetNextReader(LeafReaderContext ctx) throws IOException { diff --git a/solr/core/src/java/org/apache/solr/search/facet/TermFrequencySlotAcc.java b/solr/core/src/java/org/apache/solr/search/facet/TermFrequencySlotAcc.java index 861ee2a88b20..68c79dcc9706 100644 --- a/solr/core/src/java/org/apache/solr/search/facet/TermFrequencySlotAcc.java +++ b/solr/core/src/java/org/apache/solr/search/facet/TermFrequencySlotAcc.java @@ -2,12 +2,11 @@ import java.io.IOException; import java.util.Arrays; -import java.util.Collections; import java.util.function.IntFunction; -import org.apache.solr.search.facet.SlotAcc.FuncSlotAcc; import org.apache.lucene.queries.function.ValueSource; import org.apache.solr.common.util.SimpleOrderedMap; +import org.apache.solr.search.facet.SlotAcc.FuncSlotAcc; public class TermFrequencySlotAcc extends FuncSlotAcc { private TermFrequencyCounter[] result; diff --git a/solr/core/src/java/org/apache/solr/update/processor/ConditionalUpsertProcessorFactory.java b/solr/core/src/java/org/apache/solr/update/processor/ConditionalUpsertProcessorFactory.java index b8c8278afcbf..6df13680fa37 100644 --- a/solr/core/src/java/org/apache/solr/update/processor/ConditionalUpsertProcessorFactory.java +++ b/solr/core/src/java/org/apache/solr/update/processor/ConditionalUpsertProcessorFactory.java @@ -116,14 +116,21 @@ boolean isLeader(UpdateCommand cmd) { if (phase == DistributedUpdateProcessor.DistribPhase.FROMLEADER) { return false; } - return distribProc.isLeader(cmd); + distribProc.setupRequest(cmd); + return distribProc.isLeader(); } @Override public void processAdd(AddUpdateCommand cmd) throws IOException { if (!ignoreConditionalUpserts && !conditions.isEmpty() && isLeader(cmd)) { BytesRef indexedDocId = cmd.getIndexedId(); - SolrInputDocument oldDoc = RealTimeGetComponent.getInputDocument(core, indexedDocId); + SolrInputDocument oldDoc = RealTimeGetComponent.getInputDocument( + core, + indexedDocId, + indexedDocId, + null, + null, + RealTimeGetComponent.Resolution.DOC); SolrInputDocument newDoc = cmd.getSolrInputDocument(); if (!UpsertCondition.shouldInsertOrUpsert(conditions, oldDoc, newDoc)) { return;