Dawid PR
Dawid PR

Reputation: 127

Neo4j - search like query with non english characters

Is there an option in neo4j to write a select query with where clause, that ignores non-latin characters ?

MATCH (places:Place)
WHERE (places.name =~ '.*(?ui)Fabergé.*')
RETURN places

I have place with Fabergé name in graph and i want to find it when user type Fabergé or Faberge without this special character.

Upvotes: 0

Views: 436

Answers (1)

Stefan Armbruster
Stefan Armbruster

Reputation: 39915

I'm not aware of an easy way to do this directly with a regex match in Cypher.

One possible workaround is to store the string in question in a normalized form in a second property e.g. place.name_normalized and then compare it with the normalized search string. Of course normalization needs to be done on client side, see another SO question on how to achive this: Remove diacritical marks (ń ǹ ň ñ ṅ ņ ṇ ṋ ṉ ̈ ɲ ƞ ᶇ ɳ ȵ) from Unicode chars

Upvotes: 1

Related Questions