SharePoint 2013 search result webpart sorting is not working

Reference from : http://www.habaneroconsulting.com/insights/why-are-my-sort-orders-not-working-in-my-sharepoint-2013-search-results-web-part#.VfeRHxGqqko

Even tought I set up sorting in the query of search result web part, the sorting was not affected into webpart.

This is because of JSON sort applied regardless you tick ‘Show sort dropdown’ box.

Sotution

  1. use result source using sorting.
  2. update JSON sort definition in the web part.

For example)
[{“name”:”A-Z”,”sorts”:[{“p”:”PreferredName”,”d”:0}]},{“name”:”Z-A”,”sorts”:[{“p”:”PreferredName”,”d”:1}]}]
[{“name”:”First Name”,”sorts”:[{“p”:”PreferredName”,”d”:0}]}]

p means managed property name

d means descending

[
   {
      "name":"Name and Location Sort",
      "sorts":[
         {
            "p":"Name",
            "d":0
         },
         {
            "p":"Location",
            "d":0
         }
      ]
   }
]
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: