Search scopes are used to limit the
result set by applying rule-based restrictions to the search. Scopes do
not require being a subset of a larger result set. They can define
individual possible result sets.
The benefit of using scopes is the ability they
provide to create a definition for a subset of searchable content or
content in the search index. Scopes can then be used by users as an easy
way of trimming the possible search results. Scopes can be made easily
accessible for users by either creating a search tab with a specially
scoped search and results page or by adding the scope selector on a
search page and results page itself. Examples of typical scopes could be
department-specific content, pre-defined topics, specific content
sources, or groups of people in an organization. It is also possible to
create aggregate scopes that encompass a number of other scopes.
You can set search scopes at both the Search
service application level and at the site administration level. Search
scopes set at the Search 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.
SharePoint 2010 now includes the new refiner Web Part.
The refiner Web Part does offer the user similar functionality to the
scopes. For instance, the refiner can allow the user to refine the
search results by sources such as sites or by properties such as
authors. When planning which scopes to create, this should be taken into
consideration, as opposed to planning scopes for SharePoint 2007.
Note
To avoid having to wait for SharePoint to update its scopes, go to the
Search Administration page, and start an update for the scopes manually
by clicking “Start update now”.
Managing Scopes
Scopes can be defined at either the Search
service application level or site collection level. The only difference
here is the availability and grouping of scopes. Availability means that
scopes created at the SSA level are available to all sites and site
collections throughout the farm. Scopes created at the site collection
level are available only to all sites within that site collection.
Grouping is possible only on the site collection level. It allows the
site collection administrator to define groups of scopes that make sense
as a whole. These groups can then be applied to search Web Parts where
feasible. Scopes created at the SSA level cannot be changed at the site
collection level.
Scopes at SSA Level
To modify scopes on the SSA level, go to Central Administration => Search Service Application => Scopes. This opens the Scopes list, as shown in Figure 1.
Scopes defined at the SSA
level are added to a scope pool called Shared. These scopes are always
available at the site collection level. At the SSA level, it is also
possible to view all scopes defined at the site collection level.
Figure 1. Scopes list page at the SSA level
Scopes at the Site Collection Level
To modify scopes on the site collection level, go to Site Actions => Site Settings => Site Collection Administration => Search scopes.
Scopes inherited from SSA are marked as Shared, as shown in Figure 2.
With the exception of the preconfigured scopes, these scopes are not
added to a display group (described later in this section), but placed
in a separate group called Unused Scopes. Also new scopes created at the
site collection level are placed in the Unused Scopes group unless
otherwise specified during creation.
Figure 2. Scopes list page at the site collection level
Creating New Scopes
Scope creation (Figure 3)
is almost the same on both the SSA and site collection levels. Click
the New Scope link to go to the Create Scope page. On this page, the
scope settings are defined. A scope requires a unique title, which is
used to identify the scope. It can also have an optional description.
On the site collection level, it can be selected
which display groups the scope should be part of. This Display Groups
section is not available when creating scopes from an SSA. The list of
display groups reflects the display groups created by the site
collection administrator. A scope does not have to be mapped to a
display group to be available for search, as it can be specified on the
query string, but it must be mapped to a display group to be available
for selection by users.
The Target Results page can be set to use the
default search results page, or a specific page can be assigned (in case
of cross-site collection searches). For some scopes, it would make
sense to create a special search results page carefully designed to show
search results of a special type. An example of this is the People
search page.
Figure 3. Creating a scope
Scope Rules
Scope rules can be created by applying AND, OR,
NOT rules for a selection of properties. The rule set allows the
administrator to specify the trimming of the search index that this
scope represents. As mentioned earlier, this can be either content
source restrictions or topic filtering. The following types of rules can
be created:
- Web address
- Properties
- Content source (not available on the site collection level)
- All content
Web Address
Rules for web addresses are specified by folder name, hostname, or domain name (Figure 4). The effect of specifying an address is that the results will be limited or excluded, based on the address.
Figure 4. Scope rules—web addresses
Property Query
The most often used scope rule is the property query (Figure 5).
This potentially allows an administrator to create scope rules for all
managed properties as long as they are allowed to be used in scopes.
Figure 5. Scope rules—property query
An often required scope to
create is a document scope. Unfortunately this is not possible without
performing some additional steps, as the IsDocument
property cannot be used in scopes per default. The IsDocument
property defines whether a content type is a document.
The first thing to do is to allow the IsDocument
property to be used in scopes. This is done on the Search service application. Follow these steps to enable the IsDocument
property for scopes:
- Go to the Metadata Properties list in the SSA, and open the
IsDocument
property (Figure 6). Check the “Allow this property to be used in scopes” check box. - Then save the changes.
Figure 6. Edit Managed Property page for IsDocument
property
Now the IsDocument
property can be used in scopes. The next steps are to create a document scope and configure it to use the IsDocument
property.
- Go to the Scopes list in the SSA, and click the New Scope button.
- Create a new scope with the name Documents (Figure 7). Optionally give it a suitable description. Then click OK.
Figure 7. Scope overview page for document scope
With the IsDocument
property configured and the document scope created, a rule must be created on the scope (Figure 8) to make it use the IsDocument
property.
- Click the New Rule button.
- Select the Property Query option for the Scope Rule Type.
- Enter the
IsDocument
property, and give it a value of 1 in the Property Query setting. - Leave the behavior setting as Include, and click OK.
Figure 8. Scope rule page with IsDocument
rule applied
Now the document scope is
created and can be used on search and result Web Parts to give the user
an option to quickly filter content based on whether it is a document.
Content Source
This rule limits or excludes content from the
specified content source. Content sources are the ones defined on the
Search service application, including the default content source named
Local SharePoint Sites (Figure 9).
If content sources are to be used in scope rules, care must be taken to
make them fine-grained enough to fulfill the requirements of the
desired rules. This would typically mean that a content source will be
created per file share or groups in a file share, web site, or similar
entity.
Figure 9. Scope rules—content source
All Content
This is the scope rule used by default in search centers (Figure 10).
For example, if the goal is to search all
content sources except a single one, for the given scope, use this rule
to include all content and then use a second rule for the given scope to
exclude the appropriate content source.
Figure 10. Scope rules—All Content selection
Display Groups
For scopes to be usable in search centers, they must be added to a display group in the site collection.
- Click the Display Groups link to open the Display Group settings page (Figure 11).
- To create a new display group, click New Display Group. This will open the Create Display Group page.
- To edit existing display groups, simply click the appropriate group name.
Figure 11. Scope display groups
On the Scope Display Group page (Figure 12),
it is possible to define one or more scopes to show in a specific
display group. It is also possible to set the default scope and give the
group a meaningful title and description.
- Select which scopes to include in the group and default scope. Then click OK. This will create the new display group.
Figure 12. Editing scope display groups
The newly created display group will now be shown on the Display Groups page, as shown in Figure 13. It also shows how many scopes are included in the display group.
Figure 13. Scope display groups with custom group
- To use the new display group in a search center
(as described in the "Search Core Results" section), set the display
group option of any relevant Web Part to the appropriate group name. The
Web Part will now use the selected display group, as shown in Figure 14.
Figure 14. Example of search box with custom scope and scope group enabled
Adding Search Scope Selector to the Search Box
Most sites contain a search box. Unlike in
SharePoint 2007, the search box does not include a scope drop-down. It
contains only the “Search this site” search box, as shown in Figure 15.
Figure 15. The default site search box
To enable scope selection directly from the search box, do the following:
- Go to Site Actions => Site Settings => Site Collection Administration => Search Settings. This will open the page for managing the search boxes on this site collection, as shown in Figure 16.
Figure 16. Search settings on the site collection level
- From the Site Collection Search Dropdown Mode section, select the “Show and default to contextual scope” option.
- Click OK on the Search Settings page, and validate that the search box now has a scope selector, as shown in Figure 17.
Figure 17. The site search box with scope selector drop-down