@Test
public void shouldUpdateIndexesWhenDeletingNodesInSource() {
loadContent(content);
// Make sure we're finding the results ...
QueryResults results = search(workspaceName1, "Toyota Prius", 10, 0);
assertThat(results, is(notNullValue()));
assertRowCount(results, 2);
Location location1 = (Location)(results.getTuples().get(0)[0]);
Location location2 = (Location)(results.getTuples().get(1)[0]);
assertThat(location1.getPath(), is(path("/Cars/Hybrid/Toyota Prius")));
assertThat(location2.getPath(), is(path("/Cars/Hybrid/Toyota Highlander")));
String query = "SELECT model, maker FROM __ALLNODES__ WHERE PATH() LIKE '/Cars[%]/Hy%/Toyota%' OR PATH() LIKE '/Cars[1]/Utility[1]/%'";
results = query(workspaceName1, query);
assertRowCount(results, 6);
content.useWorkspace(workspaceName1);
content.delete("/Cars/Hybrid/Toyota Prius");
// Make sure we don't find the 'Prius' anymore, but we still should find the 'Highlander' ...
results = search(workspaceName1, "Toyota Prius", 10, 0);
assertThat(results, is(notNullValue()));
assertRowCount(results, 1);
location1 = (Location)(results.getTuples().get(0)[0]);
assertThat(location1.getPath(), is(path("/Cars/Hybrid/Toyota Highlander")));
query = "SELECT model, maker FROM __ALLNODES__ WHERE PATH() LIKE '/Cars[%]/Hy%/Toyota%' OR PATH() LIKE '/Cars[1]/Utility[1]/%'";
results = query(workspaceName1, query);
assertRowCount(results, 5);