Tuesday, April 15, 2014

Error: "Not able to connect to search service to retrieve valid settings" or Why won't my query builder work?

So there I was, a SharePoint admin, trying to tweak Search like a good admin should to make my users' lives easier. SharePoint 2013 no longer uses Search Scopes to create a "less than everything" approach but instead uses a Result Source - which can be done centrally in the Search Application or in a decentralized fashion at the Site Collection level.

To do this in the Site Collection Result Sources page is easy, and I can use the Query Builder to quickly verify my work.

In the Central Administration site in the Search Application management settings, an administrator can do the same thing to create scopes... er Result Sources that are available to every single web application that uses this Search App. The Result Sources work fine, and the open text box will let you define the raw text of a working query with no problem, but if you quick Query Builder here, you get this:

Not good.

The quick fix is just to build the query at the site collection level then copy and paste the result to the Search Application level. 

I found the longer fix was to crack open the SharePoint management Shell - here comes the PowerShell - and define my account as an SSA Admin. This is NOT well documented!



Here's the code to add yourself as SSA admin:
$principal = New-SPClaimsPrincipal "<domain>\<user>" -IdentityType WindowsSamAccountName

$spapp = Get-SPEnterpriseSearchServiceApplication

$security = Get-SPServiceApplicationSecurity $spapp –Admin

Grant-SPObjectSecurity $security $principal "Full Control"

Set-SPServiceApplicationSecurity $spapp $security –Admin



This is just an example of using what is described here: http://technet.microsoft.com/en-us/library/ee704546%28v=office.15%29.aspx

But it is odd that I SEEM to be a service administrator until I try and use the query builder.
Also, the other error you are likely to see here is related to the needed installation of the SharePoint Web Part to enable the functionality of the query builder

That one has a different error: "The search display templates are not present in this site collection."










But a very easy fix in PowerShell:

Enable-SPFeature SearchWebParts -url http://<central admin url>

Good luck folks!
 

3 comments:

radha said...

Still no luck ..am facing the same issue.

Unknown said...

Go into the web applications, choose central admin then click service connection in the ribbon. Make sure SSA Proxy is checked

guptha said...
This comment has been removed by the author.