Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-27-2021 05:21 PM
Say I want nodes whoes fields are OPTIONALLY matching with text as well related nodes' fields are OPTIONALLY matching with the same text.
For example, I have node: Qualifications with name and description fields. I have node:Tag with tag field. Relation betwwen these 2 is (:Qalification)-[:TAGGED_AS]->(:Tag)
I need all Node:Qualification if qualification.name OR qualidication.description OR (if qualification is tagged, tag.tag) CONTAINS $text
I tried below. But it does not match if NO RELATION found.
match (q:Qualification)-[ta:TAGGED_AS]->(t:TAG), (q1:Qualification) WHERE (toLower(q.name) CONTAINS "derm" OR toLower(q.description) CONTAINS "derm" OR t.searchableTag CONTAINS "derm") AND (toLower(q1.name) CONTAINS "derm" OR toLower(q1.description) CONTAINS "derm") return q,ta,t,q1
07-28-2021 03:54 AM
Hi @vishalkpatel ,
I would rather suggest a UNION approach.
Something like next query should work:
MATCH (q:Qualification)
WHERE (toLower(q.name) CONTAINS "derm"
OR toLower(q.description) CONTAINS "derm" )
return q
UNION
MATCH (q:Qualification)-[:TAGGED_AS]->(t:Tag)
WHERE t.searchableTag CONTAINS "derm"
return q
Be aware of the fact that using toLower on query will prevent the planner from using indexes on those propierties.
Hoping to be useful,
H
All the sessions of the conference are now available online