RootFinder属性与BCS搜索

在使用SharePoint 2007里的BDC(Business Data Catalog) 时,我们可以将我们的实体作为SharePoint爬网的对象并在搜索结果中返回数据,这一切相对比较简单。只要在我们的实体中实现了SpecificFinder与IDEnumerator方法即可。而在SharePoint 2010 BCS(Business Connectivity Services)里,完成这个目标有若干条途径:

- Finder, SpecificFinder 和RootFinder属性

- SpecificFinder和IDEnumerator 

Business Data Catelog如何索引数据

正如我们说过的,SharePoint索引通过SpecificFinder和IDEnumerator方法来爬网BDC数据。其中,IDEnumerator是第一个被执行的方法,其作用很简单,就是返回SharePoint需要进行爬网的数据的标示符的值。如果我们的实体还有一个字段用于代表该行数据最后修改时间,那么你还可以在IDEnumerator里返回这个字段,并设置属性_BdcLastModifiedTimestamp。用于进行增量爬网。

RootFinder属性

当我们在SharePoint 2010的Business Connectivity Services下工作时,RootFinder属性允许你得到一个可供搜索的外部内容类型,而不需要实现IDEnumerator方法。如果你看一下SharePoint Desinger 2010里的创建方法菜单就会发现,其中根本就没有创建IDEnumerator方法的菜单项。

 

然而,当我们用SharePoint Designer 2010创建了一个外部内容类型时,在设置爬网对应的内容源时就可以选择该ECT 对其进行爬网,使其可以显示在搜索结果中。如果你从SharePoint Designer 2010里导出该BCS模型,就可以看到这是为什么了。让我们一步步的操作:

 

1、当连接到你的SharePoint站点或,在SharePoint Designer 2010里点击外部内容类型视图 

2、右击一个外部内容类型并在上下文菜单中选择“导出BDC模型” 

 

3、为该模型指定一个名称,然后选择一个文件存放位置进行保存。

打开生成的XML文件,找到对应的“读取列表”方法,并定位到其中的MethodInstance元素 

<MethodInstances>
  
<MethodInstance Type="Finder" ReturnParameterName="所有产品信息" Default="true" Name="所有产品信息">
    
<Properties>
      
<Property Name="RootFinder" Type="System.String"></Property>
      
<Property Name="UseClientCachingForSearch" Type="System.String"></Property>
    
</Properties>
    
<AccessControlList>
      .........

    
</AccessControlList>
  
</MethodInstance>
</MethodInstances>

注意到该方法添加了RootFinder 属性标记。这也就意味着该Finder方法将发挥与IDEnumerator一样的作用。

 

参考资料

rootfinder property – bcs search 

posted @ 2010-07-05 14:50  Sunmoonfire  阅读(1688)  评论(1编辑  收藏  举报