Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-21-2022 11:59 AM
I have text data that I would like to allow both upper and lower case letters. But want to ignore case when doing merge operations.
For example, how do I apply toLower to o.name before it is compared to $name?
MERGE (u)-[:ACCESS]-(o:Object {name: toLower($name)})
Solved! Go to Solution.
10-21-2022 12:28 PM
You can approach it two ways that I can think of. I am assuming the Object node exists, as 'where' can not be used with "merge."
MATCH (o:Object)
WHERE toLower(o.name) = toLower($name)
MERGE (u)-[:ACCESS]-(o)
return u, o
or, with regex pattern
MATCH (o:Object)
WHERE o.name =~ "(?i)" + $name
MERGE (u)-[:ACCESS]-(o)
return u, o
10-21-2022 12:28 PM
You can approach it two ways that I can think of. I am assuming the Object node exists, as 'where' can not be used with "merge."
MATCH (o:Object)
WHERE toLower(o.name) = toLower($name)
MERGE (u)-[:ACCESS]-(o)
return u, o
or, with regex pattern
MATCH (o:Object)
WHERE o.name =~ "(?i)" + $name
MERGE (u)-[:ACCESS]-(o)
return u, o
10-24-2022 03:13 PM
Thanks, I ended up using an optional match followed by an apoc.do.when on the object to simulate a merge with
WHERE toLower(o.name) = toLower($name)
All the sessions of the conference are now available online