Search Results Web Part Sorting not working

Introduction :

Hello everybody. Today i got another problem with the Search Results Web Part.

I wanted to sort results. I went on “Sorting” tab and choose to sort by one of my own properties.

Sorting Search Results Web Part






When i test the query with the simulator it is working fine. But when i apply modifications and went back to the page i see results sorted on creation date!

Problem :

After spending hours searching on Internet, i found many blogs talking about the same issue. It seems that it is a bug with the Search Results Web Part.

The only solution that they suggest is to create a new result source and make sorting on it.

I did not like that solution so i decided to inspect again the xml of the Web Part.

Solution :

I found the property “AvailableSortsJson”Available Sort JSON


As its name indicates, this property specifies the available sorts. I put my property on first rank :

[{“name”:”Display Name of your sort”,”sorts”:[{“p”:”Name of property”,”d”:1 for descending/0 for ascending}]}]

And now everything is working fine.



2 Comments Add yours

  1. Andri says:

    I spent all day trying figure it out whats wrong. It helps a lot thank you Mr Salhi

    1. Glad to hear that.. I am still available if you need any help

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.