diff --git a/lucene/suggest/src/test/org/apache/lucene/search/suggest/DocumentExpressionDictionaryTest.java b/lucene/suggest/src/test/org/apache/lucene/search/suggest/DocumentExpressionDictionaryTest.java index 67d0cde4332..a8c28df2eee 100644 --- a/lucene/suggest/src/test/org/apache/lucene/search/suggest/DocumentExpressionDictionaryTest.java +++ b/lucene/suggest/src/test/org/apache/lucene/search/suggest/DocumentExpressionDictionaryTest.java @@ -36,6 +36,7 @@ import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.index.RandomIndexWriter; +import org.apache.lucene.index.SlowCompositeReaderWrapper; import org.apache.lucene.index.Term; import org.apache.lucene.search.SortField; import org.apache.lucene.search.spell.Dictionary; @@ -83,7 +84,10 @@ public class DocumentExpressionDictionaryTest extends LuceneTestCase { } writer.commit(); writer.close(); - IndexReader ir = DirectoryReader.open(dir); + // TODO: once we fix DocumentExpressionDictionary to + // accept readers with more than one segment, we can + // remove this wrapping: + IndexReader ir = SlowCompositeReaderWrapper.wrap(DirectoryReader.open(dir)); Set sortFields = new HashSet(); sortFields.add(new SortField(WEIGHT_FIELD_NAME_1, SortField.Type.LONG)); sortFields.add(new SortField(WEIGHT_FIELD_NAME_2, SortField.Type.LONG)); @@ -117,7 +121,10 @@ public class DocumentExpressionDictionaryTest extends LuceneTestCase { } writer.commit(); writer.close(); - IndexReader ir = DirectoryReader.open(dir); + // TODO: once we fix DocumentExpressionDictionary to + // accept readers with more than one segment, we can + // remove this wrapping: + IndexReader ir = SlowCompositeReaderWrapper.wrap(DirectoryReader.open(dir)); Set sortFields = new HashSet(); sortFields.add(new SortField(WEIGHT_FIELD_NAME_1, SortField.Type.LONG)); sortFields.add(new SortField(WEIGHT_FIELD_NAME_2, SortField.Type.LONG)); @@ -171,7 +178,10 @@ public class DocumentExpressionDictionaryTest extends LuceneTestCase { assertTrue(null!=docs.remove(termToDel)); } - IndexReader ir = DirectoryReader.open(dir); + // TODO: once we fix DocumentExpressionDictionary to + // accept readers with more than one segment, we can + // remove this wrapping: + IndexReader ir = SlowCompositeReaderWrapper.wrap(DirectoryReader.open(dir)); assertEquals(ir.numDocs(), docs.size()); Set sortFields = new HashSet(); sortFields.add(new SortField(WEIGHT_FIELD_NAME_1, SortField.Type.LONG));