Gravatar for deepak.raghav87@gmail.com

Question by deepak_raghav, Jun 22, 2015 10:05 AM

Coveo Sorting using a custom field in descending order

I'm trying to Sort the Coveo results in descending order using a custom date field. But currently if i use Sortfield Query parameter i'm not getting the sorted result. Is there anything that should be added to the Config file or anything in specific to be done for the sorting to work. I'm using Coveo free edition and not using Coveo's components. Please help

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Jun 23, 2015 9:43 AM

In your Coveo.SearchProvider.config file, what is the configuration of your custom date field (Computed Field)?

1 Reply
Gravatar for mlaporte@coveo.com

Answer by Martin Laporte, Jun 23, 2015 4:14 AM

When specifing a sort field you must also pass FieldAscending or FieldDescending for the sortCriteria parameter (see https://developers.coveo.com/display/SearchREST/Query+Parameters#QueryParameters-sortCriteria).

Note that an upcoming version will also support passing @field ascending through the sortCriteria parameter.

Ask a question