使用IN运算符的Cypher无效查询导致CypherTypeException但Java驱动程序吞下它

时间:2013-09-04 09:23:21

标签: neo4j cypher

这是在 Cypher 1.8.2

我有以下查询可以正常工作:

START person=node:personsindex('*:*') 
WHERE person.name IN ['Peter', 'Michael'] 
RETURN  person;

在Java中运行时,使用:

import org.neo4j.cypher.javacompat.ExecutionEngine;
import org.neo4j.cypher.javacompat.ExecutionResult;
....
ExecutionEngine engine...
ExecutionResult result = this.engine.execute(query);

如果我的图表中有数据,我会得到结果:

assertEquals("Columns :", 1, result.columns().size());
Iterator<Node> personNodes = result.columnAs("person");
assertTrue("Should have some results", personNodes.hasNext())

如果我的查询变为:

START person=node:personsindex('*:*') 
WHERE person.name IN 'Peter' // I know I should not do it like this
RETURN  person;

我在shell上遇到以下异常,这很好:

CypherTypeException: Literal expected to be of type Collection but it is of type String

但是当我在Java中运行它时,吞下了异常并且我得到了一个columnSet, 但没有数据:

ExecutionResult result = this.engine.execute(query);

assertEquals("Columns :", 1, result.columns().size());
Iterator<Node> personNodes = result.columnAs("person");
assertFalse("No results", personNodes.hasNext())

这是预期的行为吗?

0 个答案:

没有答案