Saturday, July 23, 2011

SharePoint 2010 Search Scopes Explained

Technorati Tags: ,,

Search scopes enable users to narrow their searches based on content sources, web addresses, and metadata. This makes it easier for the user to search. Scopes are an integral part of the search user interface allowing users to choose a scope before performing a search query. Scopes can also be used to pre-configure search web parts such as the Search Results Web Part.

What is a Search Scope?

Scopes can be considered pre-built search criteria that are logically “AND” to users’ searches. They represent specific content or topics that are common or important to users. For example, you can define a scope for items that relates to a particular group in the organization such as Human Resources (HR) or Marketing. You can also create a search scope that encompasses several other scopes. In addition, you can set search scopes at both the search service application level and at the site administration level. Search scopes set at the service application level are available to all sites and site collections within the service application. These scopes cannot be modified or deleted at the site administration level.

A scope is made up of a title that the user sees when choosing it from a Search Web Part. The description describes what the scope represents. This is for administrative purposes. The Target Results page gives you the ability to use the Default Results page or specify a Custom Results page.

The rule represents the condition or criteria for defining the subset of content. Rules can have different types of conditions and behaviors. An administrator can create a complicated scope by chaining together different rules. This lets users easily append complicated query conditions to their searches.

Scope Rule Types

There are four search scope rule types.

  • Web Address Rules -  This type of rule can incllude content in web sites, file shares, exchange public folders, or any other content in the search index that has a URL. These can include the following.
    1. Folder - Includes items in the folder and subfolders that pertain to the indicated path.  With SharePoint URLs you can create rules that include or exclude different elements, such  as a site or a particular folder.
    2. Host Name - Limits content to a particular server name.
    3. Domain or Sub Domain - Limits content to a specific, fully qualified domain name such as
  • Property Query Rules - Limits content where a managed property is equal to a certain value. Only managed properties that have the “Allow this property to be used in scopes.” option checked can be used to limit content.
  • Content Source Rules - Enables you to limit content to a particular content source. This is useful if your service application has numerous content sources and you want to limit the scope to just a SharePoint content source or more granular types of content sources such as My Sites or Team Sites.
  • All Content Rules - Includes all content. Enables the construction of a more complicated scope that includes many rules. For example, you can combine this rule with an Exclude Content source rule. By doing so, the scope contains all content except possibly a file share content source.

Scope Rule Behaviors

Scope rule behaviors enable administrators to combine multiple rules together using simple logic. This simple logic enables administrators to create precise subsets of content. The recommended limit for the number of rules per scope is 100 or 600 per service application.

There are three types of rule behaviors:

  • Include - Any item that matches this rule is included, unless the item is excluded by another rule. Use this option to apply an “OR” rule.
  • Required - Every item in the scope must match this rule. Use this option to apply an “AND” rule.
  • Exclude - Items matching this rule are excluded from the scope. Use this option to apply an “AND NOT” rule.


Search Scope Example

An administrator can create multiple rules for a scope to define a precise set of content.

The above example illustrates how SharePoint evaluates the rules contained in a scope and determines what content is included.

All Include rules are applied with an OR; the required rules are applied with an AND; and the Exclude rules are applied with an AND (NOT ..).

For example, as a site administrator you can create a scope to limit a user’s query to match only documents in the team site, or have a title of Monthly Budget, and are not located in the archive site.

Rule Type



Web Address




Title = “Monthly Budget”



IsDocument = 1


Web Address



If the user searches for a keyword of April along with the above scope, the actual query would look like this:

April AND ((Title = ‘Monthly Budget’ OR CONTAINS(Path, ‘http://servername/teamsite’) AND IsDocument = 1 AND NOT CONTAINS(Path, ‘http://servername/archivesite’))

SharePoint search scopes effectively build complicated filter conditions to determine the subset of content. They are logically appended with an AND operator to the user’s query. The user does not have to remember the complicated conditions to append the query, but only needs to remember the name of the scope.

Types of Scopes

There are two types of Scopes in SharePoint

  • Shared - Defined in the Search Service Application and can be used by all site collections in the farm associated with the Search Service Application.
  • Site level -  Defined at the site collection level by a site collection administrator and can be used only in the site collection

Shared scopes can be used across the farm by all site collections by defining the scope using the Search Service Application in Central Administration. The shared scopes are propagated to the site collections through a scheduled timer job, after which they become available to other site collections.

You can control what shared scopes are displayed in the site collection from the Site Collection Administration Search Scopes page.

On this page you can control what scopes can be displayed in either the Search Drop Down or Advanced Search Web Parts. This page can also be used to define site collection scopes that can be used only within the current site collection and sub sites. Shared scopes cannot be modified or deleted at the site administration level.

How Scopes Affect Search

Using scopes in a query can affect the performance. The default behavior is to execute scope rules during query execution when the number of rules is less than 25. This can increase the time it takes to return results. Scopes with rules greater than 24 are compiled and cached.

To speed up query performance, use Windows PowerShell to set a scope’s CompilationType to AlwaysCompile. However, this affects crawl performance because rules are evaluated during the crawl.

Windows PowerShell example:

$app = Get-SPEnterpriseSearchServiceApplication
$scope = $app | Get-SPEnterpriseSearchQueryScope -Identity "MyScope“
$scope.CompilationType = “AlwaysCompile“


How Scopes Affect User Search

Scopes enhance the user search process by making it easier for users to construct searches. Users can append keywords to a selected scope.


Complicated scopes can be constructed that make it easy for users to append keywords or property queries to a selected scope. Users do not need to remember all the rules behind a scope. Instead they need only recall the name of the scope and what it represents. This helps users find what they are looking for by segregating content into manageable and understandable subsets.

In addition, scopes can be used to direct users to custom search results pages to further enhance the search experience. However, to avoid confusion, care must be taken not to create too many scopes. Users must be educated on what each scope represents in order to use scopes effectively. Limit the number of scopes in the drop-down list to no more than 10.


This post was about explaining the makeup of a SharePoint Search Scope and benefits of using them in your search user interface. This is limited to SharePoint Search and does not cover FAST search.  There is a lot of content about how to manage and configure scopes but nothing about the purpose of using them. Hopefully, this help illuminate the benefits and encourage you to use them.

Tuesday, July 19, 2011

SharePoint Server MVP 2011

Technorati Tags: ,,

Earlier this month I was notified that I had been awarded Microsoft’s MVP for SharePoint Server for 2011. This is my third year in a row. I am proud to be part of this awesome community. Being able to share my knowledge in the MSDN forums is a rewarding experience. The forum is a great place to help others get the most out of an amazing Microsoft product. SharePoint 2010 is now being recognized as a legitimate ECM platform. Also, I am glad I am part of a great team of developers at KnowledgeLake. KnowledgeLake is always looking to add value to SharePoint as an ECM platform, and for that I am thankful.