部署 Microsoft SharePoint On-Prem 連接器

您可以設定 Google Cloud Search,除了 Google Workspace 內容外,也從貴機構的 SharePoint 內部部署內容傳回結果。您可使用並設定 Google Cloud Search SharePoint 內部部署連接器,讓連接器存取特定 SharePoint 資料來源。

重要事項

Honored SharePoint 設定

Cloud Search SharePoint On-Prem 連接器一律會遵循 SharePoint 的「搜尋瀏覽權限」設定 (無法覆寫)。針對草稿文件,使用者帳戶的權限 (連接器用於存取 SharePoint Online) 會控制要建立索引及傳回哪些草稿文件的權限。如果帳戶只有「Full Read」權限,連接器會遵循 SharePoint 上的「草稿項目瀏覽權限」設定。

您也可以設定連接器,根據使用者帳戶存取權限限制結果。您可以使用 Google 主體和外部主體定義 ACL。如要為 SharePoint 內容套用安全性剪輯功能,請將下列外部身分與 Google 目錄同步處理:

  • Active Directory 使用者
  • Active Directory 群組
  • SharePoint 本機群組 (含 Active Directory 使用者和群組為成員)

如要同步處理 AD 使用者和群組,請使用 Google Cloud Directory Sync 啟用識別資訊對應群組。如要同步處理 SharePoint 本機群組,請使用 SharePoint 識別資訊連接器。

連接器也需要使用 AD 執行查詢,才能擷取其他資訊來同步處理主體。舉例來說,使用 AD 查詢可讓連接器執行以下操作:

  • 將網域群組的 SID 對應至相應的 sAMAccountName。
  • 將使用者 sAMAccountName 對應至 SharePoint 本機群組成員的電子郵件地址。

搜尋最佳化

您可以設定連接器以傳回更相關的搜尋結果,藉此改善使用者體驗。

如要使用 API,請在 SharePoint Online 連接器設定檔中設定 HTML 產生參數值。這些參數可讓您設定哪些欄位對於比對的影響較高或較低。

如要設定結構定義,請按照建立及註冊結構定義中的操作說明進行。設定結構定義時:

  • 如要將 SharePoint 內容類型的名稱對應至對應的物件定義,連接器會排除不支援的字元,將內容類型名稱正規化。針對物件定義,Cloud Search API 僅支援 A 至 Z、a 至 z 及 0 至 9 等有效字元。舉例來說,「公告」內容類型會對應至物件定義「公告」。「News Article」內容類型對應至「NewsArticle」(沒有空格)。

  • 當連接器無法比對物件定義與物件定義時,連接器會使用備用物件類型 (itemMetadata.objectType)。進一步瞭解中繼資料設定參數

  • 為了將 SharePoint 屬性名稱對應至屬性定義,連接器會解碼十六進位編碼字元並移除「ows_」前置字元,然後排除不支援的字元 (A-Z、a-z 和 0-9 以外的所有字元) 將其正規化為屬性名稱。

Microsoft Outlook 郵件處理

當連接器為內容建立索引時遇到 Microsoft Outlook .msg 檔案時,就會覆寫檔案的媒體類型,並將其索引為 application/vnd.ms-outlook.

多用戶群設定

如果您的 SharePoint 為多用戶群部署 (由同一個網頁應用程式代管多個客戶網站),則必須在設定檔中設定網站收集模式。在多用戶群部署中,您只能取得網站集合的權限,無法取得 SharePoint On-Prem 連接器要求的完整讀取權限。

啟用網站收集模式的步驟如下:

  • 網站收集管理員權限授予連接器使用者帳戶。
  • 將連接器設定檔中的 sharepoint.server 設為網站集合網址,例如 http://sharepoint.example.com/sites/sitecollection。網址不必與 SharePoint 中的大小寫相同。
  • 將連接器設定檔中的 sharepoint.siteCollectionOnly 設為 true

如要在多用戶群環境中為多個網站集合建立索引,您必須為每個網站集合設定一個連接器執行個體。

已知連接器限制

  • 連接器偵測資料庫中項目變更所需的時間,會隨連接器監控的資料庫數量增加。
  • 隨著您在每個網站集合的 ACL 中使用的不重複使用者和群組數量,記憶體消耗量會隨之增加。
  • 您只能使用來自一個 Active Directory 網域的身分設定連接器。
  • 系統不支援某些常見的 Active Directory 和 Windows 主體,例如 EveryoneBUILTIN\UsersAll Authenticated Users
  • 刪除通知不會立即生效,連接器可能需要超過 4 小時才能識別使用者已從來源存放區刪除內容。

系統需求

系統需求
作業系統
  • Windows Server 2016
  • Ubuntu
  • Red Hat Enterprise Linux 5.0
  • SUSE Enterprise Linux 10 (64 位元)
軟體
  • SharePoint 伺服器
    • SharePoint Server 2016
    • SharePoint Server 2013
  • 電腦上安裝了 Java JRE 1.8,可執行 Google Cloud Search SharePoint On-Prem 連接器
驗證
  • NTLM
  • Kerberos
  • HTTP 基本驗證
  • ADFS

部署連接器

必要條件

  1. 建立包含服務帳戶 ID 的 Google Workspace 私密金鑰。如要瞭解如何取得私密金鑰,請參閱 設定 Google Cloud Search API 存取權

  2. 您的 Google Workspace 管理員必須新增資料來源以進行搜尋。記錄資料來源 ID。

  3. 如果連接器根據 ACL 傳回結果 (結果並非公開),您的 Google Workspace 管理員就必須建立兩個識別資訊來源,並提供這些來源的 ID:

    • 用於同步處理 Active Directory 使用者和群組的識別資訊來源。
    • SharePoint Local 群組的識別資訊來源

    管理員也必須取得貴機構的 Google Workspace 客戶 ID,並提供給您。

    如要瞭解如何在 Cloud Search 中取得這些值,請參閱「在 Cloud Search 中對應使用者身分」一文。

  4. 在使用者政策中具備 SharePoint Web 應用程式完整讀取權限的連接器設定使用者帳戶。

  5. 如果 SharePoint 網頁應用程式沒有根網站集合,請建立根網站。

  6. 如有任何網站集合受到寫入鎖定,請使用具備管理員權限的帳戶登入 SharePoint 伺服器,並執行 PrepareWriteLockedSites.ps1 指令碼。

  7. 如要取得資料來源指標以告知連接器設定,請使用具備陣列管理權限的帳戶登入 SharePoint 伺服器,然後執行 diagnose_sp.ps1

    輸出結果會報告網頁應用程式、文件和使用者群組成員數量。您可以參考這項資訊,估算需要的連接器執行個體數量、記憶體需求和文件數量。

步驟 1:安裝 Google Cloud Search SharePoint 內部部署連接器軟體。

  1. 從 GitHub 複製連接器存放區。

    $ git clone https://github.com/google-cloudsearch/sharepoint-connector.git
    $ cd sharepoint-connector
  2. 查看所需連接器版本:

    $ git checkout tags/latest_version

    其中:latest_version = 例如 v1-0.0.5 的值

  3. 建構連接器。

    $ mvn package

    如要在建立連接器時略過測試,請執行 mvn package -DskipTests,而不是 mvn package

  4. 將連接器 ZIP 檔案複製到本機安裝目錄:

    $ cp target/google-cloudsearch-sharepoint-connector-latest_version.zip installation-dir
    $ cd installation-dir
    $ unzip google-cloudsearch-sharepoint-connector-latest_version.zip
    $ cd google-cloudsearch-sharepoint-connector-latest_version

步驟 2:建立 SharePoint On-Prem 連接器設定檔

  1. 在與連接器安裝相同的目錄中建立檔案。Google 建議您將檔案命名為 connector-config.properties,這樣執行連接器時就不需要額外的指令列參數。如果您打算執行多個連接器執行個體,請在名稱中新增詳細資料以區別執行個體。

  2. 將參數做為鍵/值組合新增至檔案內容,如以下範例所示:

    ### Sharepoint On-Prem Connector configuration ###
    
    # Required parameters for data source access
    api.sourceId=08ef8becd116faa4546b8ca2c84b2879
    api.serviceAccountPrivateKeyFile=service_account.json
    api.identitySourceId=08ef8becd116faa475de26d9b291fed9
    
    # Required parameters for SharePoint on-premises access
    sharepoint.server=http://sp-2016:32967/sites/doc-center-site-collection
    sharepoint.siteCollectionOnly=true
    sharepoint.username=contoso\\admin
    sharepoint.password=pa$sw0rd
    sharepoint.stripDomainInUserPrincipals=true
    
    # Required parameters for AD lookup
    adLookup.host=dc.contoso.com
    adLookup.username=contoso\\admin
    adLookup.password=pa$sw0rd
    api.referenceIdentitySources=CONTOSO,contoso
    api.referenceIdentitySource.contoso.id=08ef8becd116faa5d3783f8c5a80e5aa
    api.referenceIdentitySource.CONTOSO.id=08ef8becd116faa5d3783f8c5a80e5aa
    
    # Optional parameters for schema mapping
    contentTemplate.sharepointItem.title=Title
    contentTemplate.sharepointItem.unmappedColumnsMode=APPEND
    

    如需每個參數的詳細說明,請參閱 設定參數參考資料

  3. (選用) 視需要設定其他連接器參數。詳情請參閱 Google 提供的連接器參數

步驟 3:針對 HTTPS,將 SharePoint 新增為信任的主機

如果將 SharePoint 設定為使用 HTTPS,請取得 SharePoint 憑證,將其新增為連接器的信任的主機。

  1. 在要執行連接器的電腦上,開啟瀏覽器並前往 SharePoint。

  2. 在隨即開啟的警告頁面中,依序按一下「我瞭解風險」和「新增例外狀況」。頁面會顯示「此連線不受信任」,因為憑證是自行簽署,而不是由信任的憑證授權單位簽署。

  3. 當「View」按鈕出現時,點選該按鈕。

  4. 前往「詳細資料」分頁,然後按一下「匯出」

  5. sharepoint.crt 名稱將憑證儲存在連接器目錄中。

  6. 依序按一下「關閉」和「取消」,關閉視窗。

  7. 開啟命令提示字元並輸入下列指令:

    $ keytool -importcert -keystore cacerts.jks -storepass changeit -file sharepoint.crt -alias sharepoint

    當系統顯示「是否信任這個憑證?」時,請回答 yes

步驟 4:設定記錄功能

  1. 在包含連接器二進位檔的目錄中,建立名為 logs 的資料夾。

  2. 在同一個目錄中 (非 logs),建立名為 logging.properties 的 Latin1 編碼檔案。

  3. logging.properties 中新增下列文字:

    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
    

步驟 5:設定 SharePoint On-Prem 識別資訊連接器

您必須執行這個步驟,才能將 SharePoint 以身分為基礎的 ACL 套用至搜尋結果。如果是透過公開 ACL 設定連接器,可以略過這個步驟。

  1. 在安裝 SharePoint Online 連接器的目錄中建立檔案,並命名為 sharepoint-onprem-identity-connector.config

  2. 將參數做為鍵/值組合新增至檔案內容,如以下範例所示:

    ### SharePoint On-prem identity connector configuration ###
    
    # Required parameters for data source access
    api.customerId=C05d3djk8
    api.serviceAccountPrivateKeyFile=service_account.json
    api.identitySourceId=08ef8becd116faa475de26d9b291fed9
    
    # Required parameters for SharePoint access
    sharepoint.server=http://sp-2016:32967/sites/doc-center-site-collection
    sharepoint.siteCollectionOnly=true
    sharepoint.username=contoso\\admin
    sharepoint.password=pa$sw0rd
    sharepoint.stripDomainInUserPrincipals=true
    
    # Required parameters for AD lookup
    adLookup.host=dc.contoso.com
    adLookup.username=contoso\\admin
    adLookup.password=pa$sw0rd
    api.referenceIdentitySources=CONTOSO,contoso
    api.referenceIdentitySource.contoso.id=08ef8becd116faa5d3783f8c5a80e5aa
    api.referenceIdentitySource.CONTOSO.id=08ef8becd116faa5d3783f8c5a80e5aa
    

    此參數的值與 SharePoint On-Prem 連接器的值幾乎相同,差別只在於參數是 api.customerId,而不是 api.sourceIdapi.customerId 的值是您向 Google Workspace 管理員提供的客戶 ID。

步驟 6:啟動 SharePoint On-Prem 連接器

在下列步驟中,您要將內部部署 Active Directory 和 SharePoint 網站集合中的主體對應至 Cloud Identity 服務中的身分。這項同步處理作業是利用 Google Cloud Directory Sync (GCDS) 和 SharePoint On-Prem 識別資訊連接器完成。

GCDS 同步處理使用者和群組後,如要同步處理 SharePoint 網站集合群組,請執行 SharePoint On-Prem 識別資訊連接器。最後,執行 SharePoing On-Prem 連接器,為您的 Cloud Search 使用者建立索引並提供結果。

  1. 如果您尚未設定及執行 GCDS ,請先設定及執行 GCDS。請務必啟用識別資訊對應群組

  2. 執行 SharePoint On-Prem 識別資訊連接器:

    $ java -Djava.util.logging.config.file=logging.properties -cp "google-cloudsearch-sharepoint-connector-version.jar" com.google.enterprise.cloudsearch.sharepoint.SharePointIdentityConnector -Dconfig=sharepoint-onprem-identity-connector.config
  3. 執行 SharePoint On-Prem 連接器。使用 SharePoint 網站安全性的指令語法:

    • HTTP (不需要受信任的主機):

      $ java -Djava.util.logging.config.file=logging.properties -jar google-cloudsearch-sharepoint-connector-v1-version.jar
    • HTTPS (將 SharePoint 新增為信任的主機):

      $ java -Djavax.net.ssl.trustStore=cacerts.jks -Djavax.net.ssl.trustStoreType=jks -Djavax.net.ssl.trustStorePassword=changeit -Djava.util.logging.config.file=logging.properties -jar google-cloudsearch-sharepoint-connector-v1-version.jar

設定參數參考資料

資料來源存取權

設定 參數
資料來源 ID api.sourceId=1234567890abcdef

必要欄位。由 Google Workspace 管理員設定的 Google Cloud Search 資料來源 ID。

服務帳戶私密金鑰檔案的路徑 api.serviceAccountPrivateKeyFile=PrivateKey.json

必要欄位。Google Cloud Search 服務帳戶金鑰檔案的路徑。

SharePoint 地端部署存取權

設定 參數
SharePoint 伺服器網址 sharepoint.server=http://yoursharepoint.example.com/

必要欄位。以完整的主機名稱 (例如 http://yoursharepoint.example.com/) 提供的 SharePoint 伺服器網址。如果主機名稱不完全合格,則必須在連接器主機上設定 DNS 覆寫。

SharePoint 使用者名稱 sharepoint.username=YOURDOMAIN\\ConnectorUser

如要在 Linux 或不屬於 SharePoint Server AD 網域的 Windows 電腦上執行連接器,就必須提供這項資訊。

SharePoint 密碼 sharepoint.password=user_password

如要在 Linux 或不屬於 SharePoint Server AD 網域的 Windows 電腦上執行連接器,就必須提供這項資訊。

使用即時驗證功能連線至 SharePoint sharepoint.username=AdaptorUser Live Authentication Id

sharepoint.password uS3R_passWoRD

sharepoint.formsAuthenticationMode=LIVE

使用 ADFS 驗證連線至 SharePoint sharepoint.username=AdaptorUser@yourdomain.com

sharepoint.password=uS3R_passWoRD

sharepoint.sts.endpoint=https://adfs.example.com/adfs/services/trust/2005/usernamemixed

sharepoint.sts.realm=urn:myserver:sharepointhttps://yoursharepoint.example.com/_trust

sharepoint.formsAuthenticationMode=ADFS

網站集合索引

設定 參數
索引類型 sharepoint.siteCollectionOnly=boolean

選用,但多用戶群 SharePoint 部署作業除外 (瞭解詳情)。設為 true 表示連接器索引 sharepoint.server 做為網站集合,而不是虛擬伺服器。預設值為空值 (自動偵測)。

SharePoint 識別資訊對應

設定 參數
識別資訊來源 ID api.identitySourceId=1234567890abcdef

必要欄位。用來同步處理 SharePoint 本機群組的識別資訊來源 ID。由 Google Workspace 管理員設定的 Google Cloud Search 來源 ID,如「新增要搜尋的資料來源」一文所述。

參照識別資訊來源 api.referenceIdentitySources=CONTOSO,contoso

Active Directory 主體的參照識別資訊來源清單 (以半形逗號分隔)。這個值與參照 Active Directory 主體的 Active Directory NETBIOS 名稱相符。

參照識別資訊來源 ID api.referenceIdentitySource.DOMAIN.id=identity-source-id

必要欄位。用於同步處理 Active Directory 主體的識別資訊來源 ID。

Active Directory 查詢

設定 參數
Active Directory 主機 adLookup.host=host

必要欄位。Active Directory 主機名稱 (例如 dc.contoso.com 或 IP 位址)。

Active Directory 查詢通訊埠 adLookup.port=port

選用設定。預設值為 389。如果是 SSL,請使用 686。

Active Directory 查詢方式 adLookup.method=value

選用設定。預設值為「標準」。如果是 HTTPS 連線,請設為「ssl」。

Active Directory 查詢使用者 adLookup.username=CONTOSO\user1

必要欄位。獲授權執行 Active Directory 查詢的使用者。

Active Directory 查詢密碼 adLookup.password=password123

必要欄位。adLookup.user 指定使用者的密碼。

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。

  • 附加 - 連接器會產生 HTML 內容,其中包含所有欄位,包括未設定品質等級 (高、中或低) 的欄位。
  • IGNORE - 連接器會產生僅有對應欄位的 HTML 內容。