Blocking unwanted Query Suggestions from FS4SP (or SP2010)

One of the cool features available both with FS4SP and SP2010 is the ability to have query suggestions. You know, those suggestions that appear as you start typing in a search box and sometimes help you direct your query to what you want.

Other people already have posted very good material about query suggestions and how to add them to FS4SP. You can find a great post from Steve Peschka about it here.

One thing that people have been asking me about when they hear about the wonders of a system that automatically generates new query suggestions based on user queries is this: “can I block some terms from been suggested?”

This seemed like a fair question to which I only recently found the answer. Yes, you can block terms that you don’t want to have suggested to your users and to do this we are going to use the same cmdlet used to manually add query suggestions, but with a small twist.

The cmdlet in question is New-SPEnterpriseSearchLanguageResourcePhrase, which is part of the SP2010 cmdlets. The small twist here will be the parameter type, which we will define as QuerySuggestionBlockList to indicate that we want to block a term from appearing in the list of query suggestions.

Let’s say you want to prevent the term “soccer” from been suggested (maybe you have something against the sport, who knows? Smile). The list of commands to block this term will look like this:

$searchapp = Get-SPEnterpriseSearchServiceApplication "FAST Query SSA"

New-SPEnterpriseSearchLanguageResourcePhrase -SearchApplication $searchapp -Language en-us -Type QuerySuggestionBlockList –Name soccer

Start-SPTimerJob -Identity "Prepare query suggestions"

Things to pay attention to:

FAST Query SSA is the name of the FAST Search Query SSA you created when you configured FS4SP

en-us is the language of the term you want to block (recommendations are suggested based on the query language of the user)

“Prepare query suggestions” is the timer job that runs every night to generate the list of query suggestions (we force it to run so we don’t have to wait until tomorrow to test Smile)

In case you change your mind later and want to remove “soccer” from the list of blocked terms, allowing it to be freely suggested again, simply execute this list of cmdlets:

$searchapp = Get-SPEnterpriseSearchServiceApplication "FAST Query SSA"

Remove-SPEnterpriseSearchLanguageResourcePhrase -SearchApplication $searchapp -Language en-us -Type QuerySuggestionBlockList –Identity soccer

Start-SPTimerJob -Identity "Prepare query suggestions"

Enjoy!

About leonardocsouza

Mix together a passion for social media, search, recommendations, books, writing, movies, education, knowledge sharing plus a few other things and you get me as result :)
This entry was posted in FS4SP and tagged , . Bookmark the permalink.

3 Responses to Blocking unwanted Query Suggestions from FS4SP (or SP2010)

  1. Pingback: クエリー候補に出したくないキーワードの登録 « エンタープライズサーチ ナウ

  2. priyanka-patil@hotmail.com says:

    Add-SPEnterpriseSearchLanguageResourcePhrase -SearchApplication $searchapp -Language en-us -Type QuerySuggestionBlockList –Name soccer, doesn’t seem to be working for automatically added phrases

    • I don’t have any servers to check this at the moment, but are you getting any errors? Which version of FS4SP?

      In any case, here are a few things to check:

      * Make sure your are using the exact name of your Query SSA in ==> $searchapp = Get-SPEnterpriseSearchServiceApplication “FAST Query SSA”

      * Validate that you are running the required timer job after your changes ==> Start-SPTimerJob -Identity “Prepare query suggestions”

      Hope that helps!

      Best,
      Leo

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s