aarebrot.net Frode's blog on Sharepoint and other stuff

Troubleshooting SharePoint: Your search cannot be completed because of a service error.

Posted on September 1, 2010
VN:F [1.9.22_1171]
Rating: 5.0/5 (2 votes cast)

A colleague of mine, lets call him Jereme, came across this and he suggested I post it on my blog, so here goes. One of his clients where having issues with one of their search scopes. Whenever a user would try to do a search with one of the custom scopes, they would receive an error saying "Your search cannot be completed because of a service error. Try your search again or contact your administrator for more information.". It only occurred with this one search scope.

Jereme was telling me that he dug through the log files and came up with the following error:

Microsoft.Office.Server.Search.Query.QueryMalformedException: Your query is malformed. Please rephrase your query.
     at Microsoft.Office.Server.Search.Query.FullTextSqlQuery.Execute()
     at Microsoft.Office.Server.Search.WebControls.SearchResultHiddenObject.GetResultData()

Obviously something is wrong with the search query here, and apparently it's a problem with single quotes in the name of the search scope. This completely baffles me. Is SharePoint really passing the name of the scope into the search query without escaping quotes? So I set out to test this out for myself.

First of all I created a new temporary site collection and made sure the searching functionality worked.

Normal SharePoint search results

What you should be seeing when you search for something

Then I went into the Share Services Provider and changed the name of the default scope from "All Sites" to "All' Sites" (notice the extra single quote in there).

Changing the search scope name

Renaming the search scope to All' Sites

Then I had a 9 minute break while I waited for the changes to kick in.

Waiting for search scope changes to take effect

Waiting for search scope changes to take effect

And here we are, 9 minutes later, testing the search. I was going to show a picture here, but it actually looks exactly the same as the last screen. So the regular search actually seems to work just fine still, but the problem does actually manifest itself if you use the Advanced Search.

Advanced search using the All' Sites scope

Advanced search using the All' Sites scope

If you hit the Search button, you should get something saying "Your search cannot be completed because of a service error. Try your search again or contact your administrator for more information."

Single quote search error

Believe me, searching again won't help...

Looking in the trace logs there's a bunch of this kind of stuff:

Log Query: Your query is malformed. Please rephrase your query. More Information: One or more errors occurred during processing of command.
Error while executing web part: Microsoft.Office.Server.Search.WebControls.SrhdcGenericException: Your search cannot be completed because of a service error. Try your search again or contact your administrator for more information. ---> Microsoft.Office.Server.Search.Query.QueryMalformedException: Your query is malformed. Please rephrase your query.     at Microsoft.Office.Server.Search.Query.FullTextSqlQuery.Execute()     at Microsoft.Office.Server.Search.WebControls.SearchResultHiddenObject.GetResultData()     --- End of inner exception stack trace ---     at Microsoft.Office.Server.Search.WebControls.SearchResultHiddenObject.GetResultData()     at Microsoft.Office.Server.Search.WebControls.SearchResultHiddenObject.get_ResultsReturned()     at Microsoft.Office.Server.Search.WebControls.C...
...oreResultsWebPart.ModifyXsltArgumentList(ArgumentClassWrapper argList)     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform()
InnerException 1: Microsoft.Office.Server.Search.Query.QueryMalformedException: Your query is malformed. Please rephrase your query.     at Microsoft.Office.Server.Search.Query.FullTextSqlQuery.Execute()     at Microsoft.Office.Server.Search.WebControls.SearchResultHiddenObject.GetResultData()
Error while executing web part: Microsoft.Office.Server.Search.WebControls.SrhdcGenericException: Your search cannot be completed because of a service error. Try your search again or contact your administrator for more information. ---> Microsoft.Office.Server.Search.Query.QueryMalformedException: Your query is malformed. Please rephrase your query.     at Microsoft.Office.Server.Search.Query.FullTextSqlQuery.Execute()     at Microsoft.Office.Server.Search.WebControls.SearchResultHiddenObject.GetResultData()     --- End of inner exception stack trace ---     at Microsoft.Office.Server.Search.WebControls.SearchResultHiddenObject.get_ResultsReturned()     at Microsoft.Office.Server.Search.WebControls.CoreResultsWebPart.ModifyXsltArgumentList(ArgumentClassWrapper argList)     at Microsoft.Sha...
...rePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform()
InnerException 1: Microsoft.Office.Server.Search.Query.QueryMalformedException: Your query is malformed. Please rephrase your query.     at Microsoft.Office.Server.Search.Query.FullTextSqlQuery.Execute()     at Microsoft.Office.Server.Search.WebControls.SearchResultHiddenObject.GetResultData()
Error while executing web part: Microsoft.Office.Server.Search.WebControls.SrhdcGenericException: Your search cannot be completed because of a service error. Try your search again or contact your administrator for more information. ---> Microsoft.Office.Server.Search.Query.QueryMalformedException: Your query is malformed. Please rephrase your query.     at Microsoft.Office.Server.Search.Query.FullTextSqlQuery.Execute()     at Microsoft.Office.Server.Search.WebControls.SearchResultHiddenObject.GetResultData()     --- End of inner exception stack trace ---     at Microsoft.Office.Server.Search.WebControls.SearchResultHiddenObject.get_BestBetsReturned()     at Microsoft.Office.Server.Search.WebControls.HighConfidenceWebPart.ModifyXsltArgumentList(ArgumentClassWrapper argList)     at Microsoft...
....SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform()
InnerException 1: Microsoft.Office.Server.Search.Query.QueryMalformedException: Your query is malformed. Please rephrase your query.     at Microsoft.Office.Server.Search.Query.FullTextSqlQuery.Execute()     at Microsoft.Office.Server.Search.WebControls.SearchResultHiddenObject.GetResultData()

I still find this hard to believe, but there you go. I went back in and removed the single quote from the scope name, and the advanced search went back to working just fine. If you run across this error check the name of your scope and make sure it doesn't contain any single quotes.

Troubleshooting SharePoint: Your search cannot be completed because of a service error., 5.0 out of 5 based on 2 ratings
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

 

No trackbacks yet.