You may have seen this exception when using the SearchExecutor class in your SharePoint C# code. I had an issue just recently that threw me off what was really wrong and I thought I’d share as it might save someone else the same head-banging time I went through.
Anyway; on executing a query in C# this error was thrown. The error that eventually bubbles to the top of the stack is very generic and not particularly useful to be honest:
…and you’d be forgiven for thinking your entire search infrastructure had keeled over too if you traced the correlation ID:
There’s some seriously eyebrow-raising messages in there; my favourite being the warning of doom that all your query components have kicked the bucket & gone to the great virtual heaven in the sky. That would be quite a big deal if it were true.
Well it turns out search is working fine; just the query was invalid. In that stack of messages, you’ll find something like this line:
IndexNodeQueryService[SPfbba63bb3b8e]: Pushing error to client.: Microsoft.Ceres.SearchCore.FastServer.FastServerException: IndexComponent1-601390f4-d839-491a-85c3-11195ee6d455-SPfbba63bb3b8e.I.0.0: Attribute vector 'Title' not available for sorting: [lookup, correlation id: 221A6D9C-3A0E-10AD-33C8-23B57736E952] at Microsoft.Ceres.SearchCore.FastServer.Plugin.Lookup(Byte queryBuffer, Int64 generationId, Byte& resultBuffer, Byte& refineBuffer, Int64 maxNumHitsToReturn, Int64 offsetInResultSet, Boolean enableRankLog, String ranking_model, String aggrspec, String sortspec, String defaultIndex, Boolean skiplistEnabled, Boolean precalcEnabled, TimeSpan timeout) at Microsoft.Ceres.SearchCore.Indexes.FastServerIndex.QueryLookup.Lookup(ExecuteQueryParameters parameters, Byte& aggregationBlob) at Microsoft.Ceres.SearchCore.Search.QueryService.IndexNodeQueryService.ExecuteQuery(ExecuteQueryRequest request) at Microsoft.Ceres.SearchCore.Search.QueryService.IndexNodeQueryService.ProcessExecuteQuery(ExecuteQueryRequest request).
Yes indeed, this post is basically to point out that errors with SearchExecutor.ExecuteQuery are quite difficult to find and you’d be forgiven for thinking something more serious was afoot.
That’s it – happy SharePointing!
// Sam Betts