Apache Solr open-source search software
Revert "LUCENE-8996: maxScore was sometimes missing from distributed grouped responses."
Christine Poerschke3a3df4784089
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex 53601341129..3a1ae2341eb 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -227,9 +227,6 @@ Bug Fixessubclauses, and then pull SHOULD, MUST_NOT and FILTER visitors from it rather than fromthe parent. (Alan Woodward)-* LUCENE-8996: maxScore was sometimes missing from distributed grouped responses.- (Julien Massenet, Diego Ceccarelli, Christine Poerschke)-Other* LUCENE-8778 LUCENE-8911 LUCENE-8957: Define analyzer SPI names as static final fields and document the names in Javadocs.diff --git a/lucene/grouping/src/java/org/apache/lucene/search/grouping/TopGroups.java b/lucene/grouping/src/java/org/apache/lucene/search/grouping/TopGroups.javaindex 23e00dd4a2c..ae1daf87ac4 100644--- a/lucene/grouping/src/java/org/apache/lucene/search/grouping/TopGroups.java+++ b/lucene/grouping/src/java/org/apache/lucene/search/grouping/TopGroups.java@@ -80,19 +80,6 @@ public class TopGroups<T> {Avg,}- /**- * If either value is NaN then return the other value, otherwise- * return the greater of the two values by calling Math.max.- * @param a - one value- * @param b - another value- * @return ignoring any NaN return the greater of a and b- */- private static float nonNANmax(float a, float b) {- if (Float.isNaN(a)) return b;- if (Float.isNaN(b)) return a;- return Math.max(a, b);- }-/** Merges an array of TopGroups, for example obtained* from the second-pass collector across multiple* shards. Each TopGroups must have been sorted by the@@ -187,7 +174,7 @@ public class TopGroups<T> {shardTopDocs[shardIDX].scoreDocs[i].shardIndex = shardIDX;}- maxScore = nonNANmax(maxScore, shardGroupDocs.maxScore);+ maxScore = Math.max(maxScore, shardGroupDocs.maxScore);assert shardGroupDocs.totalHits.relation == Relation.EQUAL_TO;totalHits += shardGroupDocs.totalHits.value;scoreSum += shardGroupDocs.score;@@ -241,7 +228,7 @@ public class TopGroups<T> {mergedScoreDocs,groupValue,shardGroups[0].groups[groupIDX].groupSortValues);- totalMaxScore = nonNANmax(totalMaxScore, maxScore);+ totalMaxScore = Math.max(totalMaxScore, maxScore);}if (totalGroupCount != null) {diff --git a/lucene/grouping/src/test/org/apache/lucene/search/grouping/TopGroupsTest.java b/lucene/grouping/src/test/org/apache/lucene/search/grouping/TopGroupsTest.javaindex e160bf4f418..8fb661dbc79 100644--- a/lucene/grouping/src/test/org/apache/lucene/search/grouping/TopGroupsTest.java+++ b/lucene/grouping/src/test/org/apache/lucene/search/grouping/TopGroupsTest.java@@ -21,12 +21,16 @@ import org.apache.lucene.search.Sort;import org.apache.lucene.search.TotalHits;import org.apache.lucene.util.LuceneTestCase;+import org.junit.Ignore;+public class TopGroupsTest extends LuceneTestCase {+ @Ignore // https://issues.apache.org/jira/browse/LUCENE-8996public void testAllGroupsEmptyInSecondPass() {narrativeMergeTestImplementation(false, false, false, false);}+ @Ignore // https://issues.apache.org/jira/browse/LUCENE-8996public void testSomeGroupsEmptyInSecondPass() {narrativeMergeTestImplementation(false, false, false, true);narrativeMergeTestImplementation(false, false, true, false);