Add, remove and display synonyms for keywords by using Windows PowerShell (FAST Search Server 2010 for SharePoint)

 

Applies to: FAST Search Server 2010

Note

This article describes how to manage synonyms by using Windows PowerShell. For information about how to manage synonyms by using the graphical user interface, see Manage FAST Search keywords (Office.com).

Use synonyms only to improve recall for small result sets. If you add synonyms to keywords that already have a large result set, the additional results will be added to the end of the result set, and the search performance will be reduced.

Do not use synonyms for multiple versions of a word, for example car and cars. The stemming functionality in FAST Search Server 2010 for SharePoint will handle different versions of the same word. For more information about stemming, see Tune linguistic relevance (FAST Search Server 2010 for SharePoint).

In this article the following Windows PowerShell procedures are described:

  • Add a synonym to a keyword

  • Add multiple synonyms to a keyword

  • Remove a synonym from a keyword

  • Remove all synonyms from a keyword

  • Display all synonyms

  • Turn off recall for synonyms

Add a synonym to a keyword

  1. Verify that you meet the following minimum requirements: You are a member of the FASTSearchAdministrators local group on the computer where FAST Search Server 2010 for SharePoint is installed.

  2. On the Start menu, click All Programs.

  3. Click Microsoft FAST Search Server 2010 for SharePoint.

  4. Click Microsoft FAST Search Server 2010 for SharePoint shell.

  5. At the Windows PowerShell command prompt, get all search setting groups:

    Get-FASTSearchSearchSettingGroup
    
    >>Name        : 9c65a55f-eafc-451d-b0f5-56fbed465141
    >>Description :
    >>Id          : 1
    >>LastChanged : 10/19/2010 9:04:46 AM
    
    
  6. Add a synonym to a keyword:

    $searchSettingGroup = Get-FASTSearchSearchSettingGroup -Name "<SearchSettingGroupName>" 
    $keyword = $searchSettingGroup.Keywords.GetKeyword("<KeywordTerm>")
    $keyword.AddSynonym("<SynonymTerm>")
    

    Where:

    • <SearchSettingGroupName> is the name of an existing search setting group.

    • <KeywordTerm> is the keyword term string name of an existing keyword.

    • <SynonymTerm> is the synonym term to be added.

See also

Keyword.AddSynonym Method

Get-FASTSearchSearchSettingGroup

Add multiple synonyms to a keyword

  1. Verify that you meet the following minimum requirements: You are a member of the FASTSearchAdministrators local group on the computer where FAST Search Server 2010 for SharePoint is installed.

  2. On the Start menu, click All Programs.

  3. Click Microsoft FAST Search Server 2010 for SharePoint.

  4. Click Microsoft FAST Search Server 2010 for SharePoint shell.

  5. At the Windows PowerShell command prompt, create a collection of the synonyms that you want to add:

    $synonymsToBeAdded = @("<Synonym1>", "<Synonym2>", "<Synonym3>", "<Synonym4>")
    

    Where:

    • <Synonym1-4> are the synonyms that you want to add.
  6. Get all search setting groups:

    Get-FASTSearchSearchSettingGroup
    
    >>Name        : 9c65a55f-eafc-451d-b0f5-56fbed465141
    >>Description :
    >>Id          : 1
    >>LastChanged : 10/19/2010 9:04:46 AM
    
    
  7. Add the collection of synonyms to a keyword:

    $searchSettingGroup = Get-FASTSearchSearchSettingGroup -Name "<SearchSettingGroupName>" 
    $keyword = $searchSettingGroup.Keywords.GetKeyword("<KeywordTerm>")
    foreach($synonymToBeAdded in "<$synonymsToBeAdded>") {$keyword.AddSynonym($synonymToBeAdded)}
    

    Where:

    • <SearchSettingGroupName> is the name of an existing search setting group.

    • <KeywordTerm> is the keyword term string name of an existing keyword.

See also

SynonymCollection Interface

Keyword.AddSynonym Method

Get-FASTSearchSearchSettingGroup

Remove a synonym from a keyword

  1. Verify that you meet the following minimum requirements: You are a member of the FASTSearchAdministrators local group on the computer where FAST Search Server 2010 for SharePoint is installed.

  2. On the Start menu, click All Programs.

  3. Click Microsoft FAST Search Server 2010 for SharePoint.

  4. Click Microsoft FAST Search Server 2010 for SharePoint shell.

  5. At the Windows PowerShell command prompt, get all search setting groups:

    Get-FASTSearchSearchSettingGroup
    
    >>Name        : 9c65a55f-eafc-451d-b0f5-56fbed465141
    >>Description :
    >>Id          : 1
    >>LastChanged : 10/19/2010 9:04:46 AM
    
    
  6. Remove a synonym from a keyword:

    $searchSettingGroup = Get-FASTSearchSearchSettingGroup -Name "<SearchSettingGroupName>" 
    $keyword = $searchSettingGroup.Keywords.GetKeyword("<KeywordTerm>")
    $keyword.RemoveSynonym("<SynonymTerm>")
    

    Where:

    • <SearchSettingGroupName> is the name of an existing search setting group.

    • <KeywordTerm> is the keyword term string name of an existing keyword.

    • <SynonymTerm> is the synonym term to be removed.

See also

Keyword.RemoveSynonym Method

Get-FASTSearchSearchSettingGroup

Remove all synonyms from a keyword

  1. Verify that you meet the following minimum requirements: You are a member of the FASTSearchAdministrators local group on the computer where FAST Search Server 2010 for SharePoint is installed.

  2. On the Start menu, click All Programs.

  3. Click Microsoft FAST Search Server 2010 for SharePoint.

  4. Click Microsoft FAST Search Server 2010 for SharePoint shell.

  5. At the Windows PowerShell command prompt, get all search setting groups:

    Get-FASTSearchSearchSettingGroup
    
    >>Name        : 9c65a55f-eafc-451d-b0f5-56fbed465141
    >>Description :
    >>Id          : 1
    >>LastChanged : 10/19/2010 9:04:46 AM
    
    
  6. Remove all synonyms from a keyword:

    $searchSettingGroup = Get-FASTSearchSearchSettingGroup -Name "<SearchSettingGroupName>" 
    $keyword = $searchSettingGroup.Keywords.GetKeyword("<KeywordTerm>")
    $keyword.Synonyms.Clear()
    

    Where:

    • <SearchSettingGroupName> is the name of an existing search setting group.

    • <KeywordTerm> is the keyword term string name of an existing keyword.

See also

Microsoft.SharePoint.Search.Extended.Administration.Keywords Namespace

Get-FASTSearchSearchSettingGroup

Display all synonyms

  1. Verify that you meet the following minimum requirements: You are a member of the FASTSearchAdministrators local group on the computer where FAST Search Server 2010 for SharePoint is installed.

  2. On the Start menu, click All Programs.

  3. Click Microsoft FAST Search Server 2010 for SharePoint.

  4. Click Microsoft FAST Search Server 2010 for SharePoint shell.

  5. At the Windows PowerShell command prompt, get all search setting groups:

    Get-FASTSearchSearchSettingGroup
    
    >>Name        : 9c65a55f-eafc-451d-b0f5-56fbed465141
    >>Description :
    >>Id          : 1
    >>LastChanged : 10/19/2010 9:04:46 AM
    
    
  6. Display all synonyms:

    $searchSettingGroup = Get-FASTSearchSearchSettingGroup -Name "<SearchSettingGroupName>" 
    foreach ($keyword in $searchSettingGroup.Keywords) { $keyword.Synonyms }
    

    Where:

    • <SearchSettingGroupName> is the name of an existing search setting group.

See also

Keyword.Synonyms Property

Get-FASTSearchSearchSettingGroup

Turn off recall for synonyms

When a search is rewritten because of keyword synonyms, search performance is affected. The degree of search latency increase depends on:

  • The number of synonyms added to the search.

  • The number of documents in the corpus.

  • The number of terms in each synonym, if it is a phrase.

If you do not want the increased recall from synonyms, or if the search latency increase is unacceptable, you can turn off recall of keyword synonyms by changing a configuration option. On every FAST Search Server 2010 for SharePoint server that runs the query service, follow these steps:

  1. You are a member of the FASTSearchAdministrators local group on the computer where FAST Search Server 2010 for SharePoint is installed.

  2. On the FAST Search Server 2010 for SharePoint administration server, open <FASTSearchInstallationFolder>\META\config\profiles\default\templates\installer\etc\admin.config.template in a text editor (<FASTSearchInstallationFolder> is the path of the folder where you have installed FAST Search Server 2010 for SharePoint, for example C:\FASTSearch).

  3. Replace this line:

    <add key="SynonymQueryRecall" value="true" />
    

    with the following:

    <add key="SynonymQueryRecall" value="false" />
    
  4. Save the file.

  5. Stop the FAST Search for SharePoint service.

  6. On the Start menu, click All Programs.

  7. Click Microsoft FAST Search Server 2010 for SharePoint.

  8. Click Microsoft FAST Search Server 2010 for SharePoint shell.

  9. At the Windows PowerShell command prompt, type the following command:

    Set-FASTSearchConfiguration
    
  10. Start the FAST Search for SharePoint service.

See also

Set-FASTSearchConfiguration