Online Training On SharePoint
                      

Sunday 31 January 2010

Creating Auto Suggest Query Suggestion in FAST Search for SharePoint 2010

With SharePoint 2010 user gets query suggestions when they type search queries in the Search Text box (Available both with SharePoint and FAST Search). These query suggestions are automatically created over a period of time for any query that has a specified number of results clikcthroughts.
If we want we can manually create the Query Suggestion. In this post I will show you how to create the Query Suggestion for the FAST Search. The Query Suggestions needs to be created using PowerShell. First we need get the Query SSA for FAST Search by using the following command:

$SearchApp = Get-SPEnterpriseSearchServiceApplication
(Add the FAST Query SSA as a parameter.)

Now to add a query suggestion, use the following command:
New-SPEnterpriseSearchLanguageResourcePhrase -SearchApplication $SearchApp -Language En-Us -Type QuerySuggestionAlwaysSuggest -Name "Query Suggestion Name"

These suggestions are compiled by the "Prepare Query Suggestions" job in Central Administration. This job is scheduled to run once in a day. If we need to see these suggestions immediately we need to run this job. Either this can be done using Central Administration UI or using the following PowerShell command:
Start-SPTimerJob -Identity "Prepare Query Suggestions"

I have put two suggestion with SharePoint 2010 and Sheet. Once we start typing Sh these will start appearing:


If we need to remove a query suggestion we can use the following command:
Remove-SPEnterpriseSearchLanguageResourcePhrase -SearchApplication $SearchApp -Language En-Us -Type QuerySuggestionAlwaysSuggest -Identity "Suggestion Name"

To display all the query suggestions we can use the following command:
Get-SPEnterpriseSearchQuerySuggestionCandidates -SearchApplication $SearchApp

Also if a user does not want to see these query suggestion they can be stopped from Preferences and then unchecking the box showing the search suggestion:

2 comments:

Bibhu said...

Thank you for posting this ! I was trying to run the command but got following error:PS C:\Users\svc.mossdev> $SearchApp = Get-SPEnterpriseSearchServiceApplication
PS C:\Users\svc.mossdev> New-SPEnterpriseSearchLanguageResourcePhrase -SearchApp
lication $SearchApp -Language En-Us -Type QuerySuggestionAlwaysSuggest -Name "FA
ST Search"
New-SPEnterpriseSearchLanguageResourcePhrase : Cannot convert 'System.Object[]'
to the type 'Microsoft.Office.Server.Search.Cmdlet.SearchServiceApplicationPip
eBind' required by parameter 'SearchApplication'. Specified method is not suppo
rted.
At line:1 char:64
+ New-SPEnterpriseSearchLanguageResourcePhrase -SearchApplication <<<< $Search
App -Language En-Us -Type QuerySuggestionAlwaysSuggest -Name "FAST Search"
+ CategoryInfo : InvalidArgument: (:) [New-SPEnterpris...eResourc
ePhrase], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Microsoft.Office.Server.Se
arch.Cmdlet.NewSearchLanguageResourcePhrase.


You have mentioned it can be also done from FAST Search side , an article on that will be wonderful!

Nemil said...

In FAST you will have two SSA and in your first command you are storing both SSA and query suggestion wont work for Content SSA.

In FAST environment run
$SearchApp = Get-SPEnterpriseSearchServiceApplication -identity "Name of Query SSA" and rest of the PowerShell commands.

Related Posts with Thumbnails