Monday, September 23, 2013

Creating crawled properties with SharePoint 2010 and FAST

When you do a lot of work with FS4SP you sort of forget that trivial tasks may not be so trivial for those outside your nose tip. Recently at a customer another developer was adding some new <meta> tags to a SharePoint page, and he was trying to script the crawled properties (cp) in order to move them between the environments.

Yes, you may always kick off new crawls to get the cp’s created, and then map them manually, but this is often not doable as you don’t have access to Central Admin or the servers once you move out from your test environment. Hence, you send over deployment scripts.

The issue this time was which Crawled Category group will the crawled property appear in, and once you have the name, what’s the GUID, which you need to script it as it doesn’t take the name (the reason being a group may have more than one GUID/group associated behind the scenes… figures!?)?

To help out, I figured I’d list the GUID’s needed when creating crawled properties for the most used categories:

Category GUID Notes
SharePoint 00130329-0000-0130-c000-000000131346 All columns in SharePoint will have a crawled property created by default in this category with the ows_ prefix.
Web d1b5d3f0-c0b3-11cf-9a92-00a0c908dbf1 All pages of type HTML will have <meta> tags added as crawled properties in this category. It does not matter which crawler was used, SharePoint, Web, File.

The type of the value is always text (variant type 31).
Business Data – BCS 2edeba9a-0fa8-4020-8a8b-30c3cdf34ccd Columns from BCS connections appear in this category.

The easiest way to get the right GUID is by kicking off a crawl, and then inspecting the properties of one of the auto-generated crawled properties. You may also run the following PowerShell commands, which may yield more than one GUID, and might not help out that much:

$cat = Get-FASTSearchMetadataCategory "Web"
$cat.GetPropsetMappings()

Guid
----
d1b5d3f0-c0b3-11cf-9a92-00a0c908dbf1
70eb7a10-55d9-11cf-b75b-00aa0051fe20
c82bf596-b831-11d0-b733-00aa00a1ebd2
c82bf597-b831-11d0-b733-00aa00a1ebd2


You can learn how to work with crawled and managed properties via PowerShell over at TechNet - http://technet.microsoft.com/en-us/library/ff191246(v=office.14).aspx