mirror of https://github.com/apache/lucene.git
Make sure there is at least one document when testing expression dictionary with deletes
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1544224 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8f08d90bb0
commit
a5c6c6ddd6
|
@ -151,7 +151,7 @@ public class DocumentExpressionDictionaryTest extends LuceneTestCase {
|
||||||
Random rand = random();
|
Random rand = random();
|
||||||
List<String> termsToDel = new ArrayList<>();
|
List<String> termsToDel = new ArrayList<>();
|
||||||
for(Document doc : docs.values()) {
|
for(Document doc : docs.values()) {
|
||||||
if(rand.nextBoolean()) {
|
if(rand.nextBoolean() && termsToDel.size() < docs.size()-1) {
|
||||||
termsToDel.add(doc.get(FIELD_NAME));
|
termsToDel.add(doc.get(FIELD_NAME));
|
||||||
}
|
}
|
||||||
writer.addDocument(doc);
|
writer.addDocument(doc);
|
||||||
|
@ -174,6 +174,7 @@ public class DocumentExpressionDictionaryTest extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
IndexReader ir = DirectoryReader.open(dir);
|
IndexReader ir = DirectoryReader.open(dir);
|
||||||
|
assertTrue("NumDocs should be > 0 but was " + ir.numDocs(), ir.numDocs() > 0);
|
||||||
assertEquals(ir.numDocs(), docs.size());
|
assertEquals(ir.numDocs(), docs.size());
|
||||||
Set<SortField> sortFields = new HashSet<SortField>();
|
Set<SortField> sortFields = new HashSet<SortField>();
|
||||||
sortFields.add(new SortField(WEIGHT_FIELD_NAME_1, SortField.Type.LONG));
|
sortFields.add(new SortField(WEIGHT_FIELD_NAME_1, SortField.Type.LONG));
|
||||||
|
|
Loading…
Reference in New Issue