SOLR-2492 -- DIH does not commit if only deletes are processed

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1145925 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2011-07-13 09:15:55 +00:00
parent 4e198e8caf
commit dddbb9c0a0
3 changed files with 18 additions and 1 deletions

View File

@ -14,7 +14,10 @@ $Id$
================== 3.4.0-dev ==============
Bug Fixes
----------------------
* SOLR-2644: When using threads=2 the default logging is set too high (Bill Bell via shalin)
* SOLR-2492: DIH does not commit if only deletes are processed (James Dyer via shalin)
================== 3.3.0 ==================

View File

@ -703,20 +703,24 @@ public class DocBuilder {
Collection collection = (Collection) value;
for (Object o : collection) {
writer.deleteDoc(o.toString());
importStatistics.deletedDocCount.incrementAndGet();
}
} else {
writer.deleteDoc(value);
importStatistics.deletedDocCount.incrementAndGet();
}
}
}
value = arow.get("$deleteDocByQuery");
if (value != null) {
if (value instanceof Collection) {
Collection collection = (Collection) value;
for (Object o : collection) {
writer.deleteByQuery(o.toString());
importStatistics.deletedDocCount.incrementAndGet();
}
} else {
writer.deleteByQuery(value.toString());
importStatistics.deletedDocCount.incrementAndGet();
}
}
value = arow.get("$docBoost");

View File

@ -225,6 +225,16 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase {
assertTrue("Update request processor processDelete was not called", TestUpdateRequestProcessor.processDeleteCalled);
assertTrue("Update request processor finish was not called", TestUpdateRequestProcessor.finishCalled);
MockDataSource.clearCache();
rows = new ArrayList();
rows.add(createMap("$deleteDocById", "3"));
MockDataSource.setIterator("select * from x", rows.iterator());
runFullImport(dataConfigForSkipTransform, createMap("clean","false"));
assertQ(req("id:3"), "//*[@numFound='0']");
assertTrue("Update request processor processDelete was not called", TestUpdateRequestProcessor.processDeleteCalled);
assertTrue("Update request processor finish was not called", TestUpdateRequestProcessor.finishCalled);
}
@Test