提交 e2c97b6b 编写于 作者: M Michael Hunger

fix issue with repeated call to apoc.index.addAllNodes

上级 4025fa64
......@@ -171,6 +171,9 @@ public class FreeTextSearch {
log.info("Dropping existing index '%s', with config: %s", index, config);
old.delete();
}
tx.success();
}
try (Transaction tx = db.beginTx()) {
Map<String, String> config = new HashMap<>(CONFIG);
config.put("labels", escape(structure.keySet()));
for (Map.Entry<String, List<String>> entry : structure.entrySet()) {
......
......@@ -92,6 +92,17 @@ public class FreeTextSearchTest {
assertSingleNode("stuff", termQuery("London"), hasProperty("name", "London"), hasLabel("City"));
}
@Test
public void shouldHandleRepeatedCalls() throws Exception {
// given
execute("CREATE (:Person{name:'George Goldman', nick:'GeeGee'}), (:Person{name:'Cyrus Jones', age:103})");
execute("CALL apoc.index.addAllNodes('people', {Person:['name','nick']})");
execute("CALL apoc.index.addAllNodes('people', {Person:['name','nick']})");
// then
assertSingle(search("people", "GeeGee"), hasProperty("name", "George Goldman"));
assertSingle(search("people", "Jones"), hasProperty("name", "Cyrus Jones"));
}
@Test
public void shouldQueryFreeTextIndex() throws Exception {
// given
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册