3

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.

1
  • 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}]}
    – user8344
    Jan 13, 2015 at 20:38

1 Answer 1

0

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 agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.