orderByFallback() function request #11457
-
ConceptSort query by the score with a fallback selected. The fallback orderBy would only apply if there were entries/users that have the same 'score'. This orderByFallback function would be applicable to entries and users and only used when the primary orderBy is 'score'. ExampleYour website is an organization with a directory of staff that people can search through. After a user applies their selected filters the query orders by score. If there are three staff members that all have the same score, the ordering of said three staffers would fall back on the selected method; i.e type of employee (full-time, part-time, volunteer). Fallback Types Requested
I particularly need it for the select field or user group |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Great idea. I’ve just made this possible for Craft 4.1, all via existing {% set entries = craft.entries()
.search('foo')
.orderBy('score, title asc')
.all() %} |
Beta Was this translation helpful? Give feedback.
Great idea. I’ve just made this possible for Craft 4.1, all via existing
orderBy
param (#11470). Going forward you will be able to set that toscore
+ additional column values, e.g.