Fix TestTopFieldCollector.testTotalHits #13080 (#13081)

This commit is contained in:
Benjamin Trent 2024-02-07 12:55:55 -05:00 committed by GitHub
parent 810e43c58a
commit e5bceb4086
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -31,6 +31,7 @@ import org.apache.lucene.document.TextField;
import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.NoMergePolicy; import org.apache.lucene.index.NoMergePolicy;
import org.apache.lucene.index.Term; 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)); Sort sort = new Sort(new SortField("foo", SortField.Type.LONG));
IndexWriter w = IndexWriter w =
new IndexWriter( 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(); Document doc = new Document();
doc.add(new NumericDocValuesField("foo", 3)); doc.add(new NumericDocValuesField("foo", 3));
for (Document d : Arrays.asList(doc, doc, doc, doc)) { for (Document d : Arrays.asList(doc, doc, doc, doc)) {