Condividi tramite


Add, remove and display user contexts by using Windows PowerShell (FAST Search Server 2010 for SharePoint)(informazioni in lingua inglese)

Aggiornato: 10 febbraio 2011

This article describes how to manage user contexts by using Windows PowerShell. For information about how to manage user contexts by using the graphical user interface, see Manage FAST Search user contexts (Office.com). Please note that only users with Primary- or Secondary Site Collection Administrator rights can manage user contexts via the graphical user interface.

In this article the following Windows PowerShell procedures are described:

  • Create a user context

  • Display all user contexts

  • Remove a user context

  • Remove all user contexts

  • Add a user context to a synonym

  • Remove a user context from a synonym

  • Add a user context to a Best Bet

  • Remove a user context from a Best Bet

  • Add a user context to a Visual Best Bet

  • Remove a user context from a Visual Best Bet

  • Add a user context to a document or site promotion

  • Remove a user context from a document or site promotion

Create a user context

  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. Create a user context:

    $searchSettingGroup = Get-FASTSearchSearchSettingGroup -Name "<SearchSettingGroupName>" 
    $context = $searchSettingGroup.Contexts.AddContext("<ContextName>")
    $andExpression = $context.AddAndExpression()
    $orExpression = $andExpression.AddOrExpression()
    $orExpression.AddMatchExpression("<PropertyName0>","<PropertyValue0>")
    $orExpression.AddMatchExpression("<PropertyName1>","<PropertyValue1>")
    $notExpression = $andExpression.AddNotExpression()
    $notExpression.AddMatchExpression("<PropertyName2>","<PropertyValue2>")
    

    Where:

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

    • <ContextName> is the name of the user context you want to create.

    • <PropertyName0> is the name of a user context property to be added to the context.

    • <PropertyValue0> is the value of the corresponding user context property (<PropertyName0>) to be used in the context expression.

    • <PropertyName1> is the name of a user context property to be added to context.

    • <PropertyValue1> is the value of the corresponding user context property (<PropertyName1>) to be used in the context expression.

    • <PropertyName2> is the name of a user context property to be added to context.

    • <PropertyValue2> is the value of the corresponding user context property (<PropertyName2>) to be used in the context expression.

Nota

A user context forms a logical match expression which is evaluated when executing a search. You can make the expression arbitrarily complex by adding AND, OR, and NOT expressions. The procedure above creates an expression with the form: (<PropertyName0>:<PropertyValue0>OR<PropertyName1>:<PropertyValue1>) AND (NOT (<PropertyName2>:<PropertyName2>))

See also

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

Get-FASTSearchSearchSettingGroup

Display all user contexts

  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 user contexts:

    $searchSettingGroup = Get-FASTSearchSearchSettingGroup -Name "<SearchSettingGroupName>" 
    $searchSettingGroup.Contexts
    

    Where:

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

See also

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

Get-FASTSearchSearchSettingGroup

Remove a user context

  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 user context:

    $searchSettingGroup = Get-FASTSearchSearchSettingGroup -Name "<SearchSettingGroupName>" 
    $searchSettingGroup.Contexts.RemoveContext("<ContextName>")
    

    Where:

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

    • <ContextName> is the name of the user context you want to remove.

See also

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

Get-FASTSearchSearchSettingGroup

Remove all user contexts

  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 user contexts:

    $searchSettingGroup = Get-FASTSearchSearchSettingGroup -Name "<SearchSettingGroupName>" 
    $searchSettingGroup.Contexts.Clear()
    

    Where:

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

See also

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

Get-FASTSearchSearchSettingGroup

Add a user context to a synonym

  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 user context to a synonym:

    $searchSettingGroup = Get-FASTSearchSearchSettingGroup -Name "<SearchSettingGroupName>" 
    $keyword = $searchSettingGroup.Keywords.GetKeyword("<KeywordTerm>")
    $synonym = $keyword.Synonyms.GetSynonym("<SynonymTerm>")
    $synonym.Contexts.AddContext("<ContextName>")
    

    Where:

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

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

    • <SynonymTerm> is the synonym term that you want to add a user context to.

    • <ContextName> is the name of an existing user context to be added to the synonym.

See also

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

Get-FASTSearchSearchSettingGroup

Remove a user context from a synonym

  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 user context from a synonym:

    $searchSettingGroup = Get-FASTSearchSearchSettingGroup -Name "<SearchSettingGroupName>" 
    $keyword = $searchSettingGroup.Keywords.GetKeyword("<KeywordTerm>")
    $synonym = $keyword.Synonyms.GetSynonym("<SynonymTerm>")
    $synonym.Contexts.AddContext("<ContextName>")
    

    Where:

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

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

    • <SynonymTerm> is the synonym term that you want to remove a user context from.

    • <ContextName> is the name of an existing user context to be removed from the synonym.

See also

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

Get-FASTSearchSearchSettingGroup

Add a user context to a Best Bet

  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 user context to a Best Bet:

    $searchSettingGroup = Get-FASTSearchSearchSettingGroup -Name "<SearchSettingGroupName>" 
    $keyword = $searchSettingGroup.Keywords.GetKeyword("<KeywordTerm>")
    $bestBet = $keyword.BestBets.GetBestBet("<BestBetName>")
    $bestBet.Contexts.AddContext("<ContextName>")
    

    Where:

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

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

    • <BestBetName> is the name of the Best Bet you want to add a user context to.

    • <ContextName> is the name of an existing user context to be added to the Best Bet.

See also

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

Get-FASTSearchSearchSettingGroup

Remove a user context from a Best Bet

  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 user context from a Best Bet:

    $searchSettingGroup = Get-FASTSearchSearchSettingGroup -Name "<SearchSettingGroupName>" 
    $keyword = $searchSettingGroup.Keywords.GetKeyword("<KeywordTerm>")
    $bestBet = $keyword.BestBets.GetBestBet("<BestBetName>")
    $bestBet.Contexts.RemoveContext("<ContextName>")
    

    Where:

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

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

    • <BestBetName> is the name of the Best Bet you want to remove a user context from.

    • <ContextName> is the name of an existing user context to be removed from the Best Bet.

See also

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

Get-FASTSearchSearchSettingGroup

Add a user context to a Visual Best Bet

  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 user context to a Visual Best Bet:

    $searchSettingGroup = Get-FASTSearchSearchSettingGroup -Name "<SearchSettingGroupName>" 
    $keyword = $searchSettingGroup.Keywords.GetKeyword("<KeywordTerm>")
    $visualBestBet = $keyword.FeaturedContent.GetFeaturedContent ("<VisualBestBetName>")
    $visualBestBet.Contexts.AddContext("<ContextName>")
    

    Where:

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

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

    • <VisualBestBetName> is the name of the Visual Best Bet you want to add a user context to.

    • <ContextName> is the name of an existing user context to be added to the Visual Best Bet.

See also

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

Get-FASTSearchSearchSettingGroup

Remove a user context from a Visual Best Bet

  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 user context from a Visual Best Bet:

    $searchSettingGroup = Get-FASTSearchSearchSettingGroup -Name "<SearchSettingGroupName>" 
    $keyword = $searchSettingGroup.Keywords.GetKeyword("<KeywordTerm>")
    $visualBestBet = $keyword.FeaturedContent.GetFeaturedContent("<VisualBestBetName>")
    $visualBestBet.Contexts.RemoveContext("<ContextName>")
    

    Where:

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

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

    • <VisualBestBetName> is the name of the Visual Best Bet you want to remove a user context from.

    • <ContextName> is the name of an existing user context to be removed from the Visual Best Bet.

See also

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

Get-FASTSearchSearchSettingGroup

Add a user context to a document or site promotion

  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 user context to a document or site promotion:

    $searchSettingGroup = Get-FASTSearchSearchSettingGroup -Name "<SearchSettingGroupName>" 
    $keyword = $searchSettingGroup.Keywords.GetKeyword("<KeywordTerm>")
    $promotion = $keyword.Promotions["<PromotionName>"]
    $promotion.Contexts.AddContext("<ContextName>")
    

    Where:

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

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

    • <PromotionName> is the name of the document or site promotion you want to add a user context to.

    • <ContextName> is the name of an existing user context to be added to the document or site promotion.

See also

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

Get-FASTSearchSearchSettingGroup

Remove a user context from a document or site promotion

  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 user context from a document from site promotion:

    $searchSettingGroup = Get-FASTSearchSearchSettingGroup -Name "<SearchSettingGroupName>" 
    $keyword = $searchSettingGroup.Keywords.GetKeyword("<KeywordTerm>")
    $promotion = $keyword.Promotions["<PromotionName>"]
    $promotion.Contexts.RemoveContext("<ContextName>")
    

    Where:

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

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

    • <PromotionName> is the name of the document or site promotion you want to remove a user context from.

    • <ContextName> is the name of an existing user context to be removed from a document or site promotion.

See also

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

Get-FASTSearchSearchSettingGroup

Cronologia delle modifiche

Data Descrizione Motivo

10 febbraio 2011

2011/02/07

Aggiornamento contenuto

12 maggio 2010

Pubblicazione iniziale