Business Data Search in SharePoint 2010: Crawling associated external content types
Business data associations are widely used to fetch related external content (ex. data from two sql tables connected by a foreign key or an email that contains attachments) and display it in SharePoint webparts. SharePoint Search 2010 ships with new features that enable crawling of Business Data Connectivity associations. This post describes how to use the search specific metadata properties for crawling associations and the different user experiences that can be enabled. For a primer on how to define associations, see https://msdn.microsoft.com/en-us/library/ms561493.aspx.
From the search perspective, the source external content type of an association is referred to as the Parent external content type. Search can crawl external content types associated with the parent in two ways, as attachments or as child external content types. Let's look at what this means for the user experience, incremental crawl and deletes.
User experience
A child external content type has its own result URL and profile page (if one is created). This is the URL that will be displayed if a user searches for a keyword in the child external content type data. An attached external content type on the other hand, does not have its own URL. If the user searches for a keyword in the content of the attached external content type instance, the URL for the parent external content type will be displayed. This URL can be set to the profile page URL of the parent. A profile page for the parent external content type will display all the fields of the attached external content type exposed by the association navigator.
Incremental crawl
For a timestamp based incremental crawl if the timestamp of the child external content type instance changes, it will be re-crawled and updated.
The timestamp of the parent external content type instance is interpreted as the timestamp of attached external content type instance. So any change in the attached external content type instance will be picked up by the incremental crawl only if the timestamp of the parent external content type instance changed.
Processing deletes
When processing deletes, if the parent external content type is deleted, search will delete attached and child external content types from the index.
Crawling an associated external content type as attachment
To mark an association to be crawled as attachment, add the AttachmentAccessor property to the Association as shown in the sample below. Search does not care for the value of the property.
<
Association Name="AttachmentsNavigate Association" Type="AssociationNavigator" ..........>
<
Properties>
<
Property Name="ForeignFieldMappings" Type="System.String">....... </Property>
<
Property Name="AttachmentAccessor" Type="System.String">x</Property>
</
Properties>
<
SourceEntity Namespace="Foo " Name="Parent" />
<
DestinationEntity Namespace="Foo" Name="Attached External content type" />
</
Association>
Crawling an associated external content type as child external content type
To mark an association to be crawled as child external content type, add the DirectoryLink property to the Association as shown in the sample below. Search does not care for the value of the property.
<
Association Name="ChildrenNavigator Association" Type="AssociationNavigator" ...........>
<
Properties>
<
Property Name="DirectoryLink" Type="System.String">x</Property>
</
Properties>
<
SourceEntity Namespace="Foo" Name="Parent" />
<
DestinationEntity Namespace="Foo" Name="Child External Content Type" />
</
Association>
Nitin Ved, SDET | Microsoft Enterprise Search Group