LUCENE-5635: fold in dv updates

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1591733 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2014-05-01 18:49:38 +00:00
parent 178b6b3f5e
commit 4a535e2a47
1 changed files with 5 additions and 3 deletions

View File

@ -90,12 +90,14 @@ public class TestIndexWriterExceptions2 extends LuceneTestCase {
doc.add(newStringField("id", Integer.toString(i), Field.Store.NO));
doc.add(new NumericDocValuesField("dv", i));
doc.add(newTextField("text1", TestUtil.randomAnalysisString(random(), 20, true), Field.Store.NO));
// TODO: sometimes update dv
try {
iw.addDocument(doc);
// we made it, sometimes delete our doc
if (random().nextInt(4) == 0) {
// we made it, sometimes delete our doc, or update a dv
int thingToDo = random().nextInt(4);
if (thingToDo == 0) {
iw.deleteDocuments(new Term("id", Integer.toString(i)));
} else if (thingToDo == 1 && defaultCodecSupportsFieldUpdates()){
iw.updateNumericDocValue(new Term("id", Integer.toString(i)), "dv", i+1L);
}
} catch (Exception e) {
if (e.getMessage() != null && e.getMessage().startsWith("Fake IOException")) {