MATCH(cw:commonWords)-[theEdge]->(story:theStory)
WHERE cw.text IN ['tools','sell']
WITH collect(cw) AS cws, story
WHERE size(cws) > 1
UNWIND cws AS cw
RETURN cw, story
MATCH (cw:commonWords)-[:commonWordsInStory]->(story:theStory)
WHERE cw.text IN ['tools', 'sell']
WITH story, COLLECT(cw) AS commonWords
WHERE SIZE(commonWords) > 1
RETURN story, commonWords
如果你想在单独的一行中返回每个常用单词,只需将上面的RETURN子句替换为:
...
UNWIND commonWords AS commonWord
RETURN story, commonWord
2条答案
按热度按时间ercv8c1e1#
一种选择是:
其中,使用此示例数据:
退货:
js5cn81o2#
要过滤掉传入
commonWordsInStory
关系少于2个的story
节点(并返回每个结果story
沿着常用词列表):如果你想在单独的一行中返回每个常用单词,只需将上面的
RETURN
子句替换为: