The common issue is that 10 items are requested, but only 1 item is served. It's expected because the catalog filter is applied to the items you asked for, following the recommendation behavior.
The process follows these steps:
- The engine retrieves the results of the items.
- The items are filtered through the catalog.
- Only items matching this catalog filter remain.
If you request 10 items but only one matches the catalog filter, only that item will be served.
The solution is to make the catalog filter less strict or request more recommended items. Requesting more items increases the likelihood of receiving additional items that match the catalog filter.
To change the size of the call when using Jinja to fetch recommendation results, you can, for example, adjust the size parameter from 10 to 30.
{% for item in recommendations('5a7c4dfefb6009323d4c7311', size = 30) %}
{% endfor %}This code increases the likelihood that more items will be served if they match the catalog filter.
One more important thing to note is that if the number of requested items can't be matched, you can also use the fill_with_random function to fill the output with random items. It allows achieving the requested size, for example, 30. If you don't specify this function, it will be set as true by the system, or you can define it explicitly with fill_with_random = true as below:
{% for item in recommendations('5a7c4dfefb6009323d4c7311', fill_with_random = true, size = 30) %}
{% endfor %}The steps above should help you resolve the issue with fewer items served as requested.