Lars Nielsen's Discoveries

February 19, 2012

Create a search scope for a Site Directory

Filed under: Administration,Search,SharePoint — Lars Nielsen @ 6:52 pm
Tags: ,

Recently I needed to create a custom search page to search the site directory in SharePoint, which tracks new sites as they are being created.  The Site Directory contains a list called “Sites” (internal name SitesList) which tracks all the new sites as they are created.  I had already set up this list with columns to capture metadata about each site as it is created.

To get the search to work I wanted to create a new search scope in the site collection to search only the Sites list in the Site Directory.  To do this I created the new scope in the site collection settings and added a Folder rule to point to the URL of the list (e.g. http://my-domain/SiteDirectory/SitesList) and set the behaviour to be Require.  When this scope updated, it brought in many more items than the number of items in the list.  Perhaps it also brings in the list view ASPX pages as well, I’m not sure.  Anyway I’ve seen that before and I found the solution is to add another rule that restricts the scope to actual items in the list.

To do this, you can create another rule to filter on the ContentType and  contentclass properties and set the second rule to be Require behaviour as well.    The resulting scope will be the intersection of the two rules.  I used the contentclass property, and found a good list of possible values here.  But it took a while to find out what to use for contentclass for items in the Sites list.  Eventually an answer from Steve Curran to this question gave me the answer.  You need to use a rule like this:

contentclass = STS_ListItem_300

So the whole scope configuration looks like this:

Site Directory Scopes screenshot

This will restrict the scope to items in the Sites list in a Site Directory.


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

Create a free website or blog at

%d bloggers like this: