Skip to content

Apache Lucene open-source search software

LUCENE-5305: wrap reader as slow composite reader, until we fix DocumentExpressionDictionary to accept composite readers

Michael McCandlessb6eab2b39aaf
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<SortField> sortFields = new HashSet<SortField>();
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<SortField> sortFields = new HashSet<SortField>();
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<SortField> sortFields = new HashSet<SortField>();
sortFields.add(new SortField(WEIGHT_FIELD_NAME_1, SortField.Type.LONG));