您可以将 Google Cloud Search 设置为返回来自组织的 SharePoint Online 内容以及 Google Workspace 内容的搜索结果。您需要使用 Google Cloud SearchSharePoint Online 连接器,并将其配置为访问特定的 SharePoint Online 数据源。
重要注意事项
遵从的 SharePoint 设置
Cloud Search Share Online 连接器始终遵循 SharePoint 上的搜索可见性设置,此设置不可替换。对于草稿文档,用户帐号的权限(连接器用来访问 SharePoint Online)控制要将哪些草稿文档编入索引并返回。如果该帐号仅具有“完全读取”权限,则连接器会遵循 SharePoint 上的“草稿内容可见性”设置。
您还需要配置连接器,以根据用户帐号访问权限限制结果。如需对 SharePoint 内容应用安全修剪,请将以下外部身份与 Google 目录同步:
- Office 365 / Azure AD 用户
- Office 365 / Azure AD 安全群组
- SharePoint 群组(以 Office 365 用户和群组为成员)
搜索优化
您可以将连接器配置为返回更相关的搜索结果,从而改善用户体验。
要使用该 API,请在 SharePoint Online 连接器配置文件中设置 HTML 生成参数的值。通过这些参数,您可以设置哪些字段对匹配项的影响较大。
如需设置架构,请按照 创建和注册架构中的说明操作。设置架构时:
为了将 SharePoint 内容类型的名称映射到相应的对象定义,连接器会排除不支持的字符,使内容类型名称标准化。对于对象定义,Cloud Search API 仅支持 A-Z、a-z 和 0-9 作为有效字符。例如,内容类型“Advertises”映射到对象定义“Advertises”。内容类型“News Article”映射到“NewsArticle”(没有空格)。
当连接器无法将对象定义与对象定义相匹配时,会使用后备对象类型 (
itemMetadata.objectType
)。详细了解元数据配置参数。连接器将 SharePoint 属性名称映射到属性定义。
如果连接器在将内容编入索引时遇到 Microsoft Outlook .msg 文件,它会替换此类文件的内容类型并以
application/vnd.ms-outlook.
的形式将其编入索引
已知的连接器限制
- 每个连接器实例只能将单个网站集中的内容编入索引。要将多个网站集编入索引,请设置其他连接器实例。
- 内存消耗会随着您在每个网站集的 ACL 中使用的唯一用户和群组的数量而增加。
- 删除通知不会立即生效,并且连接器可能需要超过 4 个小时才能识别出用户从源代码库中删除了内容。
系统要求
系统要求 | |
---|---|
操作系统 |
|
身份验证 |
|
软件 |
|
部署连接器
前提条件
创建 Google Workspace 私钥,其中包含您的服务帐号 ID。如需了解如何获取私钥,请参阅 配置对 Google Cloud Search API 的访问权限。
您的 Google Workspace 管理员必须添加要搜索的数据源。记录数据源 ID。
如果连接器基于 ACL 返回结果(结果未公开),则您的 Google Workspace 管理员必须创建两个身份源并提供其 ID:
- 一个用于 Office 365 用户和群组
- 一个用于 SharePoint 群组
管理员还必须获取贵组织的 Google Workspace 客户 ID 并将其提供给您。
如需了解如何获取这些值,请参阅在 Cloud Search 中映射用户身份。
为拥有 Share Online Site Collection 管理员权限的连接器设置用户帐号。
如果连接器根据 ACL 返回结果(结果未公开),请创建凭据,以读取您 Office 365 帐号中的用户和群组。按照 Microsoft 的说明创建 Azure Active Directory 应用。在设置该应用时,请执行以下操作:
- 为该应用指定一个描述性的名称,例如“gcs-o365-identity-connector”。
- 添加权限。该应用需要“Group.Read.All”和“User.Read.All”。
- 记录要在连接器配置中使用的以下信息:
- 应用 ID
- 租户
- 客户端密钥
第 1 步:安装 SharePoint Online 连接器软件
从 GitHub 克隆相应连接器代码库。
$ git clone https://github.com/google-cloudsearch/sharepoint-connector.git $ cd sharepoint-connector
检出所需的连接器版本:
$ git checkout tags/v1-0.0.3
构建该连接器。
$ mvn package
如需在构建连接器时跳过测试,请运行
mvn package -DskipTests
,而不是mvn package
。将连接器 zip 文件复制到本地安装目录:
$ cp target/google-cloudsearch-sharepoint-connector-v1-0.0.3.zip installation-dir $ cd installation-dir $ unzip google-cloudsearch-sharepoint-connector-v1-0.0.3.zip $ cd google-cloudsearch-sharepoint-connector-v1-0.0.3
第 2 步:创建 SharePoint Online 连接器配置文件
在连接器安装所在的目录中,创建一个新文件并将其命名为
sharepoint-online-connector.config
。如果您打算运行多个连接器实例,请为名称添加更多详细信息,以便区分实例。将参数作为键值对添加到文件内容中,如以下示例所示:
### SharePoint Online connector configuration ### # Required parameters for data source access api.sourceId=08ef8becd116faa4546b8ca2c84b2879 api.serviceAccountPrivateKeyFile=service_account.json # Required parameters for SharePoint Online access sharepoint.server=https://mydomain.onmicrosoft.com sharepoint.siteCollectionOnly=true sharepoint.username=admin@mydomain.onmicrosoft.com sharepoint.password=pa$sw0rd sharepoint.formsAuthenticationMode=LIVE sharepoint.deploymentType=ONLINE # SharePoint identity mapping parameters api.identitySourceId=08ef8becd116faa475de26d9b291fed9 api.referenceIdentitySources=defaultIdentitySource api.referenceIdentitySource.defaultIdentitySource.id=08ef8becd116faa5d3783f8c5a80e5aa # Optional SharePoint List Item metadata parameters contentTemplate.sharepointItem.title=Title contentTemplate.sharepointItem.unmappedColumnsMode=APPEND
(可选)根据需要配置其他连接器参数。如需了解详情,请参阅 Google 提供的连接器参数。
第 3 步:为 SharePoint Online 连接器设置日志记录
在包含连接器二进制文件的同一目录中创建一个名为 logs 的文件夹。
在同一目录中创建一个名为 logging.properties 的 Latin-1 编码文件,并添加以下内容:
handlers = java.util.logging.ConsoleHandler,java.util.logging.FileHandler # Default log level .level = INFO # uncomment line below to increase logging level for SharePoint APIsa #com.google.enterprise.cloudsearch.sharepoint.level=FINE # uncomment line below to increase logging level to enable API trace #com.google.api.client.http.level = FINE java.util.logging.ConsoleHandler.level = INFO java.util.logging.FileHandler.pattern=logs/connector-sharepoint.%g.log java.util.logging.FileHandler.limit=10485760 java.util.logging.FileHandler.count=10 java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
第 4 步:配置 SharePoint Online 身份连接器
必须执行此步骤,才能将基于 Share Online 身份的 ACL 应用到搜索结果。如果您使用公共 ACL 设置连接器,则可以跳过此步骤。
在安装 Share Online 连接器的同一目录中,创建一个新文件并将其命名为
sharepoint-online-identity-connector.config
。将参数作为键值对添加到文件内容中,如以下示例所示:
### SharePoint Online identity connector configuration ### # Required parameters for data source access api.customerId=C05d3djk8 api.serviceAccountPrivateKeyFile=service_account.json # Required parameters for SharePoint Online access sharepoint.server=https://mydomain.onmicrosoft.com sharepoint.siteCollectionOnly=true sharepoint.username=admin@mydomain.onmicrosoft.com sharepoint.password=pa$sw0rd sharepoint.formsAuthenticationMode=LIVE sharepoint.deploymentType=ONLINE # SharePoint identity mapping parameters api.identitySourceId=08ef8becd116faa475de26d9b291fed9 api.referenceIdentitySources=defaultIdentitySource api.referenceIdentitySource.defaultIdentitySource.id=08ef8becd116faa5d3783f8c5a80e5aa
这些值与 SharePoint Online 连接器的值几乎相同,区别在于前者使用的是
api.customerId
,而不是api.sourceId
。api.customerId
的值是您从 Google Workspace 管理员处获取的客户 ID。
第 5 步:安装 Office 365 身份连接器
必须执行此步骤,才能将基于 Share Online 身份的 ACL 应用到搜索结果。如果您使用公共 ACL 设置连接器,则可以跳过此步骤。
从 GitHub 克隆相应连接器代码库。
$ git clone https://github.com/google-cloudsearch/office-365-connector.git $ cd office-365-connector
检出所需的连接器版本:
$ git checkout tags/v1-0.0.3
构建该连接器。
$ mvn package
如需在构建连接器时跳过测试,请运行
mvn package -DskipTests
,而不是mvn package
。将连接器 zip 文件复制到本地安装目录:
$ cp target/google-cloudsearch-office-365-connector-v1-0.0.3.zip installation-dir $ cd installation-dir $ unzip google-cloudsearch-office-365-connector-v1-0.0.3.zip $ cd google-cloudsearch-office-365-connector-v1-0.0.3
第 6 步:配置 Office 365 身份连接器并设置日志记录
在身份连接器安装所在的目录中,创建一个新文件并将其命名为
o365-identity-connector.config
。将参数作为键值对添加到文件内容中,如以下示例所示。注意:所有参数均为必需参数。
### Office 365 Identity connector configuration ###
api.identitySourceId=12345abcde api.customerId=abcde12345 o365.clientId=a63c6eb3-29e7-486 o365.tenant=185ef9ed-29e7-486 o365.clientSecret=raHJN15vRLBKs在包含连接器二进制文件的同一目录中创建一个名为 logs 的文件夹。
在同一目录中创建一个名为 logging.properties 的 ASCII 或 UTF-8 文件,并添加以下内容:
handlers = java.util.logging.ConsoleHandler,java.util.logging.FileHandler # Default log level .level = INFO # uncomment line below to increase logging level for Office 365 APIs #com.google.enterprise.cloudsearch.o365.level=FINE # uncomment line below to increase logging level to enable Google API traces #com.google.api.client.http.level = FINE java.util.logging.ConsoleHandler.level = INFO java.util.logging.FileHandler.pattern=logs/connector-o365.%g.log java.util.logging.FileHandler.limit=10485760 java.util.logging.FileHandler.count=10 java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
第 7 步:启动 SharePoint Online 连接器
在以下步骤中,您需要将 Office 365 和 SharePoint 网站集中的主账号映射到 Cloud Identity 服务中的身份。此同步是使用 Office 365 身份连接器和 SharePoint Online 身份连接器完成的。
Office 365 连接器同步用户和群组后,请运行 SharePoint Online 身份连接器以同步 SharePoint 网站集群组。然后,运行 SharePoint Online 连接器,将结果编入索引并提供给您的 Cloud Search 用户。
运行 Office 365 身份连接器:
$ java -Djava.util.logging.config.file=logging.properties -jar google-cloudsearch-office-365-connector-v1-0.0.3.jar -Dconfig=o365-identity-connector.config
运行 SharePoint Online 身份连接器:
$ java -Djava.util.logging.config.file=logging.properties -cp "google-cloudsearch-sharepoint-connector-v1-0.0.3.jar" com.google.enterprise.cloudsearch.sharepoint.SharePointIdentityConnector -Dconfig=sharepoint-online-identity-connector.config
运行 SharePoint Online 连接器:
$ java -Djava.util.logging.config.file=logging.properties -jar google-cloudsearch-sharepoint-connector-v1-0.0.3.jar -Dconfig=sharepoint-online-connector.config
配置参数参考
数据源访问权限
设置 | 参数 |
数据源 ID | api.sourceId=1234567890abcdef
必需。由 Google Workspace 管理员设置的 Google Cloud Search 数据源 ID。 |
服务账号私钥文件路径 | api.serviceAccountPrivateKeyFile=PrivateKey.json
必需。Google Cloud Search 服务帐号密钥文件的路径。 |
SharePoint Online 访问权限
设置 | 参数 |
CSV 网站集的完全限定域名 | sharepoint.server= http://yoursharepoint.example.com/
必需。如果域名不是完全限定的,请在连接器主机上设置 DNS 覆盖。 |
仅限网站集模式 | sharepoint.siteCollectionOnly=true
必需。对于 Share Online,请将值设置为 |
SharePoint 用户名 | sharepoint.username=username
必需。用于访问 Share Online 的帐号的用户名。 |
SharePoint 密码 | sharepoint.password=user_password
必需。用于访问 Share Online 的帐号的密码。 |
身份验证模式 | sharepoint.formsAuthenticationMode=LIVE
必需。对于 Share Online,该值始终为“LIVE”。 |
部署类型 | sharepoint.deploymentType=ONLINE
必需。对于 SharePoint Online,该值始终为“Online”。 |
SharePoint 身份映射
设置 | 参数 |
身份源 ID | api.identitySourceId=1234567890abcdef
必需。SharePoint 群组身份源的 Cloud Search 身份源 ID。 |
引用身份源 | api.referenceIdentitySources=defaultIdentitySource
必需。对于 SharePoint Online,该值始终为“defaultIdentitySource”。 |
引用身份源 ID | api.referenceIdentitySource.defaultIdentitySource.id=112233abcd
必需。Office 365 用户和群组的 Cloud Search 身份源 ID。 |
HTML 内容生成
设置 | 参数 |
HTML 模板标题字段 | contentTemplate.sharePointItem.title=Title
用作所生成 HTML 的 HTML 模板标题的 SharePoint 字段。 |
HTML 内容高搜索质量字段 | contentTemplate.sharePointItem.quality.high=highField1[,highField2,...]
以英文逗号分隔的字段列表,其中包含要作为高质量字段包含在生成的 HTML 中的字段。当搜索查询字词与这些字段匹配时,结果的排名会更高。 |
HTML 内容中等搜索质量字段 | contentTemplate.sharePointItem.quality.medium=mediumField1[,mediumField2,...]
以英文逗号分隔的字段列表,其中包含要作为中等质量字段包含在生成的 HTML 中的字段。 |
HTML 内容低搜索质量字段 | contentTemplate.sharePointItem.quality.low=lowField1[,lowField2,...]
以英文逗号分隔的字段列表,这些字段将作为低质量字段包含在生成的 HTML 中。 |
HTML 内容未映射列 | contentTemplate.sharepointItem.unmappedColumnsMode=APPEND
连接器如何处理未映射的列。值为 APPEND(默认值)或 IGNORE。
|
Office 365 身份连接器配置
设置 | 参数 |
身份源 ID | api.identitySourceId=1234567890abcdef
必需。Office 365 身份源 ID。此值应与 SharePoint Online 连接器配置中的“api.referenceIdentitySource.defaultIdentitySource.id”值一致。 |
Google 客户 ID | api.customerId=c1b1d1e1
必需。贵组织的 Google Workspace 客户 ID。 |
Office 365 应用 ID | o365.clientId=a63c6eb3-29e7-486
必需。Office 365 应用设置中的应用 ID。 |
Office 365 租户 | o365.tenant=185ef9ed-29e7-486
必需。您的 Office 365 帐号(Azure Activity Directory 应用)的租户 |
Office 365 客户端密钥 | o365.clientSecret=raHJN15vRLBKs
必需。Office 365 应用设置的凭据密钥 |