Sunday, July 24, 2011

Creating a scope to limit by content collection

When working with FAST Search Server for SharePoint and especially if you are using one of the custom FAST connectors you will usually create additional content collections with the command: New-FASTSearchContentCollection
2430680365_410bc05f07_mThis will logically separate content from for example the FAST Enterprise Web Crawler from content indexed from SharePoint into the sp collection (which is the default collection for the FAST Content SSA).

What if you want to show results only from the web crawl? If it had been a content source on the FAST Content SSA you could have created a search scope to limit by content source like this:

New-SPEnterpriseSearchQueryScope -SearchApplication "FAST Query SSA" -Name MyContentScope -Description "Content Source Scope" -DisplayInAdminUI 1 -ExtendedSearchFilter 'contentsource:MyContentSourceName'

Since the FAST specific connectors don’t register as content sources on the FAST Content SSA we have to use an old FAST ESP trick instead. A content collection is merely a logical grouping of content inside the search index, and each collection will have meta data per item informing us of which content collection the item belongs to.

By creating a scope on the meta.collection property, we achieve what we set out to, limit the results per content collection.

If your content collection for the web crawl is named web, then the following PowerShell command would create a scope which filters on the web collection.

New-SPEnterpriseSearchQueryScope -SearchApplication "FAST Query SSA" -Name MyCollectionScope -Description "Collection Scope" -DisplayInAdminUI 1 -ExtendedSearchFilter 'meta.collection:web'