Filtering Recipes using Custom Labels
This topic comprehensively describes how you can use the Custom Labels filter to search recipes.
The custom labels filter is available while searching recipes, reading your feed, and generating a meal plan.
Custom Labels Filter Object
Here is how a custom_labels
filter object looks in JSON format:
Search Locations
You can filter recipes by matching custom labels:
in_recipe
in_recipe
The in_recipe
filter allows you to logically match the specified custom labels with the labels in recipe's custom label object.
in_ingredients
in_ingredients
The in_ingredients
filter allows you to logically match the specified custom labels with the labels in recipe's ingredients.
in_instruction_steps
in_instruction_steps
The in_instruction_steps
filter allows you to logically match the specified custom labels with the labels in recipe's instructions.
everywhere
everywhere
The everywhere
filter allows you to logically match the specified custom labels in all three locations inside a recipe definition -in_recipe
, in_ingredients
, and in_instruction_steps
.
Conditional Operators
Inside each filter you can use the following operators to define an array of custom labels to logically match data:
Operator | Description | Example |
| Allows you to use the OR operator to return those recipes that match with one or more specified custom labels. |
|
| Allows you to use the AND operator to return only those recipes that match with all the specified custom labels. |
|
| Allows you to exclude recipes that match with the specified custom labels. |
|
| Allows you to casually filter and boost the ranking of matched recipes in the search results. |
|
You can also combine multiple conditions within a single search if needed. Here is an example of how you can combine the conditions:
In this example, the search is going to implement the following logic while filtering recipes:
Find recipes with
Custom Label 1
orCustom Label 2
added either on the recipe level or inside its ingredients or instructions.Find recipes with
Custom Label 3
andCustom Label 4
added either on the recipe level or inside its ingredients or instructions.Exclude recipes with
Custom Label 5
andCustom Label 6
added either on the recipe level or inside its ingredients or instructions.Boost ranking of recipes matched with
Custom Label 3
in the search results.
Custom Label Definition
Each custom label is specified using the following parameters:
Parameter | Description |
| The custom label's group name. |
| A specific custom label name. This parameter is optional and can be skipped to filter recipes based on all the custom labels in the specified label group. |
For example, here is how the custom label filter is defined when you want to find recipes that have any of the custom labels that exist in Custom Label Group 1
added to their ingredients:
Example 1 - Filter sponsored recipes for translation
As a publisher, you publish sponsored recipe content in multiple languages and maintain and use custom labels on the recipe level related to the targeted languages for translation and to indicate the translation status. You also keep and use custom labels to indicate sponsored and unsponsored recipes. Now let's assume that you want to filter sponsored recipes that require translation in Korean and Japanese languages and exclude already translated recipes. Here is how your custom label filter query would look:
Example 2 - Filter Recipes created for a specific age group by certified members of one particular group of recipe authors
As a publisher, you have grouped your recipe authors into various clubs, and you publish recipe content for different age groups. To organize and distinguish your recipe content, you use custom labels for authors' clubs, certified authors, and age groups, but you don't follow a consistent approach for adding custom labels. Your authors sometimes add custom labels on a recipe level, and they also sometimes add them in ingredients or instructions. Now, let's assume that you want to filter recipes created for children aged 1-3 or 3-9 by certified Mom's Cooking Club members and boost the ranking of recipes matched with age group 1-3 in search results. Here is how your custom label filter query would look:
Last updated