Udostępnij za pośrednictwem


Create and view search scopes (FAST Search Server 2010 for SharePoint)

 

Applies to: FAST Search Server 2010

In FAST Search Server 2010 for SharePoint a search scope is a pre-defined property filter expression that is specified in FAST Query Language (FQL) syntax. If you create the search scope by using the SharePoint graphical user interface, the FAST scope filter is auto-generated based on the rules created for the scope. If you have to specify more complex rules in the scope than what is available in the scope rule user interface, you can create or edit the scope by using Windows PowerShell. You specify the scope filter as a string according to the FQL query syntax. A scope filter can consist of any FQL syntax.

Note

In FAST Search Server 2010 for SharePoint, users can search two or more scopes by using "AND" only. Linking scopes with "OR" and "AND NOT" is not supported. This is regardless of whether users search by using Keyword Syntax or if they use the Only the scope(s) option in Advanced Search. The search will only return results that are found in all selected scopes.

The number of items that are returned by the scope, will not be displayed in the View Scopes list. To see the number of items, you can run a query using the scope on the Search Center site, and then view the number of results in the result list.

A search scope is a query-time feature, and does not affect the index or index schema.

Note

Scope matching does not include stemming and synonyms.

In this section:

  • Create search scopes by using the graphical user interface

  • Create a search scope at the search service application level by using Windows PowerShell

  • Create a site-level search scope by using Windows PowerShell

  • Create a site-level search scope that searches a full-text index by using Windows PowerShell

  • View the FAST Query Language (FQL) filter for a search scope at the search service application level by using Windows PowerShell

  • View the FAST Query Language (FQL) filter for a site level search scope by using Windows PowerShell

  • Make scopes available on the Search Center site

Create search scopes by using the graphical user interface

You can set search scopes both at the Search service application level (farm-level) and at the site administration level. This topic describes how to create a search scope and add a scope rule at the service application level for a FAST Query SSA by using the graphical user interface.

Note

If you create the scope by using the user interface and then manually change the auto-generated filter by using Windows PowerShell, your changes will not be reflected in the scope rules shown in the user interface.

To create a search scope at the search service application level using the graphical user interface

  1. Verify that the user account that is performing this procedure is a service application administrator for the FAST Query Search service application (FAST Query SSA).

  2. In Central Administration, in the Application Management section, click Manage service applications.

  3. On the Manage Service Applications page, in the list of service applications, click FAST Query SSA (the name of the FAST Query SSA).

  4. On the Search Administration page, in the Quick Launch, under Queries and Results, click Scopes.

  5. To create a new scope, click New Scope.

  6. In the Title and Description section, type a title and description for the search scope.

  7. In the Target Results Page section, select one of the following options:

    • Use the default Search Results Page. Select this option if you want search results from this search scope to be presented by using the standard Search Results page (Searchresults.aspx).

    • Specify a different page for searching this scope. Select this option if you want search results from this search scope to be presented on a custom webpage. If you select this option, in the Target results page box, type the URL for the custom search results page.

  8. Click OK to create the scope and return to the View Scopes page.

To add scope rules to the scope

  1. On the View Scopes page, in the list of scopes, point to the name of the scope that you want to edit, click the arrow that appears, and then click Edit Properties and Rules.

  2. To add a new rule, on the Scope Properties and Rules page, in the Rules section, click New Rule.

  3. In the Scope Rule Type section, select one of the following options:

    • Web Address. Select this option if you want the scope to include or exclude content from any resource in the search index that can be identified either by a URL (such as Web sites, file shares, and Microsoft Exchange Server public folders) or by a host name, domain name, or subdomain name.

    • Property Query. Select this option if you want the scope to include or exclude content that has a managed property that has a particular value. For example, Author="John Doe".

      If the property that you want to use in the scope is not available in the Property Query list, see Make FAST Search Server 2010 for SharePoint properties available for use in scopes.

      If you want the scope to include or exclude content that was crawled by using a particular content source, click Property Query and select ContentSource from the list. Enter a value for the content source property, for example Local SharePoint sites.

    • All Content. Select this option if the rule should not restrict the scope (the scope will include or exclude all content in the index).

  4. In the Behavior section, select an option to specify how this rule combines with other rules to define the scope:

    • Include – Any item that matches this rule will be included, unless the item is excluded by another rule. Use this option to apply an “OR” rule.

    • Require – Every item in the scope must match this rule. Use this option to apply an “AND” rule.

    • Exclude – Items matching this rule will be excluded from the scope. Use this option to apply an “AND NOT” rule.

  5. Click OK.

Make FAST Search Server 2010 for SharePoint properties available for use in scopes

The managed properties that are listed in the Property Query list under scope rules are the managed properties that are defined in the Search Server schema. Out of the box, FAST Search Server 2010 for SharePoint and Search Server have the same properties, and the FAST Search Server 2010 for SharePoint properties will also be available in the Property Query list.

If you create a new managed property for FAST Search Server 2010 for SharePoint to be used in scopes, you must also add the same managed property in Search Server. The Search Server property will only be a placeholder that is used to populate the Property Query list.

To make managed properties available for scopes, also make sure that the Allow this property to be used in scopes option is selected for the property.

To add a placeholder managed property to populate the Property Query list

  1. Verify that the user account that is performing this procedure is an administrator for the Search service application.

  2. In Central Administration, in the Application Management section, click Manage service applications.

  3. On the Manage Service Applications page, in the list of service applications, click FAST Query SSA (the name of the FAST Query SSA).

  4. On the Search Administration page, in the Quick Launch, under Queries and Results, click Metadata Properties.

  5. On the Metadata Property Mappings page, click New Managed Property.

  6. On the New Managed Property page, in the Property name box in the Name and type section, type the name of the managed property.

  7. In the Description box, type a description of the property, for example that this is a placeholder property only.

  8. On the New Managed Property page, in the Use in scopes section, select the Allow this property to be used in scopes check box.

  9. Click OK. You do not have to fill in any of the other options on this page as the purpose of adding this managed property is to populate the Query Property list.

Create a search scope at the search service application level by using Windows PowerShell

  1. Verify that you have Farm Administrator permissions.

  2. On Microsoft SharePoint Server, open a SharePoint 2010 Management Shell:

    1. On the Start menu, click All Programs.

    2. Click Microsoft SharePoint 2010 Products.

    3. Click SharePoint 2010 Management Shell.

  3. At the command prompt, type the following command:

    New-SPEnterpriseSearchQueryScope -SearchApplication "<SearchApplication>" -Name <ScopeName> -Description "<ScopeDescription>" 
    -DisplayInAdminUI 1 -ExtendedSearchFilter "<FQL_Expression>"
    

    Where:

    • <SearchApplication> is the name of the Query Search Service Application (SSA).

    • <ScopeName> is the name of the new scope.

    • <ScopeDescription> is a description of the scope.

    • <FQL_Expression> is the FAST Query Language (FQL) query expression that represents the scope filter.

      Note

      Any managed property names that are used in the FQL expression must be written in lowercase, even if the name of the managed property contains uppercase letters.

When a scope is created, it may take some minutes before the scope is available. To verify that the scope is active, run a query using the scope in the query. If the scope is not available, the query will return an error message.

See also

FAST Query Language (FQL) Syntax Reference

Create a site-level search scope by using Windows PowerShell

This example creates a site-level scope and adds a FAST Query Language (FQL) filter that limits the result set to items from two specific sites.

  1. Verify that you have Farm Administrator permissions.

  2. On Microsoft SharePoint Server, open a SharePoint 2010 Management Shell:

    1. On the Start menu, click All Programs.

    2. Click Microsoft SharePoint 2010 Products.

    3. Click SharePoint 2010 Management Shell.

  3. At the command prompt, type the following command:

    New-SPEnterpriseSearchQueryScope -SearchApplication "<SearchApplication>" -Name <ScopeName> -Description "<ScopeDescription>" 
    -DisplayInAdminUI 1 -OwningSiteUrl "<OwningSiteURL>"
    $scope = Get-SPEnterpriseSearchQueryScope -SearchApplication "<SearchApplication>" " -Identity "<ScopeName>"
    $scope.Filter = 'site:or("<ScopeSite1URL>", "<ScopeSite2URL>"' 
    $scope.Update()
    

    Where:

    • <SearchApplication> is the name of the Query Search Service Application (SSA).

    • <ScopeName> is the name of the new scope.

    • <ScopeDescription> is a description of the scope.

    • <OwningSiteURL> is the URL of the site you want to define the scope for.

    • <ScopeSite1URL> is the URL of the first site to include in the search scope.

    • <ScopeSite2URL> is the URL of the second site to include in the search scope.

When a scope is created, it may take some minutes before the scope is available. To verify that the scope is active, run a query using the scope in the query. If the scope is not available, the query will return an error message.

See also

FAST Query Language (FQL) Syntax Reference

Create a site-level search scope that searches a full-text index by using Windows PowerShell

This example creates a scope with a FAST Query Language (FQL) filter on titles that contain the word "vista" searching a full-text index.

  1. Verify that you have Farm Administrator permissions.

  2. On Microsoft SharePoint Server, open a SharePoint 2010 Management Shell:

    1. On the Start menu, click All Programs.

    2. Click Microsoft SharePoint 2010 Products.

    3. Click SharePoint 2010 Management Shell.

  3. At the command prompt, type the following command:

    New-SPEnterpriseSearchQueryScope -SearchApplication "<SearchApplication>" -Name <ScopeName> -Description "<ScopeDescription>" 
    -DisplayInAdminUI 1 -ExtendedSearchFilter "title:vista,FullTextIndex=<FullTextIndex>" -OwningSiteUrl "<OwningSiteURL>"
    

    Where:

    • <SearchApplication> is the name of the Query Search Service Application (SSA).

    • <ScopeName> is the name of the new scope.

    • <ScopeDescription> is a description of the scope.

    • <FullTextIndex> is the name of the full-text index you want to include in the search scope.

    • <OwningSiteURL> is the URL of the site you want to define the scope for.

See also

FAST Query Language (FQL) Syntax Reference

View the FAST Query Language (FQL) filter for a search scope at the search service application level by using Windows PowerShell

  1. Verify that you have Farm Administrator permissions.

  2. On Microsoft SharePoint Server, open a SharePoint 2010 Management Shell:

    1. On the Start menu, click All Programs.

    2. Click Microsoft SharePoint 2010 Products.

    3. Click SharePoint 2010 Management Shell.

  3. At the command prompt, type the following command:

    $scope = Get-SPEnterpriseSearchQueryScope -SearchApplication "<SearchApplication>" "<ScopeName>"
    $scope.Filter
    

    Where:

    • <SearchApplication> is the name of the Query Search Service Application (SSA).

    • <ScopeName> is the name of the scope.

View the FAST Query Language (FQL) filter for a site level search scope by using Windows PowerShell

  1. Verify that you have Farm Administrator permissions.

  2. On Microsoft SharePoint Server, open a SharePoint 2010 Management Shell:

    1. On the Start menu, click All Programs.

    2. Click Microsoft SharePoint 2010 Products.

    3. Click SharePoint 2010 Management Shell.

  3. At the command prompt, type the following command:

    $scope = Get-SPEnterpriseSearchQueryScope -SearchApplication "<SearchApplication>" "<ScopeName>" -Url "<SiteURL>" 
    $scope.Filter
    

    Where:

    • <SearchApplication> is the name of the Query Search Service Application (SSA).

    • <ScopeName> is the name of the scope.

    • <SiteURL> is the URL of the site for which the scope is defined.

Make scopes available on the Search Center site

After a scope is defined, a site collection administrator can make the scope available to users on the Search Center site.

To define which scopes that will be available

  1. Verify that you have site collection administrator permissions.

  2. On the top level site, click Site Actions, and then click Site Settings.

  3. Under Site Collection Administration, click Search scopes.

  4. Click Display Groups.

  5. Click Search Dropdown.

  6. In the Scopes section, select which scopes that you want to display in the dropdown, and specify the order in which the scopes will be displayed.

  7. Click OK.

To display scopes in the Search Box Web Part on the Search Center site

  1. On the Search Center site, click the Site Actions menu, and then click Edit Page.

  2. Click the arrow in the Search Box Web Part menu, and then click Edit Web Part.

  3. Under Scopes Dropdown, select Show scopes dropdown.

  4. In the Dropdown label box, type the text you want to be displayed as the name for the scope drop-down list on the Search Center site.

  5. Click OK.

  6. Repeat these steps for the Search Box Web Part on the Search Results page.