【发布时间】:2020-01-01 09:32:36
【问题描述】:
我有一个带有 indexed 属性 name 的以下 Spring Data Neo4j(3.4.0.RELEASE) 实体:
@NodeEntity
public class Decision {
@Indexed
private String name;
....
我需要通过name 属性实现不区分大小写的搜索。
在我的DecisionRepository 中,我创建了以下方法:
@Query("MATCH (d:Decision) WHERE d.name =~ '(?i){name}' RETURN d")
Decision findByNameIgnoreCase(@Param("name") String name);
但执行后我得到以下异常:
org.springframework.dao.InvalidDataAccessApiUsageException: Illegal repetition near index 3
(?i){name}
^; nested exception is java.util.regex.PatternSyntaxException: Illegal repetition near index 3
(?i){name}
^
如何对 name 属性进行正确的不区分大小写的搜索?
【问题讨论】:
标签: neo4j cypher spring-data-neo4j