在 SharePoint Server 中建立及部署自訂實體擷取器

適用于:yes-img-132013 yes-img-16 2016yes-img-192019 yes-img-se訂閱版本 no-img-sopMicrosoft 365 中的 SharePoint

您可以在 SharePoint Server 的外部系統中建立及維護自訂實體擷取器檔案,再匯入 SharePoint Server ,以確保搜尋系統可以使用此自訂實體擷取器。

若要在傳統搜尋中使用自訂實體作為精簡器,您必須先建立自訂實體擷取字典並加以部署。 然後設定 Managed 屬性,以使用自訂實體擷取器並執行完整編目。 在這之後,即可設定搜尋結果頁面上的精簡搜尋網頁組件,以使用自訂實體作為精簡器。

開始之前

開始此作業之前,您必須先備妥:

  • Search Service 應用程式

  • 至少有一個完整已編目的內容來源

  • 搜尋結果頁面

建立自訂實體擷取字典

若要建立自訂實體擷取字典

  1. 決定您要建立的自訂實體擷取字典類型:全字相符 (不分大小寫)、全字部分相符 (不分大小寫)、全字相符 (區分大小寫) 或全字部分相符 (區分大小寫)。 請參閱<自訂實體擷取器類型概觀>。

  2. Create a .csv file with the columns Key and Display Form. 請務必使用逗號分隔各欄。 If the file contains non-ASCII characters such as diacritics, you must encode it in UTF-8. Save the file to a location that is accessible from the server from which you will run the Microsoft PowerShell cmdlet to deploy the custom entity extraction dictionary.

    • In the Key column, enter the term (single or multiple words) that you want to include as custom entities. You can use more than one line per key. Make sure there are no leading or trailing spaces around the terms.

    • (Optional) In the Display form column, enter a refiner name. If you leave this column empty, the term that is extracted from the content will be displayed as the refiner in the same case as it occurs in the content. Use the Display Form column to control and standardize the way in which the refiner is displayed.

例如,名為 Contoso 的組織有三種等級的認證系統:Contoso Beginner、Contoso Professional 和 Contoso Expert。 Contoso 將擷取這些實體並且進行調整。 無論寫入的字詞是 "Contoso"、 "beginner"、"professional" 還是 "expert",都將使精簡器顯示為 Contoso BeginnerContoso ProfessionalContoso Expert 。 由於此範例,自訂實體擷取字典輸入能夠顯示為:

Key,Display form
Contoso Beginner,Contoso Beginner
Contoso B1,Contoso Beginner
Contoso Professional,Contoso Professional
Contoso prof,Contoso Professional
Contoso Expert,Contoso Expert

部署自訂實體擷取字典

若要部署自訂實體擷取字典,您必須將此字典匯入 SharePoint Server。

若要匯入自訂實體擷取字典

  1. 確認匯入自訂實體擷取器字典的使用者帳戶是否為 Search Service 應用程式的管理員。

  2. 啟動 SharePoint 管理命令介面。

  3. 在 Windows PowerShell 命令提示字元處,輸入下列命令:

    $searchApp = Get-SPEnterpriseSearchServiceApplication
    Import-SPEnterpriseSearchCustomExtractionDictionary -SearchApplication $searchApp -Filename <Path> -DictionaryName <Dictionary name> 
    
    

    其中:

    • <Path> 指定要匯入之 .csv 檔案 (自訂擷取字典) 的完整 UNC 路徑。

    • <Dictionary name> 是自訂擷取字典類型的名稱。

    根據您匯入的字典類型,輸入下列其中一項:

    • Microsoft.UserDictionaries.EntityExtraction.Custom.Word。 n [其中 n = 1、2、3、4 或 5]

    • Microsoft.UserDictionaries.EntityExtraction.Custom.ExactWord.1

    • Microsoft.UserDictionaries.EntityExtraction.Custom.WordPart。 n [其中 n = 1、2、3、4 或 5]

    • Microsoft.UserDictionaries.EntityExtraction.Custom.ExactWordPart.1

設定自訂實體擷取的 Managed 屬性

下列程序說明如何建立自訂實體擷取字典與您要擷取自訂實體之現有 Managed 屬性的關聯。 一般而言,這會是您預計要包含這些實體的 Managed 屬性,例如 Managed 屬性 TitleBody 。 即使這些內容中的區段標示為 <no index> ,仍是從相關聯的 Managed 屬性中擷取自訂實體。

若要指定應擷取自訂實體的現有 Managed 屬性,您可以編輯現有的 Managed 屬性。 如需管理編目屬性和 Managed 屬性的詳細資訊,請參閱<在 SharePoint Server 中管理搜尋結構描述>。

若要編輯自訂實體擷取的 Managed 屬性

  1. 確認使用者帳戶是否為 Search Service 應用程式的管理員。

  2. 在管理中心中,按一下 [應用程式管理] 區段的 [管理服務應用程式]

  3. 按一下 [Search Service 應用程式]。

  4. On the Search Administration page, in the Quick Launch, under Queries and Results, click Search Schema.

  5. On the Managed Properties page, find the managed property that you want to associate the custom entity extraction dictionary with that contains the single or multiple words (or word parts). You can also enter the name of the managed property in the Filter box.

  6. 指向 Managed 屬性,按一下箭號,再按一下 [編輯/對應屬性]

  7. On the Edit Managed Property page, edit the settings under Custom entity extraction. Select the custom entity extraction dictionary that you have imported, and then click OK.

下一次編目完成時,便會啟用自訂實體擷取器。 原始的 Managed 屬性內容則會儲存在搜尋索引中而保持不變。 此外,根據您已啟用的自訂實體擷取器類型,擷取的實體會複製到下列一或多個 Managed 屬性:

  • WordCustomRefiner1
  • WordCustomRefiner2
  • WordCustomRefiner3
  • WordCustomRefiner4
  • WordCustomRefiner5
  • WordExactCustomRefiner
  • WordPartCustomRefiner1
  • WordPartCustomRefiner2
  • WordPartCustomRefiner3
  • WordPartCustomRefiner4
  • WordPartCustomRefiner5
  • WordPartExactCustomRefiner

這些 Managed 屬性會自動設定為可搜尋、可查詢、可擷取、可排序且可精簡。

在網頁組件中設定精簡器

您可以使用擷取的自訂實體作為搜尋結果頁面中的精簡器。 以自訂實體為基礎的精簡器可在精簡搜尋網頁組件中使用。

若要新增以自訂實體擷取器為基礎的精簡器

  1. 確認執行此程序的使用者帳戶為企業搜尋中心網站上設計者 SharePoint 群組的成員。

  2. 瀏覽至包含欲設定之精簡搜尋網頁組件的頁面。依序按一下 [設定功能表]、[編輯頁面]

  3. Edit the Refinement Web Part. Click the Refinement Web Part Menu arrow, and then click Edit Web Part.

    • 在網頁組件工具窗格的 [精簡搜尋屬性] 區段中,確認是否已選取 [選擇此網頁組件中的精簡器]

    • 按一下 [選擇精簡器]

    • On the Refinement configuration page, from the Available refiners section, use the buttons to select one or more managed properties containing extracted entities that you want to show as refiners from the list and click Add. For example, if you have deployed a word extraction dictionary, choose WordCustomRefiner1.

    • 在 [設定] 區段中,設定您要讓每個精簡器顯示的方式。

  4. 按一下 [確定]

自訂實體擷取器類型概觀

下表顯示您可以建立的自訂擷取字典類型,以及字典專案如何與搜尋索引中的內容進行比對、您在部署字典時應該使用的字典名稱,以及哪個 Managed 屬性將包含擷取的實體。


自訂實體擷取器/自訂實體擷取器字典 描述 範例 在 Windows PowerShell 使用的字典名稱 將包含擷取實體的 Managed 屬性
全字相符 不區分大小寫,字典項目與 Token 化的內容相符,最多 5 個字典。 "anchor" 項目與 "anchor" 和 "Anchor" 相符,而不會與 "anchorage" 相符 Microsoft.UserDictionaries.EntityExtraction.Custom.Word.n [其中 n = 1,2,3,4 或 5] WordCustomRefiner1 WordCustomRefiner2 WordCustomRefiner3 WordCustomRefiner4 WordCustomRefiner5
全字部分相符 不區分大小寫,字典項目與未 Token 化的內容相符,最多 5 個字典。 "anchor" 項目與 "anchor"、"Anchor" 和 "anchorage" 相符 Microsoft.UserDictionaries.EntityExtraction.Custom.WordPart.n [其中 n = 1,2,3,4 或 5] WordPartCustomRefiner1 WordPartCustomRefiner2 WordPartCustomRefiner3 WordPartCustomRefiner4 WordPartCustomRefiner5
全字相符擷取 區分大小寫,字典項目與 Token 化的內容相符,最多 1 個字典。 "anchor" 項目與 "anchor" 項目相符,不與 "Anchor" 或 "Anchorage" 相符 Microsoft.UserDictionaries.EntityExtraction.Custom.ExactWord.1 WordExactCustomRefiner
全字部分相符擷取 區分大小寫,字典項目與未 Token 化的內容相符,最多 1 個字典。 "anchor" 項目與 "anchor" 和 "anchorage" 相符,不與 "Anchor" 相符 Microsoft.UserDictionaries.EntityExtraction.Custom.ExactWordPart.1 WordPartExactCustomRefiner

另請參閱

Import-SPEnterpriseSearchCustomExtractionDictionary