Create and configure search for new Custom Scopes


Hi,

Concept of search scopes was introduced just to allow user to narrow the searches on the basis of the content sources, external sites and metadata properties. Scopes are the integral part of the search UI by providing user to select the desired scope using the drop down. These can also be per-configured search web parts such as search result web part.

Scopes works on the logically “And” option on user searches. Suppose if you have defined a scope for a content type then search results will be narrowed down only for specified content type. 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.

Create a Search scope:

Open up Central Administration, go to Manage Service Applications, click on your Search Service Application and then click on manage on the ribbon. This takes you to the search administration page.

On the left hand side under Queries and Results click on Scopes

SharePoint 2010 Central Administration

Then click on New Scope, 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. In my case, I will be creating a new scope for news content type.

You are taken back to the scopes page and you can see the new custom scope that we just created. Now we need to add the rules that make the scope work, so click on Add rules.

First we want to add all of the content sources that you would like to find tasks on. This allows you to not include tasks on a certain site if you would like, it also it want allows you to get tasks from another farm. You will only be able to configure this for sources that you have indexing configured. So if you are looking to find tasks on another farm you have to setup that connection to have it indexed first.

Scope Rule Types

There are four search scope rule types.

1) 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. FolderIncludes 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 NameLimits content to a particular server name.
    3. Domain or Sub Domain – Limits content to a specific, fully qualified domain name such as contoso.com.

2)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.

    1. 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.
    2. 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.

If you don’t see ContentType as an option when creating this rule, go to Search Service Application –> Metadata Properties and then edit the managed property and set All this property to be used in scopes. Then repeat the steps above.

Next step is to take a long breath and relax till new scope will be ready for use.

After the waiting part we’ll get:

Configure Site to use new scope:

1) Create a search page:

Go To Search > Site Actions > All Site Content > Pages.

Open the pages library and from the ribbon click on document and then click on New Document > Page.

Select the “(Welcome Page)Search box” option

Fill in all the necessary field and click on Create. DON’T FORGET TO CHECK IN YOUR PAGE.

2) Create a search result page: Go To Search > Site Actions > All Site Content > Pages > Add New Page

In this step we’ll create a search result page.

Fill in all the necessary field and click on Create. DON’T FORGET TO CHECK IN YOUR PAGE.

3) Create a search page tab:Go To Search > Site Actions > All Site Content > Tabs in Search Page > Add New Item

In this step we’ll add a tab in our search linked to the search page.

Fill in all the necessary field and click on Save.

4) Create a search result page tab: Go To Search > Site Actions > All Site Content > Tabs in Search Results> Add New Item

In this step we’ll add a tab in our search results linked to the search result page.


Fill in all the necessary field and click on Save.

Let’s look in our search.

Nice, but it doesn’t work yet. We haven’t linked our scope to our results yet.

5) Adding Search to Search Results.

  • Go to correct search page(NewsArticle.aspx) and edit page.
  • Do and edit webpart on the search box.
  • Change the result page under Miscellaneous and click OK.
  • Save page and DON’T FORGET TO CHECK IN

Adding the scope to the search results.

  • Go to the search result pages and edit page
  • Edit webpart on the Search Core Results
  • Change the scope under Location and click OK.
  • Save page and DON’T FORGET TO CHECK IN

and done.

You will see that if you do a deeper search starting from the results pages, he will search in ALL Sites instead of Base. Change the resultpage for the search box on the result pages  and that will be fixed also.

Happy SharePoint Searching…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s