Initial SharePoint Search Results Timeout Problem

When working with several million results and extremely complex queries even with a relatively robust farm you may get a “Something Went Wrong” error in search. Delving deeper you can see that there is a timeout set for queries longer than 15 seconds. So what we want to do is extend the SharePoint 2013 Search Results webpart query timeout.

This may not be common, but when your users are creating extremely complex queries with over a dozen keywords and boolean operators it can overwhelm the query servers having to look through over 10s of millions of results.

SearchServiceApplication::Execute–Exception: System.ServiceProcess.TimeoutException: The current operation timed-out after 15 seconds

Researching the Problem

If you search on this there are several ways to set timeouts but none for the query timeout that I found and the query.timout property is obsolete in 2013.

So eventually I found SharePoint Search REST API overview, which talks about how the REST Search API has a Timeout Property.

“Fixing” the Problem without Code

Since in the particular environment I am having an issue we cannot deploy custom solutions I tried out using the same property in the JSON query that the Search Results Webpart uses.

So In order to increase the time out for the search results webpart we first need to export the Search results webpart.

Export Webpart
Save Webpart

property name=”DataProviderJSON” type=”string”>{“QueryGroupName”:”Default”,”QueryPropertiesTemplateUrl”: ”sitesearch://webroot”,”IgnoreQueryPropertiesTemplateUrl”: false,”SourceID”:”7b77e09a-47c9-4ec2-ae30-cb1863c21057″,”SourceName”: ”Ece Subjects”,”SourceLevel”:”SPWeb”,”CollapseSpecification”:””,”QueryTemplate”:”{searchboxquery}”,”FallbackSort”:null,”FallbackSortJson”: ”null”,”RankRules” :null,”RankRulesJson”:”null”,”AsynchronousResultRetrieval”:false,”SendContentBeforeQuery”:true,”BatchClientQuery”:true,”FallbackLanguage”: -1,”FallbackRankingModelID”:””, ”EnableStemming”:true,”EnablePhonetic”:false,”EnableNicknames”:false,”EnableInterleaving” :true,”EnableQueryRules”: true,”EnableOrderingHitHighlightedProperty”:false,”HitHighlightedMultivaluePropertyLimit”: -1,”IgnoreContextualScope”:false,”ScopeResultsToCurrentSite”:false,”TrimDuplicates”:true,”Properties”: {“ListId”:”a449f95e-6e74-4b7f-8a3e-39c866b4e40f”,”ListItemId”:24,”Timeout”:60000},”PropertiesJson”: ”{\”ListId\”:\”a449f95e-6e74-4b7f-8a3e-39c866b4e40f\”,\”ListItemId\”:24,\”Timeout\”:60000}”,”ClientType”: ”AllResultsQuery”,”UpdateAjaxNavigate”:true,”SummaryLength”: 180,”DesiredSnippetLength”:90,”PersonalizedQuery”: false,”FallbackRefinementFilters”:null,”IgnoreStaleServerQuery”:true, ”RenderTemplateId”:”DefaultDataProvider”,”AlternateErrorMessage” :null,”Title”:””}

import webpart SharePoint 2013
Add Imported Webpart

Now reimport the webpart and your timeout is now 60 seconds.

Note that this is the maximum value for the property.