Custom BCS Connectors---Database
SharePoint使用index connectors来爬取数据到search index中, index connector告诉SharePoint Search爬取哪些数据内容以及怎么爬取某个数据源的内容,在SharePoint 2010之前的版本,SharePoint使用基于protocol handler的index connector, Sharepoint 2010 之后,SharePoint提供了Connector Framework允许定制自定义的解决方案,自定义的解决方案可以定义如何爬取数据,例如database的爬取就可以自己定义爬取的查询语句。
本文着重介绍Database如果作为external的数据源在SharePoint中完成爬取和搜索,适用于SharePoint Built-In的database 搜索功能,不包含任何自定义的逻辑,例如不适用于对权限有相关要求的场景,对权限有要求的场景我们在下一节中着重介绍。
下面介绍如何创建Database 类型的index connector
1. 通过SharePoint Designer 2013创建external content type
使用管理员打开SharePoint Designer并打开sharepoint site: http://localhost:101/,点击External Content Type创建新的external content type, 点击如下链接,关联database
Add Connection,选择SQL Server
填写数据库链接信息,并选择Connect with User's Identity(需要保证打开sharepoint designer 2013的账号能够访问数据库)
搜索数据库的权限需要New Read Item Operation和New Read List Operation,一直Next(如果没有identifier,需要指定一个),创建完成即可。
保存该External Content Type。
2. 创建Content Source
Central Administration-->Application Management-->Manage service Application-->Search Service Application-->Content Source
保存之后,跑full crawl。