From f082ebc14e6afa80ad50dc0bd3996ff7ea11b8c9 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Tue, 27 Jul 2021 18:23:50 +0300 Subject: [PATCH] Remove incorrect assertion in CollapsingTopDocsCollectorSearchAfterTests This assertion was simply wrong, but took time to catch as it was very rarely triggered. The test already checks the correct assertion at an earlier time. Fixes #75736. --- .../CollapsingTopDocsCollectorSearchAfterTests.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/src/test/java/org/apache/lucene/grouping/CollapsingTopDocsCollectorSearchAfterTests.java b/server/src/test/java/org/apache/lucene/grouping/CollapsingTopDocsCollectorSearchAfterTests.java index 10a9901dd28b6..347b99c332171 100644 --- a/server/src/test/java/org/apache/lucene/grouping/CollapsingTopDocsCollectorSearchAfterTests.java +++ b/server/src/test/java/org/apache/lucene/grouping/CollapsingTopDocsCollectorSearchAfterTests.java @@ -133,10 +133,11 @@ private > void assertSearchCollapse(CollapsingDocValuesP currentValue = fieldDoc.fields[0]; } - if (docsWithMissingField == false) { - assertEquals(expectedNumGroups, collapseTopFieldDocs.scoreDocs.length - 1); - assertEquals(topDocs.scoreDocs.length - 1, topDocsIndex); + for (; topDocsIndex < topDocs.scoreDocs.length; topDocsIndex++) { + FieldDoc fieldDoc = (FieldDoc) topDocs.scoreDocs[topDocsIndex]; + assertEquals(fieldDoc.fields[0], currentValue); } + w.close(); reader.close(); dir.close();