0

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.

Dawid PR
  • 117
  • 9

1 Answers1

1

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

Community
  • 1
  • 1
Stefan Armbruster
  • 39,465
  • 6
  • 87
  • 97
  • so there is no option like in sql: COLLATE utf8_general_ci or any similar ? – Dawid PR Nov 26 '15 at 09:36
  • do you know maybe how to do it with regex ? or how can i use regex in Cypher query (because regex is not a problem, but don't know how can i use it in Cypher) ? Because giving place with normalized name it's not good workaraound especially when place will have name with more then one non english character, for example: Fébérgé. Normalize name will be Feberge but if user will type Febergé there will be no results :/ – Dawid PR Nov 27 '15 at 09:08