我有一个带有成分和配方的neo4j数据库:http://console.neo4j.org/?id=3o8y44我正在使用词干来简化搜索的成分名称。
我可以找到最接近包含给定成分列表的个别食谱,如下所示:
WITH split("egg, sugar, milk, flour, salt, butter",", ") as terms UNWIND
terms as term MATCH (stem:Stem {stem:term})-[:STEM_OF]->
(ingredient:Ingredient)-[lst:INGREDIENTS_LIST]->(r:Recipe) WITH r,
size(terms) - count(distinct stem) as notCovered, sum(lst.weight) as weight,
collect(distinct stem.stem) as matched RETURN r , notCovered,matched, weight
ORDER BY notCovered ASC, weight DESC
我想要的是返回一组食谱,这些食谱一起包含成分列表(不包括单独包含整个列表的食谱)。所以,使用相同的成分:
"egg, sugar, milk, flour, salt, butter"
因此我期待:“扁平面包”,“Gogel-Mogel”
其成分一起列出成分:(鸡蛋,糖)+(牛奶,面粉,盐,黄油)。
这个查询是什么?