From 98a527731db1ed87a17aed871295b020dcca3ff1 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Fri, 30 May 2014 10:44:58 +0000 Subject: [PATCH] LUCENE-5708: fix these tests to also 'mimic' previous IWC.clone git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1598543 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/lucene/index/TestBinaryDocValuesUpdates.java | 5 +++++ .../org/apache/lucene/index/TestNumericDocValuesUpdates.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/lucene/core/src/test/org/apache/lucene/index/TestBinaryDocValuesUpdates.java b/lucene/core/src/test/org/apache/lucene/index/TestBinaryDocValuesUpdates.java index cc7aab9a920..f579cf18e6e 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestBinaryDocValuesUpdates.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestBinaryDocValuesUpdates.java @@ -1093,6 +1093,7 @@ public class TestBinaryDocValuesUpdates extends LuceneTestCase { // change format conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())); + conf.setMergePolicy(NoMergePolicy.INSTANCE); // disable merges to simplify test assertions. conf.setCodec(new Lucene46Codec() { @Override public DocValuesFormat getDocValuesFormatForField(String field) { @@ -1369,6 +1370,10 @@ public class TestBinaryDocValuesUpdates extends LuceneTestCase { NRTCachingDirectory cachingDir = new NRTCachingDirectory(dir, 100, 1/(1024.*1024.)); conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())); + // we want a single large enough segment so that a doc-values update writes a large file + conf.setMergePolicy(NoMergePolicy.INSTANCE); + conf.setMaxBufferedDocs(Integer.MAX_VALUE); // manually flush + conf.setRAMBufferSizeMB(IndexWriterConfig.DISABLE_AUTO_FLUSH); writer = new IndexWriter(cachingDir, conf); writer.updateBinaryDocValue(new Term("id", "doc-0"), "val", toBytes(100L)); DirectoryReader reader = DirectoryReader.open(writer, true); // flush diff --git a/lucene/core/src/test/org/apache/lucene/index/TestNumericDocValuesUpdates.java b/lucene/core/src/test/org/apache/lucene/index/TestNumericDocValuesUpdates.java index eb2b0967b04..5467788b79c 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestNumericDocValuesUpdates.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestNumericDocValuesUpdates.java @@ -1075,6 +1075,7 @@ public class TestNumericDocValuesUpdates extends LuceneTestCase { // change format conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())); + conf.setMergePolicy(NoMergePolicy.INSTANCE); // disable merges to simplify test assertions. conf.setCodec(new Lucene46Codec() { @Override public DocValuesFormat getDocValuesFormatForField(String field) { @@ -1352,6 +1353,10 @@ public class TestNumericDocValuesUpdates extends LuceneTestCase { NRTCachingDirectory cachingDir = new NRTCachingDirectory(dir, 100, 1/(1024.*1024.)); conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())); + // we want a single large enough segment so that a doc-values update writes a large file + conf.setMergePolicy(NoMergePolicy.INSTANCE); + conf.setMaxBufferedDocs(Integer.MAX_VALUE); // manually flush + conf.setRAMBufferSizeMB(IndexWriterConfig.DISABLE_AUTO_FLUSH); writer = new IndexWriter(cachingDir, conf); writer.updateNumericDocValue(new Term("id", "doc-0"), "val", 100L); DirectoryReader reader = DirectoryReader.open(writer, true); // flush