I am working in a SharePoint 2013 Enterprise Search Center, and looking to change the default Sort options on a Results page. To do this, I am modifying the “Available sort orders (JSON)” property of the Search Results Web Part:

enter image description here

I have modified the JSON so that the date-driving options are first. For example, I have placed Relevance after the “Newest” and “Oldest” options:

[{"name":"Date(Newest)","sorts":[{"p":"Write","d":1}]},{"name":"Date(Oldest)","sorts":[{"p":"Write","d":0}]},{"name":"Relevance","sorts":[]},{"name":"Lifetime Views","sorts":[{"p":"ViewsLifeTime","d":1}]},{"name":"Recent Views","sorts":[{"p":"ViewsRecent","d":1}]}]

When I publish the page, everything initially appears fine. When a search is performed, the ‘newest’ items are returned in the results. However, when I select “Relevance” from the drop-down list, the Sort drop-down changes back to “Date(Newest)”, and the results are sorted in the ‘newest’ sort order.

Below is a quick video on what I am seeing:

http://screencast.com/t/jAyNN6Xt

Does the Search Result Web Part have issues if “Relevance” is not the primary option? Is there still a way to allow for “Relevance” as a secondary option? Is it possibly because the “sorts” options are empty in the “Relevance” JSON values?

P.S. I was also able to duplicate this behavior on an Enterprise Search Center hosted in SharePoint Online/Office 365.

  • I'm still testing, but it appears using the "Rank" property in descending order provides the same results: {"name":"Relevance","sorts":[{"p":"Rank","d":1}]} – JesseC Jan 13 '15 at 20:38

You need to change sort by "Rank" into what the search engines calls it in managed properties: "siterank". Note this is case sensitive.

So the string snippet becomes:

{"name":"Relevance","sorts":[{"p":"siterank","d":1}]}

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.