【发布时间】:2015-08-07 09:11:27
【问题描述】:
只是一个快速简单的方法,我需要能够搜索我们的数据库减去区分大小写,我知道该怎么做,只是不使用 Neo4jClient。代码如下:
client.Cypher
.Match("(person:Person)")
.Where((Person person) => person.Email == search)
其中“搜索”是传递给方法的字符串类型参数。我已经读过使用 =~ '(?i)text' 有效,但这不允许我传递参数,我已经尝试过:
client.Cypher
.Match("(person:Person)")
.Where((Person person) => person.Email =~ "(?i){terms}")
.WithParam("terms",search)
但它不喜欢这样。
我希望能够在不区分大小写的情况下进行搜索,如果可能的话,同时使用 LIKE(或 ILIKE,因为它似乎用于模式匹配)。
谢谢
编辑和回答 最后的代码是这样的:
return client.Cypher
.Match("(person:Person)")
.Where("person.Email =~ {terms}")
.OrWhere("person.Name =~ {terms}")
.WithParam("terms", "(?ui).*" + search + ".*")
.Return<Person>("person").Results.ToList();
这正是我想要的。 还接受了值在的小写字段的建议,我们已经在帐户中有一个,因此登录名不区分大小写,我将在电子邮件和姓名字段上执行此操作,似乎比使用 toLower() (在 Cypher 或 C# 中)
感谢@Stefan Armbruster 的帮助。
【问题讨论】:
标签: neo4j neo4jclient