I have a Neo4j database where i have ingredient nodes and recipe nodes. One recipe is connected to many nodes, so, for a simple cheddar sandwich, the recipe node would be connected to bread and cheddar cheese. What i wanted to achieve is to query all the recipes that contain for example at least pepper and salt so if my recipe has pepper, salt and ham it would match. What i have tried following this example is:
WITH ['pepper', 'salt'] as ingredients
MATCH (i:Ingredient)-[:INGREDIENT_OF]->(r:Recipe)
WHERE i.name in ingredients
WITH r, size(ingredients) as inputCnt, count(DISTINCT i) as cnt
WHERE cnt = inputCnt
RETURN r;
But it only matches the recipes where the exact ingredients are only pepper and salt. How can i achieve this?