From e5bceb4086ff2ab17236803668959ead43f2db1b Mon Sep 17 00:00:00 2001 From: Benjamin Trent Date: Wed, 7 Feb 2024 12:55:55 -0500 Subject: [PATCH] Fix TestTopFieldCollector.testTotalHits #13080 (#13081) --- .../org/apache/lucene/search/TestTopFieldCollector.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lucene/core/src/test/org/apache/lucene/search/TestTopFieldCollector.java b/lucene/core/src/test/org/apache/lucene/search/TestTopFieldCollector.java index 47c0d50a55a..6662cf0c222 100644 --- a/lucene/core/src/test/org/apache/lucene/search/TestTopFieldCollector.java +++ b/lucene/core/src/test/org/apache/lucene/search/TestTopFieldCollector.java @@ -31,6 +31,7 @@ import org.apache.lucene.document.TextField; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; +import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.NoMergePolicy; import org.apache.lucene.index.Term; @@ -180,7 +181,12 @@ public class TestTopFieldCollector extends LuceneTestCase { Sort sort = new Sort(new SortField("foo", SortField.Type.LONG)); IndexWriter w = new IndexWriter( - dir, newIndexWriterConfig().setMergePolicy(NoMergePolicy.INSTANCE).setIndexSort(sort)); + dir, + newIndexWriterConfig() + .setMergePolicy(NoMergePolicy.INSTANCE) + .setIndexSort(sort) + .setMaxBufferedDocs(7) + .setRAMBufferSizeMB(IndexWriterConfig.DISABLE_AUTO_FLUSH)); Document doc = new Document(); doc.add(new NumericDocValuesField("foo", 3)); for (Document d : Arrays.asList(doc, doc, doc, doc)) {