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:
Simon Willnauer 2013-11-21 15:50:47 +00:00
parent 8f08d90bb0
commit a5c6c6ddd6
1 changed files with 2 additions and 1 deletions

View File

@ -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));