I’m trying to build a recipe finder app (PERN stack) like SuperCook but I ran into some problems with my postgres table.
Short description of the desired result. I’d like the user to select some ingredients and return recipes that can be made only using those ingredients.
I imported using pgadmin the table from Recipe Dataset and setup my nodejs server and routes.
My problem is that I can’t figure out how I can return recipes that contain only the selected ingredients.
WHERE, LIKE and logic operators can’t help me as far as I know (but I’m a beginner so I don’t know too much) because using them will return me recipes that contain the selected ingredients + any other ingredient.
The only column we care about for a problem like this is the NER column because it contains the ingredients only. I saw that they are written like a javascript object, for example:
"[""sesame seed"", ""soy sauce"", ""honey"", ""vegetable cooking spray"", ""thin green onion strips"", ""grated ginger"", ""chicken""]"
appearing in pgAdmin like this: ["sesame seed", "soy sauce", "honey", "vegetable cooking spray", "thin green onion strips", "grated ginger", "chicken"]
Question: How can I select from my table only the recipes that contain EXACTLY the selected ingredients or at least a COMBINATION of them IN NO PARTICULAR ORDER?
For example:
INPUT: chicken, butter, onion, garlic
OUTPUT: recipe with NER: ["butter", "chicken", "garlic", "onion"]
OR recipe with NER: ["butter", "chicken"]
OR recipe with NER: ["garlic", "chicken"]
etc.