diff --git a/lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java b/lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java index ee15b14f303..c06f26849f0 100644 --- a/lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java +++ b/lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java @@ -24,7 +24,6 @@ import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexReader; -import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.index.RandomIndexWriter; import org.apache.lucene.index.Term; @@ -57,6 +56,11 @@ public class DuplicateFilterTest extends LuceneTestCase { addDoc(writer, "http://www.bar.com", "Dog uses Lucene", "20050101"); addDoc(writer, "http://lucene.apache.org", "Lucene 2.0 out", "20050101"); addDoc(writer, "http://lucene.apache.org", "Oops. Lucene 2.1 out", "20050102"); + + // Until we fix LUCENE-2348, the index must + // have only 1 segment: + writer.optimize(); + reader = writer.getReader(); writer.close(); searcher =new IndexSearcher(reader); diff --git a/lucene/src/test/org/apache/lucene/index/RandomIndexWriter.java b/lucene/src/test/org/apache/lucene/index/RandomIndexWriter.java index d58e1fcf858..5853dd3b126 100644 --- a/lucene/src/test/org/apache/lucene/index/RandomIndexWriter.java +++ b/lucene/src/test/org/apache/lucene/index/RandomIndexWriter.java @@ -108,6 +108,10 @@ public class RandomIndexWriter implements Closeable { } w.close(); } + + public void optimize() throws IOException { + w.optimize(); + } class RandomCodecProvider extends CodecProvider { final String codec;