Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-12-2020 02:12 AM
Hello,
I have a a database that contains articles, topic nodes and keyword nodes.
Keyword has a relationship with topic nodes.
I would like to create a relationship between articles nodes and topics nodes.
Something like this: (:ARTICLE)-->(:TOPIC)
I would like to create this relationship only if a keyword related to a topic appears in an article with full text search.
Is it possible to apply full text search on articles nodes and next create a relation between topics and article nodes with Cypher requests ? Maybe it is better to use CONTAINS keyword instead of full search ?
11-12-2020 04:10 AM
Sure, that's no problem. You'll need a full text index of course, and the solution might look something like this:
WITH 'economy' as keyword
MATCH (t:Topic { name: keyword })
WITH t
CALL db.index.fulltext.queryNodes("articleKeywords", keyword) YIELD node, score
CREATE (node)-[:TALKS_ABOUT]->(t)
11-12-2020 06:31 AM
Thank you @david.allen. If I want to iterate throught several keyword with a variable can I do something like this ?
FOREACH $keyword IN TOPIC_NODE
WITH $keywork as keyword
MATCH (t:Topic { name: $keyword })
WITH t
CALL db.index.fulltext.queryNodes("articleKeywords", keyword) YIELD node, score
CREATE (node)-[:TALKS_ABOUT]->(t)
11-12-2020 07:10 AM
not that syntax, but that idea, yes. Something like this:
MATCH (t:Topic)
WITH t.name as keyword
(... rest of query here ....)
All the sessions of the conference are now available online