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'

7 comments:

  1. Just the one I am looking for, thanks for sharing.

    ReplyDelete
  2. Is 'meta.collection' a managed property? I have created a new scope for an existing Fast collection having documents but SP central administration (view scopes) shows the new scope as 'Empty' and I cannot find meta.collection when I click on 'add rules' or in the list of managed properties. It looks like using a web address or a different managed property in the rules section will fix this but just curious where meta.collection fits into this picture.

    ReplyDelete
  3. meta.collection is not a managed property, but an internal property of FAST. It is not mentioned anywhere in the FAST for SharePoint documentation afaik, but it is well documented in the FAST ESP docs :)

    As for scopes showing "empty" this is expected behavior with FAST, as the scope is not calculated beforehand like the built-in search.

    Also central admin will not show scope filters created with fql, only the scope name. That's why my mantra is to always use powershell for scopes and FAST for SharePoint.

    ReplyDelete
  4. Hi,

    How about if we need to do a scope refined by the collection and we also need to exclude some managed properties?

    ReplyDelete
  5. All operators of fql is listet at http://msdn.microsoft.com/en-us/library/ff394462.aspx

    But you can do it like this:

    andnot(meta.collection:web, myprop:"val", myprop2:"val2)

    This will match for the collection, and exclude for myprop and myprop2.

    ReplyDelete
  6. So it excludes selected managed properties (myprop and myprop2 which has "val" or "val" value inside? This doesn't support wildcard? I need to totally exclude some managed properties.

    ReplyDelete
  7. Hi,
    You cannot do "exlude any item which has content at all". That's not possible. If you want to do this create an external item processor which outputs a new prop called "MyPropHasValue" which is bool.. then you can filter on this later on... much like the managed prop called IsDocument.

    ReplyDelete