From 02c9e2a6e44c5522d2589bf926d7da4ea9dd49ad Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Tue, 27 Jul 2021 22:25:26 +0300 Subject: [PATCH] Fix incorrect assertions in CollapsingTopDocsCollectorSearchAfterTests These assertions were simply wrong, but took time to catch as they were very rarely triggered. 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 dcd2c9607c5d5..eb2a7becef4f8 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();