Neo4j Cypher无法匹配字符串括号
我有一个包含员工数据的Neo4J数据库。每个员工都包含一个姓名和部门。 某些部门名称在db中的字符串文字中包含括号 例如 我需要搜索部门与用户搜索字符串完全匹配的员工。也就是说,如果有人用“人力资源(招聘)”搜索,那么我应该在搜索结果中获得上述员工的记录。如果搜索不完全匹配,我不需要结果中的员工记录 我试着按照密码查询,但不起作用Neo4j Cypher无法匹配字符串括号,neo4j,cypher,Neo4j,Cypher,我有一个包含员工数据的Neo4J数据库。每个员工都包含一个姓名和部门。 某些部门名称在db中的字符串文字中包含括号 例如 我需要搜索部门与用户搜索字符串完全匹配的员工。也就是说,如果有人用“人力资源(招聘)”搜索,那么我应该在搜索结果中获得上述员工的记录。如果搜索不完全匹配,我不需要结果中的员工记录 我试着按照密码查询,但不起作用 Match (e: Employee) where e.department = "Human Resources (Recruitment)" return e
Match (e: Employee) where e.department = "Human Resources (Recruitment)" return e
如果我用CONTAINS替换=它可以正常工作,但我需要精确匹配,而不是部分匹配。我已经尝试过以下方法,但似乎没有任何效果
Match (e: Employee) where e.department = '"Human Resources (Recruitment)'" return e
Match (e: Employee) where e.department = "Human Resources \(Recruitment\)" return e
Match (e: Employee) where e.department = "`Human Resources (Recruitment)`" return e
我们将非常感谢您的帮助 效果非常好:
我运行这些,所有的工作
create (:Employee { name: "abcd", department: "Human Resources (Recruitment)" });
MATCH (n:Employee) RETURN n LIMIT 25;
match (e:Employee { department: "Human Resources (Recruitment)" }) return *;
match (e:Employee) where e.department: "Human Resources (Recruitment)" return *;
create index on :Employee(department);
match (e:Employee) where e.department = "Human Resources (Recruitment)" return *
它应该是现成的。您对该值有索引/约束吗?您的第一个查询是有效的,应该可以工作。我刚刚创建了相同的节点,您的查询返回了有效的结果。你确定部门字段中没有不可见字符、空格字符之类的垃圾吗?
create (:Employee { name: "abcd", department: "Human Resources (Recruitment)" });
MATCH (n:Employee) RETURN n LIMIT 25;
match (e:Employee { department: "Human Resources (Recruitment)" }) return *;
match (e:Employee) where e.department: "Human Resources (Recruitment)" return *;
create index on :Employee(department);
match (e:Employee) where e.department = "Human Resources (Recruitment)" return *