Can CoveoSort component sort on custom fields that are multi value?
Hi, I am using Coveo jsframeworks. I would like to use the CoveoSort component to sort on custom fields. These fields are multi-value fields, so the content items are separated by semi colon. Currently when I try to use the CoveoSort, it returns no results.
Is it possible for CoveoSort component to work on these fields?
Thanks in advance.
Are you sure your custom fields are marked as sortable? You will see it with the CES Admin Tool (Configuration > Fields).
In my environment, the CoveoSort component works on a multi-value field. It sorts like any other string field, but… unfortunately results are sorted according to the whole string value. It looks weird if you expect that all documents with the value
A are returned first, then
B, and so on. I think you can work around this limitation by sorting the values in the multi-value field first. There are some different ways to do it and it mostly depends on the index source type.
[span class="CoveoSort" data-sort-criteria="@mymultivaluefield ascending,@mymultivaluefield descending"]My Custom Field[/span]
Be careful not to copy and paste the snippet above directly in your web page. I had to replace the angle brackets with square brackets because the custom attributes were not showing in the answer.
I hope this helps