Excluding folders from search results in MOSS 2007

I recently got a question regarding the ability to filter out folders from search results (but to still search inside those folders for documents) in MOSS 2007.

It’s pretty simple. You’ll need to create a scope with two exclusion rules, assuming you’re crawling both file shares and SharePoint sites (one for file share folders and one for document library folders):

1)      Go into Search Settings -> Metadata Property Mappings

a.       Scroll to the “IsDocument” property and select “Edit/Map Property” from the drop-down menu;  check “Allow this property to be used in scopes”

b.   Do the same with the “ContentType” property

2)      Create a new scope (called “NoFolders” or whatever) and add three rules:

a.       Content Source = All Content

b.      IsDocument=0 (make that one an exclusion rule) – this is for file share folders

c.    ContentType=Folder (also an exclusion rule) – this is for sharepoint document library folders

3)      Run a scope update to refresh the scope contents

4)      Do a search on a term that returns a folder (Say, “office”);   then try another, specifying the scope like this – “office scope:nofolders” (this search should not return folders)

5)      If you want that new scope to be the default (so users don’t have to specify the scope), you can set the scope property of the search results web part on the results.aspx page to use that new scope (or you can create a new tab on the search center page)

Some Other good Practice while Configuring Search

– Using FreeText and Contains makes handling wildcards and phrases very easy when building your SQL query string.

– You can stop Lists appearing in results by adding a search scope rule to exclude items where contentclass = STS_List_GenericList.

This entry was posted in SharePoint 2007, Technical Issue SP2007 and tagged . Bookmark the permalink.

One Response to Excluding folders from search results in MOSS 2007

  1. азартная игра в рулетку says:

    Damn, that sound’s so easy if you think about it.

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