在 SharePoint Server 中匯出及匯入自訂的搜尋組態設定Export and import customized search configuration settings in SharePoint Server

摘要: 了解如何匯出及匯入自訂的搜尋組態設定。Summary: Learn how to export and import customized search configuration settings.

您可以在網站集合和網站之間匯出及匯入自訂的搜尋組態設定。匯出及匯入的設定包括所有自訂的查詢規則、結果來源、結果類型、排名模型與網站搜尋設定。您也可以從搜尋服務應用程式匯出自訂的搜尋組態設定,以及將設定匯入至網站集合和網站,但您無法將自訂的搜尋組態設定匯入至搜尋服務應用程式。您無法匯出預設的搜尋組態設定,也無法將自訂的搜尋設定從 SharePoint Server 匯入到 SharePoint Online,或反之。You can export and import customized search configuration settings between site collections and sites. The settings that you export and import include all customized query rules, result sources, result types, ranking models, and site search settings. It is also possible to export customized search configuration settings from a Search service application and import the settings to site collections and sites, but you cannot import customized search configuration settings to a Search service application. You can't export the default search configuration settings, and you can't import customized search configurations from SharePoint Server to SharePoint Online, or the other way around.

您可以使用下列其中一種方法來匯出或匯入自訂的搜尋組態設定:You can use the following methods to export or import customized search configuration settings:

  • 若要在網站集合或網站上匯出或匯入自訂的搜尋組態設定,請使用 [網站設定]**** 頁面或 CSOM。To export or import customized search configuration settings at a site collection or site, use the Site Settings page or CSOM.

  • 若要從 Search Service 應用程式匯出自訂的搜尋組態設定,請使用 CSOM。To export customized search configuration settings from a Search service application, use CSOM.

若要傳輸所有的 [主版頁面圖庫]**** 檔案,請使用 [設計管理員]*。若要傳輸整個網站,則使用 [另存網站為範本]。若要透過程式設計匯出或匯入自訂的搜尋設定,請參閱 MSDN 上的在 SharePoint 中匯出及匯入搜尋組態設定If you want to transfer all **Master Page Gallery* files, use the Design Manager. If you want to transfer a whole site, use Save site as template. If you want to export or import customized search settings programmatically, see Exporting and importing search configuration settings in SharePoint 2013https://msdn.microsoft.com/library/dn205276.aspx on MSDN.

本文說明如何使用 [網站設定]**** 頁面為網站集合和網站匯出及匯入自訂的搜尋組態設定。This article describes how to use the Site Settings page to export and import customized search configuration settings for site collections, and sites.

開始之前Before you begin

開始這項作業之前,請先檢閱可匯出及匯入的自訂搜尋組態設定概觀中的資訊,並確定:Before you begin this operation, review the information in Overview of customized search configuration settings that can be exported and imported and ensure:

  • 除了 Managed 屬性外,搜尋設定檔與您的匯入目標沒有名稱相同的設定。That the search configuration file and the target for your import do not have settings with the same name, except for managed properties.

  • 匯出的來源中沒有任何包含無效字元 (如導致匯入失敗的無效字元中所列) 的 Managed 屬性或別名。That the source of your export does not include managed properties or aliases that contain the invalid characters listed in Invalid characters causing the import to fail.

  • 在目標網站及其上層網站集合上的搜尋設定檔與搜尋組態設定的組合內,Managed 屬性名稱與別名是唯一的。That managed property names and aliases are unique within the combination of the search configuration file and the search configuration settings on the target site and its parent site collection.

注意

因為 SharePoint Server 在 Internet Information Services (IIS) 中以網站形式運作,所以管理員與使用者均依賴瀏覽器提供的協助工具功能。SharePoint Server 支援所支援瀏覽器的協助工具功能。如需詳細資訊,請參閱下列資源:Because SharePoint Server runs as websites in Internet Information Services (IIS), administrators and users depend on the accessibility features that browsers provide. SharePoint Server supports the accessibility features of supported browsers. For more information, see the following resources:

從網站集合匯出自訂的搜尋組態設定Export customized search configuration settings from a site collection

從網站集合匯出自訂的搜尋組態設定To export customized search configuration settings from a site collection

  1. 確認正在執行此程序的使用者帳戶在網站集合具有 [完全控制]**** 權限等級。Verify that the user account that is performing this procedure has Full control permission level at the site collection.

  2. 在網站集合的 [設定]**** 功能表中,按一下 [網站設定]*In the site collection, on the *Settings menu, click Site Settings.

  3. 在 [網站設定]**** 頁面的 [網站集合管理]**** 區段中,按一下 [搜尋組態匯出]*On the *Site Settings page, in the Site Collection Administration section click Search Configuration Export.

  4. 在對話方塊中,按一下 [儲存]*In the dialog box, click *Save.

從網站匯出自訂的搜尋組態設定Export customized search configuration settings from a site

從網站匯出自訂的搜尋組態設定To export customized search configuration settings from a site

  1. 確認正在執行此程序的使用者帳戶在網站具有 [完全控制]**** 權限等級。Verify that the user account that is performing this procedure has Full control permission level at the site.

  2. 在網站的 [設定]**** 功能表上,按一下 [網站設定]*On the site, on the *Settings menu, click Site settings.

  3. 在 [網站設定]**** 頁面的 [搜尋]**** 區段中,按一下 [組態匯出]*On the *Site Settings page, in the Search section click Configuration Export.

  4. 在對話方塊中,按一下 [儲存]*In the dialog box, click *Save.

將自訂的搜尋組態設定匯入網站集合Import customized search configuration settings to a site collection

將自訂的搜尋組態設定匯入網站集合To import customized search configuration settings to a site collection

  1. 確認正在執行此程序的使用者帳戶在網站集合具有 [完全控制]**** 權限等級。Verify that the user account that is performing this procedure has Full control permission level at the site collection.

  2. 在網站集合的 [設定]**** 功能表中,按一下 [網站設定] *In the site collection, in the *Settings menu, click Site Settings.

  3. 在 [網站設定]**** 頁面的 [網站集合管理]**** 區段中,按一下 [搜尋組態匯入]*On the *Site Settings page, in the Site Collection Administration section, click Search Configuration Import.

  4. 在 [匯入搜尋組態]**** 頁面上,輸入要匯入的搜尋組態檔的名稱和位置,或按一下 [瀏覽]**** 並選取要匯入的搜尋組態檔的檔案名稱和位置,然後按一下 [匯入]*On the *Import Search Configuration page, either type the name and location of the search configuration file to import, or click Browse and select the file name and location of the search configuration file to import, and then click Import.

  5. 在 [搜尋設定清單]**** 頁面上,確認:On the Search Config List page, verify that:

    • 您所匯入的搜尋設定檔位於清單中,且其狀態為 [已成功匯入]*The search configuration file that you imported is in the list, and that its status is *Imported Successfully.

      若檔案未成功匯入,[附註]**** 欄會提供相關情況的詳細資料。在某些情況下,即使檔案已成功匯入,[附註]**** 欄仍會提供詳細資料。例如,若檔案中的某個 Managed 屬性與目標上的 Managed 屬性同名,[附註]**** 欄則會指出此 Managed 屬性已存在於目標上。If the file has not imported successfully, the Notes column provides details about what happened. The Notes column also provides details, in some cases, when the file has imported successfully. For example if the file contains a managed property that has the same name as a managed property on the target, the Notes column indicates that this managed property already exists on the target.

    • [範圍]**** 資料行會顯示您所匯入的設定位於正確的層級上,亦即位於您所要匯入的層級。例如,若您在網站集合層級上匯入設定,而非網站層級,[範圍]**** 資料行中就會顯示這項資訊。[範圍]**** 資料行會顯示要在其中啟用搜尋組態設定的層級。這些層級為網站集合 (SPSite) 或網站 (SPWeb)。 The **Scope ** column shows that the settings you imported are at the correct level, that is, at the level you meant to import the files to. For example, if you imported your settings at the site collection level instead of at the site level, you would see this information in the **Scope ** column. The **Scope ** column shows at which level the search configuration settings were enabled. The levels are site collection (SPSite) or site (SPWeb).

將自訂的搜尋組態設定匯入網站Import customized search configuration settings to a site

將自訂的搜尋組態設定匯入網站To import customized search configuration settings to a site

  1. 確認正在執行此程序的使用者帳戶在網站具有 [完全控制]**** 權限等級。Verify that the user account that is performing this procedure has Full control permission level at the site.

  2. 在網站的 [設定]**** 功能表上,按一下 [網站設定]*On the site, on the *Settings menu, click Site settings.

  3. 在 [網站設定]**** 頁面的 [搜尋]**** 區段中,按一下 [組態匯入]*On the *Site Settings page, in the Search section click Configuration Import.

  4. 在 [匯入搜尋組態]**** 頁面上,輸入要匯入的搜尋組態檔的名稱和位置,或按一下 [瀏覽]**** 並選取要匯入的搜尋組態檔的檔案名稱和位置,然後按一下 [匯入]*On the *Import Search Configuration page, either type the name and location of the search configuration file to import, or click Browse and select the file name and location of the search configuration file to import, and then click Import.

  5. 在 [搜尋設定清單]**** 頁面上,確認:On the Search Config List page, verify that:

    • 您所匯入的搜尋設定檔位於清單中,且其狀態為 [已成功匯入]*The search configuration file you imported is in the list, and that its status is *Imported Successfully.

      若檔案未成功匯入,[附註]**** 欄會提供相關情況的詳細資料。在某些情況下,即使檔案已成功匯入,[附註]**** 欄仍會提供詳細資料。例如,若檔案中的某個 Managed 屬性與目標上的 Managed 屬性同名,[附註]**** 欄則會指出此 Managed 屬性已存在於目標上。If the file has not imported successfully, the Notes column provides details about what happened. The Notes column also provides details, in some cases, when the file has imported successfully. For example if the file contains a managed property that has the same name as a managed property on the target, the Notes column indicates that this managed property already exists on the target.

    • [範圍]**** 資料行會顯示您所匯入的設定位於正確的層級上,亦即位於您所要匯入的層級。例如,若您在網站集合層級上匯入設定,而非網站層級,[範圍]**** 資料行中就會顯示這項資訊。[範圍]**** 資料行會顯示要在其中啟用搜尋組態設定的層級。這些層級為網站集合 (SPSite) 或網站 (SPWeb)。 The **Scope ** column shows that the settings you imported are at the correct level, that is, at the level you meant to import the files to. For example, if you imported your settings at the site collection level instead of at the site level, you would see this information in the **Scope ** column. The **Scope ** column shows at which level the search configuration settings were enabled. The levels are site collection (SPSite) or site (SPWeb).

可匯出及匯入的自訂搜尋組態設定概觀Overview of customized search configuration settings that can be exported and imported

當您匯出自訂的搜尋組態設定時,SharePoint Server 會建立 XML 格式的搜尋設定檔。此搜尋設定檔會包含您開始執行匯出的搜尋服務應用程式、網站集合或網站層級上所有可匯出的自訂搜尋組態設定。網站集合的搜尋設定檔不會包含該網站集合中個別網站的搜尋組態設定。When you export customized search configuration settings, SharePoint Server creates a search configuration file in XML format. This search configuration file includes all exportable customized search configuration settings at the Search service application, site collection, or site level from where you start the export. A search configuration file for a site collection does not contain search configuration settings from the individual sites within the site collection.

當您匯入搜尋設定檔時,SharePoint Server 會在您開始執行匯入的網站集合或網站上建立並啟用每個自訂的搜尋組態設定。When you import a search configuration file, SharePoint Server creates and enables each customized search configuration setting in the site collection or site from where you start the import.

此表格會顯示您可以匯出及匯入的設定。表格會指出各項設定對於其他自訂的搜尋組態設定是否有任何相依性。若自訂的搜尋組態設定依存於不同層級上的自訂搜尋組態設定,例如,若網站查詢規則依存於網站集合層級上的結果來源,您就必須匯出及匯入所有相關層級上的設定。This table shows the settings that you can export and import. For each setting, the table indicates any dependencies on other customized search configuration settings. If the customized search configuration settings depend on a customized search configuration setting at a different level, for example, if a site query rule depends on a result source at site collection level, you must export and import settings at all of the relevant levels.

自訂的搜尋組態設定Customized search configuration setting 對於其他自訂搜尋組態設定的相依性Dependency on other customized search configuration settings
查詢規則。包括結果區塊、升級的結果與使用者區段。Query rules. These include result blocks, promoted results, and user segments. 結果來源、結果類型、搜尋結構描述、排名模型Result sources, result types, search schema, ranking model
結果來源Result sources 搜尋結構描述Search schema
結果類型Result types 搜尋結構描述、結果來源、顯示範本Search schema, result sources, display templates
搜尋結構描述Search schema None
排名模型Ranking model 搜尋結構描述Search schema

可能導致匯入失敗的情況Conditions that may cause the import to fail

  • 若搜尋設定檔與您的匯入目標具有名稱相同的設定,當搜尋設定檔遇到此設定時,其匯入即會失敗。例外狀況:If the search configuration file and the target for your import have settings with the same name, the import of the search configuration file fails when it encounters this setting. Exceptions:

    • 若您重新匯入搜尋設定檔,搜尋設定檔與目標上具有相同名稱的設定將不會導致匯入失敗。If you reimport a search configuration file, the settings that have the same name in the search configuration file and on the target do not cause the import to fail.

    • 若搜尋設定檔中的屬性與目標屬性上有相同的個別 Managed 屬性設定,具有相同名稱的 Managed 屬性並不會導致匯入失敗。Managed properties with the same name do not cause an import to fail if the individual managed property settings are the same on the property in the search configuration file and on the target property.

    • 在搜尋設定檔中的 Managed 屬性與目標 Managed 屬性上,若編目屬性的別名與對應不相同,具有相同名稱的 Managed 屬性並不會導致匯入失敗。匯入會將搜尋設定檔中 Managed 屬性的別名與對應新增到目標 Managed 屬性上的別名與對應。Managed properties with the same name do not cause an import to fail if the aliases and mappings to crawled properties are different on the managed property in the search configuration file and on the target managed property. The import adds the aliases and mappings on the managed property in the search configuration file to the aliases and mappings on the target managed property.

  • 若搜尋設定檔中的 Managed 屬性名稱或別名包含無效字元,則在遇到該 Managed 屬性名稱或別名時,匯入就會失敗。If the search configuration file contains managed property names or aliases that contain invalid characters, the import fails when it encounters that managed property name or alias.

  • 搜尋結構描述的 Managed 屬性名稱與別名在網站及其上層網站集合中必須是唯一的。這表示:The managed property names and aliases of a search schema must be unique for a site and its parent site collection. This means:

    • 若搜尋設定檔中的某個 Managed 屬性與目標網站或其上層網站集合上的 Managed 屬性的別名具有相同名稱,匯入即會失敗。If your search configuration file has a managed property that has the same name as an alias for a managed property on your target site or the parent site collection of your target site, then the import fails.

    • 若搜尋設定檔中某個 Managed 屬性的別名與目標網站或其上層網站集合上的 Managed 屬性具有相同名稱,匯入即會失敗。If your search configuration file has a managed property with an alias that has the same name as a managed property on your target site or the parent site collection of your target site, then the import fails.

注意

SharePoint Server 在匯入失敗之前建立並啟用的自訂搜尋設定,仍會保持在啟用狀態。Customized search settings that SharePoint Server created and enabled before the import failed remain enabled.

匯入失敗時,請將導致失敗的情況排除,然後重新匯入搜尋設定檔。例如,若 [附註]**** 欄指出已有與您嘗試匯入的查詢規則同名的查詢規則存在,您即應從目標或匯入檔案中移除該查詢規則,然後重新匯入檔案。If the import fails, remove the condition that caused the failure and reimport the search configuration file. For example, if the Notes column states that there is already a query rule with the same name as the query rule that you are trying to import, then you should remove that query rule either from the target or from the import file, and then reimport the file.

導致匯入失敗的無效字元Invalid characters causing the import to fail

若 Managed 屬性或別名包含下列任何字元,包含這些屬性的自訂搜尋結構描述即無法匯入。If managed properties or aliases contain any of the listed characters, the import of the customized search schema that contains these properties will fail.

字元Character 名稱Name
空格space
: 冒號colon
; 分號semicolon
, 逗號comma
( 左括弧opening parenthesis
) 右括弧closing parenthesis
[ 左方括弧opening bracket
] 右方括弧closing bracket
{ 左大括弧opening brace
} 右大括弧closing brace
% 百分比percent
$ 貨幣符號dollar sign
_ 底線underscore
+ 加號plus sign
! 驚嘆號exclamation point
* 星號asterisk
= 等號equal sign
& & 符號ampersand
? 問號question mark
@ @ 符號at sign
# 數字符號number sign
\ 反斜線backslash
~ 波狀符號tilde
< 左角括弧opening angle bracket
> 右角括弧closing angle bracket
| 直立線符號pipe
` 抑音符號grave accent
^ 插入號caret
' 逸出序列escape sequence
" 逸出序列escape sequence