Thursday, June 19, 2014

SharePoint 2013 Search ‘InternalQueryErrorException’ in case of sorting on non-sorted property

After deployment plus configuration of an out-of-the-box component in our SharePoint 2013 farm, that component reported a fatal error when used on a SharePoint page:
Microsoft.Office.Server.Search.Query.InternalQueryErrorException: Search has encountered a problem that prevents results from being returned. If the issue persists, please contact your administrator...
As the logged information is very limited / useless, I analyzed the problem by executing the same code in an own Console Application, and via trail-and-error find out what exactly causes the problem.
The problem cause was this:
  • In a KeywordQuery, a managed property is added to the SortList parameter collection
  • However, that same managed property was not configured as Sortable in SharePoint Search administration
Executing the keywordquery via SearchExecutor.ExecuteQuery() results in the Search Service Application (SSA) throwing the 'InternalQueryException' due the mismatch in Search administration versus Search query/usage.
With this inner knowledge, the quick fix then is to set the managed property as ‘Sortable’ in SharePoint 2013 Search Administration.

2 comments:

  1. Thanks, You just saved me a couple of hours

    ReplyDelete
  2. Thanks for the post it saved my day , It was not easy ti figure out the issue

    ReplyDelete