You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it expected behavior to have elements with the most relations in common be returned first? I've basically copied the tags and categories example from the documentation and I'm getting a seemingly random order.
Additional context
Here's a code example and what it returns:
{# Similar Recipes #}
{% set ids = entry.relatedStory.ids() | merge(entry.tags.ids()) %}
{% set limitCriteria = craft.entries.limit(8) %}
{% set similarRecipes = craft.similar.find({ element: entry, context: ids, criteria: limitCriteria }) %}
{% for similar in similarRecipes %}
<div>{{ similar.title }} ({{ similar.count }} ids in common)</div>
{% endfor %}
{# Returns #}
Recipe Title 1 - (2 ids in common)
Recipe Title 2 - (2 ids in common)
Recipe Title 3 - (2 ids in common)
Recipe Title 4 - (2 ids in common)
Recipe Title 5 - (4 ids in common)
Recipe Title 6 - (4 ids in common)
Recipe Title 7 - (4 ids in common)
Recipe Title 8 - (2 ids in common)
Thanks!
The text was updated successfully, but these errors were encountered:
Question
Is it expected behavior to have elements with the most relations in common be returned first? I've basically copied the tags and categories example from the documentation and I'm getting a seemingly random order.
Additional context
Here's a code example and what it returns:
Thanks!
The text was updated successfully, but these errors were encountered: