为什么这个 neo4j-ogm 代码会生成 'invalid syntax'?

Why is this neo4j-ogm code producing 'invalid syntax'?

我有一些 spring-data-neo4j / ogm 代码意外失败。

public Member loadMemberBySocialMediaAccount(String connectionKey) {
        String[] connectionKeyParts = connectionKey.split(":");
        Filters filters = new Filters()
                .add(new Filter("providerId", connectionKeyParts[0]))
                .add(new Filter("providerUserId", connectionKeyParts[1]));
        Iterator<SocialMediaAccount> socialMediaAccounts = session.loadAll(SocialMediaAccount.class, filters, 2).iterator();
        return socialMediaAccounts.hasNext() ? socialMediaAccounts.next().getMember() : null;
}

当我深入研究 ogm 代码时,我可以看到抛出了以下异常。这是预期的吗?

org.neo4j.ogm.session.result.ResultProcessingException: "errors":[{"code":"Neo.ClientError.Statement.InvalidSyntax","message":"Invalid input 'n': expected whitespace, comment, '.', node labels, '[', \"=~\", IN, IS, '^', '*', '/', '%', '+', '-', '<', '>', \"<=\", \">=\", '=', \"<>\", \"!=\", AND, XOR, OR, LOAD CSV, START, MATCH, UNWIND, MERGE, CREATE, SET, DELETE, REMOVE, FOREACH, WITH, RETURN, UNION, ';' or end of input (line 1, column 72 (offset: 71))\n\"MATCH (n:`SocialMediaAccount`) WHERE n.`providerId` = { `providerId` } n.`providerUserId` = { `providerUserId` } WITH n MATCH p=(n)-[*0..2]-(m) RETURN p, ID(n)\"\n                                                                        ^"}]}

刚刚检查了测试,预期的是除第一个过滤器之外的所有过滤器都必须定义 BooleanOperator(AND 或 OR)。

所以在你的情况下:

Filters filters = new Filters()
                .add(new Filter("providerId", connectionKeyParts[0]));
Filter providerUserIdFilter = new Filter("providerUserId", connectionKeyParts[1]);
providerUserIdFilter.setBooleanOperator(BooleanOperator.AND);
filters.add(providerUserIdFilter);

我已经打开 https://github.com/neo4j/neo4j-ogm/issues/73 让我们弄清楚将后续过滤器的 BooleanOperator 默认为 AND 是否可行。