Intro
This what an existing query of mine looks like:
MATCH
(p:Person { id: $p_id })-[k1:`KNOWS`]->(person:Person)
WHERE (// some criteria)
MATCH
(person)-[work:`WORKED_AT`]->(company:Company)
WHERE (work.title contains “Product Manager" and work.start_date is not null)
WITH person, work
RETURN
DISTINCT person.full_name, work.title
The problem in the above query is that it is not case insensitive. So the above query fails if the actual title is product manager
in the database.
So we are trying to use full text search index. We created the index on the :work
relationship, and we verified that it works, for example the search of:
call db.index.fulltext.queryRelationships(“<indexName>”, “CEO”)
yield relationship return reltionship.title limit 10
would return stuff like:
CEO
Ceo
..etc
Question
How can I apply the above index search on the node search? For example:
MATCH
(p:Person { id: $p_id })-[k1:`KNOWS`]->(person:Person)
WHERE (// some criteria)
MATCH
(person)-[work:`WORKED_AT`]->(company:Company)
WHERE //apply the db.index.fulltext.queryRelationships here on :work somehow
WITH person, work
RETURN
DISTINCT person.full_name, work.title
toLower(work.title) contains "product manager"
? – Passionless