I was writing a new web part to search Taxonomies (Managed metadata) in SharePoint 2010. During testing I got an error when using the class FullTextSqlQuery
“Microsoft.SharePoint.SPException: Your search cannot be completed because this site is not assigned to an indexer. Contact your administrator for more information. at Microsoft.SharePoint.Search.Query.Query.CreateQueryProxy(SPSite site) at Microsoft.SharePoint.Search.Query.Query..ctor(SPSite site)”
while debugging this snippet.
1: FullTextSqlQuery ftsq = new FullTextSqlQuery(SPContext.Current.Site); 2: string query = String.Format(" ... " , termTitle);3: ftsq.QueryText = query;
A quick search all proposed the same solution: Go to Central Administration and make sure that the “Search Server” is correctly set on the “Manage Content Database Settings” page.
I did try the proposed solution but it didn’t solve my error. Kind of expected, since the search on my development machine was working flawlessly for several weeks.
I googled for quite some time until I discovered that I referenced the wrong dlls. I was developing for the SharePoint 2010 server edition but I referenced the SharePoint 2010 Foundation dlls (= the free version).
Change the references of your Visual Studio project from “Microsoft.SharePoint.Search.Query” to “Microsoft.Office.Server.Search.Query”. After this my Web Part worked and the error was gone.
So remember :
Microsoft.SharePoint.Search.Query is for the (free) SharePoint 2010 Foundation development.
Microsoft.Office.Server.Search.Query is needed when developing for the SharePoint 2010 server version.