Apache Lucene open-source search software
Make sure there is at least one document when testing expression dictionary with deletes
Simon Willnauera5c6c6ddd679
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.javaindex 4cc719662a4..448d6b5ff8b 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@@ -151,7 +151,7 @@ public class DocumentExpressionDictionaryTest extends LuceneTestCase {Random rand = random();List<String> termsToDel = new ArrayList<>();for(Document doc : docs.values()) {- if(rand.nextBoolean()) {+ if(rand.nextBoolean() && termsToDel.size() < docs.size()-1) {termsToDel.add(doc.get(FIELD_NAME));}writer.addDocument(doc);@@ -174,6 +174,7 @@ public class DocumentExpressionDictionaryTest extends LuceneTestCase {}IndexReader ir = DirectoryReader.open(dir);+ assertTrue("NumDocs should be > 0 but was " + ir.numDocs(), ir.numDocs() > 0);assertEquals(ir.numDocs(), docs.size());Set<SortField> sortFields = new HashSet<SortField>();sortFields.add(new SortField(WEIGHT_FIELD_NAME_1, SortField.Type.LONG));