FullTextSqlQuery throwing exception – this site is not assigned to an indexer

Following on from my presentation at SharePoint Saturday in Melbourne, I thought I’d relay a tip to those looking to code a webpart or such using FullTextSqlQuery.

During the development of my code, I was getting errors when running the following code :

FullTextSqlQuery fullTextSqlQuery = new FullTextSqlQuery(SPContext.Current.Site)
    ResultTypes = ResultType.RelevantResults, 
    QueryText = stringBuilder.ToString(),
    TrimDuplicates = true,
    EnableStemming = true,
    StartRow = 1,
    RowLimit = 200,
    TotalRowsExactMinimum = 300,
    IgnoreAllNoiseQuery = false,

//Return the search results to a ResultTableCollection
resultTableCollection = fullTextSqlQuery.Execute();

What was happening in the UI was a message stating :

Your search cannot be completed because this site is not assigned to an indexer. Contact your administrator for more information.

Took me a few DAYS of investigation to work a fix – as the code was compiling, and executing – just couldn’t connect to the Search Service within SharePoint.

And it turns out that my code was somehow causing a COM Exception within the WSS Search Service – and was listed in the Event Viewer also. 

I was having to go to Control Panel > Services – and re-start the “Windows SharePoint Search” service.

What’s going on !

Well – you may be aware that there’s a separate web service for both WSS and MOSS.  It follows that you can use the API to interact with either of these – and my code was incorrectly trying to use the WSS not MOSS class libraries.

The core issue was with my project references within Visual Studio

The key to my discovery was with this code :

ResultTypes = ResultType.RelevantResults, 

When I tried to add the option for “SpecialTermResults” (aka BestBets), I was getting a .NET error – saying ‘invalid member’ or something :

ResultTypes = ResultType.RelevantResults, ResultType.SpecialTermResults,  

But – this is within the SharePoint class library from MSDN.

It was then that I realised my FullTextSqlQuery class was referenced from :

  • using Microsoft.SharePoint.Search.Query   // WSS

– instead of

  • using Microsoft.Office.Server.Search.Query   // MOSS

It follows that the project file (DLL) references were wrong also. 

And yep – swapping them out fixed the problem !    *phew*

So – if you’re having this error – then check your solution/project references :

WSS Search

DLL : C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12ISAPIMicrosoft.SharePoint.Search.dll

NameSpace : Microsoft.SharePoint.Search.Query

MOSS Search

DLL : C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12ISAPIMicrosoft.Office.Server.Search.dll

NameSpace : Microsoft.Office.Server.Search.Query

Kinda obvious in the end :

  • If included as “SharePoint” only – it’s WSS
  • Need to have “Office Server” for MOSS

Wish I’d known all this earlier – it would have saved me a few stressful days !


5 thoughts on “FullTextSqlQuery throwing exception – this site is not assigned to an indexer

  1. Amit Lohogaonkar April 1, 2010 / 5:58 am

    you saved my days and nights man!


  2. Beezler May 11, 2010 / 6:00 pm

    Many, many thanks. You saved me lots o’ time.


  3. jcapka May 22, 2012 / 2:47 pm

    Really saved my butt with this, many thanks!


  4. svv October 24, 2012 / 1:30 pm

    You saved my life! Thx


  5. Birger November 28, 2013 / 10:10 am

    Thanks:) This really helped


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s