当我运行下面的查询时 查询1正在生成结果,返回所有文档的文档的所有类别标签。请注意,文档可以有多个类别,因此可以随时收集它们。
START doc = node:entities(type = "document-link")
MATCH category-[:category]-doc<-[:`document-link`]-id
RETURN
doc.title as title,
COLLECT(COALESCE(category.category, "")) as categories
查询2正在为所有文档生成文档的结果返回语言。文档只能有一种语言类型。
START doc = node:entities(type = "document-link")
MATCH lan-[:language]-doc<-[:`document-link`]-id
RETURN
doc.title as title,
lan.language as language
查询3是1和2的连接产生空结果。有人可以突出我做错了吗?
START doc = node:entities(type = "document-link")
MATCH category-[:category]-lan-[:language]-doc<-[:`document-link`]-id
RETURN
doc.title as title,
lan.language as language,
COLLECT(COALESCE(category.category, "")) as categories
答案 0 :(得分:1)
在您的第三个查询中,您匹配类别和语言之间的关系,您在前2个查询中不会这样做。怎么样:
START doc = node:entities(type = "document-link")
MATCH category-[:category]-doc<-[:`document-link`]-id
MATCH doc-[:language]-lan
RETURN
doc.title as title,
lan.language as language,
COLLECT(COALESCE(category.category, "")) as categories