Monday, April 7, 2008

Create a new search scope

This is very useful. Say you have several web sites and you don't want to display the same search results on every web site - only the results relevant to the current site! Do this:

Open Central Administration
Open your SSP
Click on "Search settings" and then "Content sources".
There is a list of current content sources, there might just be only one:


Anyway, click "New content source"
Fill in the following fields like this
"Name of the Content Source" = your web site name
"Content Source Type"
"Start Addresses or Applications" (if you choose the Business Data option)
" Crawl Settings and Schedules"
I always enter the name of my content source to the name of the site, it makes it easy to know where it is applied :)
The start address is the URL of my site, for example http://mysite.se/



If the content source is a public site then you may not have to index the site so often. I usually run the Incremental Crawl each hour or so instead.
Now save your settings and perform a Full Crawl on your new Content Source.
When that is done, go back to "Search Settings" and select "View Scopes":



This page shows what scopes this SSP handles. Add a new scope and call it the same name as your content source, ie "mysite". Now, you have to add some rules to your scope:

Click on "Add rules" and add the following:


I checked the "Content Source" so that I could select my content source "mysite". Then I checked "Include" because I want all info on this site to be returned in the search results. Now you have to update your new scope.

Click on "Start update now" from the Search settings page.
When the update is ready, you have to associate the scope to your site. Go to Site Settings on your site, click on "Search Scopes" under "Site Collection Administration". Click on the "Search Dropdown" link:

Now all available scopes are shown including our new scope:

Select your new scope – wow! Uncheck the other scopes, we do not want them on this site.
Your list should now look like this:



Now try your site search. When I did this, other search results STILL showed up. To change this, click on "Edit page" and select "Modify shared webpart" on your search result page. There is a field called "Scope" and even if there is no list to select your scope from, you can simply write in the name of your scope, like "mysite".
Now when you perform a new search, only results from your site will be displayed!

No comments: