Recipe Search by Name or Ingredients

Search for recipes by their name or by ingredients

Use searchRecipeByNameOrIngredient to find recipes that contain the query string in the name or in the ingredient list. This search is a variation of the recipe search query. This returns back 2 lists of compliant and non-compliant foods.

This query returns two lists of results:

onPlan and otherResults each with a list of the recipe objects.

  • onPlan list which represents recipes that comply with the user's program and food preferences/restrictions.

  • otherResults list represents other recipes that match the query but don't comply with the user's program or the user's food preferences.

The main difference between this search and recipeSearch is that this search returns two sets of results, as explained above.

Arguments

Argument Name

Required

Type

Description

searchRecipeByNameOrIngredient

True

query

Search's query string. The query is case insensitive. For example, salmon or Salmon should retrieve the same information.

Examples

Search by name

In the following example, all the recipes that contain "salmon" or "salad" are searched. Within the query, use as many names or ingredients as required.

{
  searchRecipeByNameOrIngredient(query: "salmon salad") {
    onPlan {
      id
      name
      servingWeight
      author
    }
    otherResults {
      id
      name
      servingWeight
      author
    }
  }
}

Search by ingredients

In the following example, all the recipes that contain the ingredient "avocado" in their ingredient list are searched.

{
  searchRecipeByNameOrIngredient(query: "Avocado lemon") {
    onPlan {
      id
      name
      author
      adherence
      ingredients {
        name
      }
    }
    otherResults {
      id
      name
      author
      adherence
      ingredients {
        name
      }
    }
  }
}

Last updated