I'm trying to search a Sharepoint 2007 site using the FullTextSqlQuery class, but I keep getting the following error "The search request was unable to connect to the Search Service"
My code looks like this
create a new FullTextSqlQuery class - use property intializers to set query
scope = "BuySale";
FullTextSqlQuery myQuery = new FullTextSqlQuery(SPContext.Current.Site)
{
QueryText = "SELECT Path FROM SCOPE() WHERE \"SCOPE\" = '" + scope + "'",
ResultTypes = ResultType.RelevantResults
};
ResultTableCollection queryResults = myQuery.Execute();
ResultTable queryResultsTable = queryResults[ResultType.RelevantResults];
queryDataTable.Load(queryResultsTable, LoadOption.OverwriteChanges);
Error from ULS log is this
Danish version
Log Query: Søgeanmodningen kunne ikke oprette forbindelse til søgetjenesten. Yderligere oplysninger: Object or data matching the name, range, or selection criteria was not found within the scope of this operation.
English version
Log Query: The search request was unable to connect to the Search Service. Yderligere oplysninger: Object or data matching the name, range, or selection criteria was not found within the scope of this operation.
I've checked that all services is running and the scope exits. I'm able to use the scope using sharepoint normal search and using the "SearchCoder" app that can help create search query.
Any ideas would be greatly appreciated.
Found the soltuion after spending a few more hours on google.
I was using the wrong dll to resolve the FullTextSqlQuery class
I was using this Microsoft.SharePoint.Search.Query // WSS
but should have been using this using Microsoft.Office.Server.Search.Query // MOSS
Thanks to Chris O'Connor
http://sharepointroot.com/2009/11/14/fulltextsqlquery-throwing-exception-this-site-is-not-assigned-to-an-indexer