I just installed a testing environment with SharePoint 2010 and FAST Search Server as the default search service application. Started with some test content and executed a few searches using the std. SharePoint GUI - everything fine so far.
Now I want to execute a more complicated query using the Microsoft.Office.Server.Search.Query.FullTextSqlQuery class and things get nasty. I get an exception when I try to access the ResultTableCollection object returned by my search.
This is the PowerShell Script I'm trying to run:
$site = New-Object Microsoft.SharePoint.SPSite "http://moss"
$kq = New-Object Microsoft.Office.Server.Search.Query.FullTextSqlQuery $site
$kq.ResultTypes = [Microsoft.Office.Server.Search.Query.ResultType]::RelevantResults
$kq.RowLimit = 5
$kq.QueryText = "SELECT Title, Url"
$resultTableCollection = $kq.Execute()
$relResultTable = $resultTableCollection.Item([Microsoft.Office.Server.Search.Query.ResultType]::RelevantResults)
And this is the exception (thrown by the last line of code above):The given key was not present in the dictionary.
System.Collections.Generic.KeyNotFoundException at System.ThrowHelper.ThrowKeyNotFoundException() at
System.Collections.Generic.Dictionary`2.get_Item(TKey key) at
Microsoft.Office.Server.Search.Query.ResultTableCollection.get_Item(ResultType requestedType)
The very same script works perfectly when I execute the search using the std. SharePoint Search Service application. I found one related post here that stated the security trimming of the query results could be the source of my problems. However, I cannot see how this should be relevant in my environment since the service account of my FAST Service Application definitely has sufficient permissions on the AD.
Any suggestions?