Recipe - Food - Nutrition

FREEMIUM
Verified
By David | Updated לפני 14 ימים | Food
Popularity

9.9 / 10

Latency

485ms

Service Level

100%

Health Check

N/A

Back to All Discussions

How to determine which ingredients matched a search result?

Rapid account: Nigelaclarke
nigelaclarke
לפני 7 שנים

I’m interested in searching for recipes based on ingredients and knowing which of my ingredients are included in the resulting recipe

Currently I’m using the 'Complex Recipe Search '
I can see how many ingredients were used, and how many I’m missing:

      "usedIngredientCount": 3,
       "missedIngredientCount": 5,

I’ve also set filling ingredients to true.

Sometimes it will say there are used ingredients but not list them

      "usedIngredientCount": 2,
      "usedIngredients": [],

Other times the resulting ingredient name won’t match the name that i searched for. Technically its the correct item, but it makes it really hard for me to work with.
For example, i wanted a recipe that includes ground beef and it found a recipe which included the following information

      "name": "ground beef chuck",
      "originalString": "1 1/2 lbs ground beef chuck (80% lean)",
      "metaInformation": [
        "80%",
        "lean",
        "( )"
      ],
      "extendedName": "80% lean ground beef chuck",

I cannot compare “ground beef” == “ground beef chuck” to figure out if the recipe actually includes ground beef.

TLDR: I know the number of ingredients that matched, the name of those ingredients according to your recipe, but I am unable to determine my submitted ingredients matched. Does that make sense?

Any idea how i could work around these problems?

Thanks

Rapid account: Spoonacular
spoonacular Commented לפני 7 שנים

Again, sorry for the long wait. You can parse your ingredients using this endpoint https://market.mashape.com/spoonacular/recipe-food-nutrition#parse-ingredients which will give you the ids from our end. With those you can reliably compare with the ids returned by the search.

Also I now included an array “unusedIngredients” which lists the ingredients from your query which did NOT match any ingredients in the matched recipe.

Best,
David

Rapid account: Spoonacular
spoonacular Commented לפני 7 שנים

Sorry for the long wait. I understood your problem and will look into it.

Rapid account: Nigelaclarke
nigelaclarke Commented לפני 7 שנים

To add an example use case that I’m looking to solve.

The user makes a list of ingredients they want in a recipe and clicks submit

Beside their list, I want to put a green or red icon indicating whether a given recipe includes the ingredient they specified

Join in the discussion - add comment below:

Login / Signup to post new comments