Coveo search sorting not working
(I'm using Coveo for Sitecore 4.0, June release, with Sitecore 8.1 Update 2)
We have a couple pages where we have a search view that requires the results be sorted by the publish date (a field on the item, not the Sitecore Publish Date).
The problem we're running into is that it seems to only sort by relevancy, not by field. In fact, any changes we make to the sort variables seem to have any effect, like our changes are being overwritten somewhere.
Here's the part of the code where we're updating the sort options:
What am I doing wrong? Is there another way I should be doing this? I've tried modifying sortCriteria in queryBuilder as well, with no effect.
In Coveo for Sitecore, default sorting is fronted on the Coveo Search component. See Default Sort Options sections on this page.
I think the problem is that to code of these options is overriding your code.