mirror of
https://github.com/apache/lucene.git
synced 2025-02-28 21:39:25 +00:00
SOLR-1059 followup -- Adding a test for delete doc functionality using the special flag variables
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@756130 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c26c959710
commit
09100e8c0c
@ -184,6 +184,35 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTest {
|
||||
assertQ(req("name_s:xyz"), "//*[@numFound='1']");
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testDeleteDocs() throws Exception {
|
||||
List rows = new ArrayList();
|
||||
rows.add(createMap("id", "1", "desc", "one"));
|
||||
rows.add(createMap("id", "2", "desc", "two"));
|
||||
rows.add(createMap("id", "3", "desc", "two", "$deleteDocById", "2"));
|
||||
MockDataSource.setIterator("select * from x", rows.iterator());
|
||||
|
||||
super.runFullImport(dataConfigForSkipTransform);
|
||||
|
||||
assertQ(req("id:1"), "//*[@numFound='1']");
|
||||
assertQ(req("id:2"), "//*[@numFound='0']");
|
||||
assertQ(req("id:3"), "//*[@numFound='1']");
|
||||
|
||||
MockDataSource.clearCache();
|
||||
rows = new ArrayList();
|
||||
rows.add(createMap("id", "1", "desc", "one"));
|
||||
rows.add(createMap("id", "2", "desc", "one"));
|
||||
rows.add(createMap("id", "3", "desc", "two", "$deleteDocByQuery", "desc:one"));
|
||||
MockDataSource.setIterator("select * from x", rows.iterator());
|
||||
|
||||
super.runFullImport(dataConfigForSkipTransform);
|
||||
|
||||
assertQ(req("id:1"), "//*[@numFound='0']");
|
||||
assertQ(req("id:2"), "//*[@numFound='0']");
|
||||
assertQ(req("id:3"), "//*[@numFound='1']");
|
||||
}
|
||||
|
||||
public static class MockTransformer extends Transformer {
|
||||
public Object transformRow(Map<String, Object> row, Context context) {
|
||||
Assert.assertTrue("Context gave incorrect data source", context.getDataSource("mockDs") instanceof MockDataSource2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user