Pages

Tuesday, December 16, 2014

SharePoint 2010 Search Query Suggestions

SharePoint Query suggestions (or Search suggestions), appear below the Search Box Web Part and on the search results page.



So how do we get these query suggestions? There are 2 ways to do this :

1) The first one is created automatically based on user searches.

Query suggestions depend on users' searches. Only search queries that have been previously returned and then clicked through at least six times will appear in either the search box list. Therefore, a newly deployed SharePoint Server 2010 system will not show query suggestions in either location. Moreover, a query suggestion will only appear in the search box list if the query suggestion contains at least one of the words that are typed.

2) The second once is created manually.

We can use Windows PowerShell to manually add query suggestions. The benefit of this method is query suggestions are available immediately to users of a newly installed search system. We can also supplement the default Microsoft SharePoint Server 2010 behavior by adding query suggestions for key search terms.
In this manner, you can provide query suggestions that might not be generated by the system because users are not using the search terms that would create the query suggestions that you want to appear.

PowerShell to do this:

Here we are adding the following query suggestions manually (ford, test1, test2)

$searchapp = Get-SPEnterpriseSearchServiceApplication -Identity "<SearchServiceApplicationName>"

New-SPEnterpriseSearchLanguageResourcePhrase -SearchApplication $searchapp -Language En-Us -Type QuerySuggestionAlwaysSuggest -Name "ford"

New-SPEnterpriseSearchLanguageResourcePhrase -SearchApplication $searchapp -Language En-Us -Type QuerySuggestionAlwaysSuggest -Name "test1"

New-SPEnterpriseSearchLanguageResourcePhrase -SearchApplication $searchapp -Language En-Us -Type QuerySuggestionAlwaysSuggest -Name "test2"

Start-SPTimerJob -Identity "prepare query suggestions"


There are options to turn off query suggestions so that they will not appear at query time. This is made possible by editing the Search Box Web Part.



No comments:

Post a Comment