在 SharePoint Server 中設定搜尋的結果來源Configure result sources for search in SharePoint Server

摘要: 了解如何在 SharePoint Server 2016 和 SharePoint Server 2013 中建立及管理結果來源。Summary: Learn how to create and manage result sources in .SharePoint Server 2016 and SharePoint Server 2013.

「結果來源」將搜尋限於某些內容或是搜尋結果的子集合。SharePoint_Server 提供 16 個預先定義的結果來源。預先設定的預設值結果來源為 [本機 SharePoint 結果]****。您可以將不同的結果來源指定為預設值。如需詳細資訊,請參閱了解 SharePoint Server 中的搜尋結果來源Result sources limit searches to certain content or to a subset of search results. SharePoint_Server provides 16 pre-defined result sources. The pre-configured default result source is Local SharePoint Results. You can specify a different result source as the default. For more information, see Understanding result sources for search in SharePoint Server 2013.

建立結果來源Create a result source

您可以針對 Search Service 應用程式、網站集合或是網站建立結果來源。下表顯示在每一個層級建立結果來源所需的權限,以及結果來源可以使用的場合。You can create a result source for a Search service application, a site collection, or a site. The following table shows the permissions that are required to create a result source at each level, and where the result source can be used.

結果來源的層級與權限Levels and permissions for result sources

當您在此層級建立結果來源時When you create a result source at this level 您必須具備此權限You must have this permission 結果來源可使用於The result source can be used in
Search Service 應用程式Search service application Search Service 應用程式管理員Search service application administrator Web 應用程式中使用 Search Service 應用程式的所有網站集合All site collections in web applications that consume the Search service application
網站集合Site collection 網站集合管理員Site collection administrator 網站集合中的所有網站All sites in the site collection
網站Site 網站擁有人Site owner 該網站The site

建立結果來源To create a result source

根據您要建立結果來源的層級,先執行下列其中一項操作:Depending on the level at which you want to create the result source, first do one of the following:

  • 若要針對 Search Service 應用程式建立結果來源:To create a result source for a Search service application:

    • 請確認執行此程序的使用者帳戶為否為 Search Service 應用程式管理員。Verify that the user account that performs this procedure is an administrator on the Search service application.

    • 在管理中心中,按一下 [應用程式管理]**** 區段的 [管理服務應用程式]*In Central Administration, in the *Application Management section, click Manage service applications.

    • 針對您要建立的結果來源,按一下 [Search Service 應用程式]。Click the Search service application for which you want to create a result source.

    • 在 Search Service 應用程式的 [搜尋管理]**** 頁面上,按一下 [快速啟動] 之 [查詢與結果]**** 區段中的 [結果來源]*On the *Search Administration page for the Search service application, on the Quick Launch, in the Queries and Results section, click Result Sources.

  • 若要建立網站集合的結果來源:To create a result source for a site collection:

    • 請確認執行此程序的使用者帳戶為網站集合的管理員。Verify that the user account that performs this procedure is an administrator for the site collection.

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

    • 在 [網站設定]**** 頁面的 [網站集合管理]**** 區段中,按一下 [搜尋結果來源]*On the *Site Settings page, in the Site Collection Administration section, click Search Result Sources.

  • 若要建立網站的結果來源:To create a result source for a site:

    • 請確認執行此程序的使用者帳戶為網站擁有人群組的成員。Verify that the user account that performs this procedure is a member of the Owners group for the site.

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

    • 在 [網站設定]**** 頁面的 [搜尋]**** 區段中,按一下 [結果來源]*On the *Site Settings page, in the Search section, click Result Sources.

下一步:Next:

  1. 在 [管理結果來源] **** 頁面上,按一下 [新增結果來源]*On the *Manage Result Sources page, click New Result Source.

  2. 在 [新增結果來源]**** 頁面的 [一般資訊]**** 區段中,執行下列操作:On the Add Result Source page, in the General Information section, do the following:

    • 在 [名稱]**** 方塊中,輸入結果來源的名稱。In the Name box, type a name for the result source.

    • 在 [描述]**** 方塊中,輸入結果來源的描述。In the Description box, type a description of the result source.

  3. 在 [通訊協定]**** 區段中,針對擷取搜尋結果,選取下列其中一項通訊協定:In the Protocol section, select one of the following protocols for retrieving search results:

    • [本機 SharePoint]**** (預設通訊協定) 提供此 Search Service 應用程式的搜尋索引結果。Local SharePoint, the default protocol, provides results from the search index for this Search service application.

    • [遠端 SharePoint]**** 提供其他伺服器陣列中的搜尋服務索引結果。Remote SharePoint provides results from the index of a search service in another farm.

      重要

      若要使用遠端 SharePoint 通訊協定,從某個 SharePoint Server 內部部署伺服器陣列的索引,取得另一個 SharePoint Server 內部部署伺服器陣列中的搜尋結果,您必須設定接收查詢的伺服器陣列會信任傳送查詢的伺服器陣列。如需如何執行此作業的資訊,請參閱<設定兩個 SharePoint Server 伺服器陣列之間的搜尋信任>。To use the Remote SharePoint protocol to get search results in one SharePoint Server on-premises farm from the index of another SharePoint Server on-premises farm, you must configure the farm that receives the queries to trust the farm that sends the queries. For information about how to do this, see Configure trust for search between two SharePoint Server farms.

    • [OpenSearch]**** 提供使用 OpenSearch 1.0/1.1 通訊協定之搜尋引擎的結果。OpenSearch provides results from a search engine that uses the OpenSearch 1.0/1.1 protocol.

    • [Exchange]**** 可透過 SharePoint Server eDiscovery 中心,提供來自 Exchange Server 的結果。按一下 [使用自動探索]**** 使搜尋系統自動尋找一個 Exchange Server 端點,或是輸入 Exchange Web 服務的 URL 以擷取結果,例如,從 https://contoso.com/ews/exchange.asmx。Exchange provides results from Exchange_Server_generic through a SharePoint_Server eDiscovery Center. Click Use AutoDiscover to have the search system find an Exchange_Server_generic endpoint automatically, or type the URL of the Exchange web service to retrieve results from — for example, https://contoso.com/ews/exchange.asmx.

      注意

      Exchange 通訊協定只能讓您探索 Exchange Server 內容,而且只能從 SharePoint Server eDiscovery 中心。如需詳細資訊,請參閱 設定 SharePoint Server 與 Exchange Server 之間的通訊。 > 執行搜尋服務的電腦必須安裝 Exchange Web Services Managed API。如需詳細資訊,請參閱< SharePoint Server 2016 的硬體及軟體需求>中的<SharePoint Server 2016 中支援的選用軟體>。The Exchange protocol only enables you to discover Exchange Server content, and only from a SharePoint Server eDiscovery Center. For more information, see Configure communication between SharePoint Server and Exchange Server . > The Exchange Web Services Managed API must be installed on the computer on which the search service is running. For more information, see Optional software supported in SharePoint Server 2016 in Hardware and software requirements for SharePoint Server 2016.

  4. 在先前的步驟中,如果您選取 [本機 SharePoint]**** 或 [遠端 SharePoint]**** 作為通訊協定,請在 [類型]**** 區段中,選取 [SharePoint 搜尋結果]**** 以搜尋全部索引,或選取 [人員搜尋結果]**** 以啟用限於人員搜尋的查詢處理。In the previous step, if you selected either Local SharePoint or Remote SharePoint for the protocol, then in the Type section, select SharePoint Search Results to search the whole index, or select People Search Results to enable query processing that is specific to people search.

  5. 如果您選取了 [遠端 SharePoint]**** 作為通訊協定,請在 [遠端服務 URL]**** 區段中,輸入遠端 SharePoint 伺服器陣列的根網站集合位址。If you selected Remote SharePoint for the protocol, then in the Remote Service URL section, type the address of the root site collection of the remote SharePoint farm.

  6. 如果您選取了 [OpenSearch 1.0/1.1]**** 作為通訊協定,請在 [來源 URL]**** 區段中輸入 OpenSearch 來源的 URL。If you selected OpenSearch 1.0/1.1 for the protocol, then in the Source URL section, type the URL of the OpenSearch source.

  7. 如果您選取了 [Exchange]**** 作為通訊協定,請在 [Exchange 來源 URL]**** 區段中輸入 Exchange Web 服務輸入 URL,例如 https://contoso.com/ews/exchange.asmx。If you selected Exchange for the protocol, then in the Exchange Source URL section, type the URL of the Exchange web service — for example, https://contoso.com/ews/exchange.asmxhttps://contoso.com/ews/exchange.asmx.

  8. 在 [查詢轉換]**** 區段中,執行下列其中一項操作:In the Query Transform section, do one of the following:

    • 保留原有的預設查詢轉換 ([searchTerms]*)。在這種情況下,在先前的轉換之後的查詢將不會變更。Leave the default query transform (*searchTerms) as is. In this case, the query will be unchanged since the previous transform.

    • 在文字方塊中輸入不同的查詢轉換。如需詳細資訊,請參閱了解查詢轉換Type a different query transform in the text box. For more information, see Understanding query transforms.

    • 透過執行下列操作,使用查詢產生器設定查詢轉換:Use the Query Builder to configure a query transform by doing the following:

      • 按一下 [啟動查詢產生器]*Click *Launch Query Builder.

      • 在 [建立查詢]**** 對話方塊中,在如下列資料表所示的索引標籤上指定篩選、排序及測試,以建立選用查詢。In the Build Your Query dialog box, optionally build the query by specifying filters, sorting, and testing on the tabs as shown in the following tables.

在 [基礎] 索引標籤上On the BASICS tab

關鍵字篩選Keyword filter 您可從下拉式清單中選取預先定義的查詢變數,然後按一下 [新增關鍵字篩選]*,將其新增到查詢中。You can use keyword filters to add pre-defined query variables to the query transform. You can select pre-defined query variables from the drop-down list, and then add them to the query by clicking *Add keyword filter.

如需查詢變數的概觀,請參閱 SharePoint Server 中的查詢變數For an overview of query variables, see Query variables in SharePoint Server.
屬性篩選Property filter 您可使用屬性篩選,以查詢搜尋結構描述中設為可查詢** 之 Managed 屬性的內容。You can use property filters to query the content of managed properties that are set to queryable in the search schema.

您可從 [屬性篩選]**** 下拉式清單中選取 Managed 屬性。按一下 [新增屬性篩選]*,將篩選新增到查詢中。You can select managed properties from the *Property filter drop-down list. Click Add property filter to add the filter to the query.

在 [排序] 索引標籤上On the SORTING tab

排序結果Sort results 在 [排序方式]**** 功能表中,從 Managed 屬性 (其搜尋結構描述中是設定為 [可排序的]) 清單中選取一個 Managed 屬性,然後選取 [遞減]**** 或 [遞增]*。若要依據關聯來排序 (亦即使用排名模型),請選取 [排名]。您可以按一下 [新增排序等級]*** 以指定搜尋結果的次要等級排序屬性。請注意,搜尋結果的排序會區分大小寫。In the Sort by menu, you can select a managed property from the list of managed properties that are set as sortable in the search schema, and then select Descending or Ascending. To sort by relevance, that is, to use a ranking model, select Rank. You can click Add sort level to specify a property for a secondary level of sorting for search results.
排名模型Ranking model 如果已從 [排序方式]**** 清單選取 [排名],就可以選取排序使用的排名模型。If you selected Rank from the **Sort by list, you can select the ranking model to use for sorting.
動態排序Dynamic ordering 您可以按一下 [新增動態排序規則]*,在某些達成條件的結果區塊中,透過新增變更結果順序的規則,指定其他排名。You can click *Add dynamic ordering rule to specify additional ranking by adding rules that change the order of results within the result block when certain conditions are satisfied.

在 [測試] 索引標籤上On the TEST tab

查詢文字Query text 您可以檢視最終的查詢文字,該文字是根據原始查詢範本、適用查詢規則以及變數值而得。You can view the final query text, which is based on the original query template, the applicable query rules, and the variable values.
按一下 [顯示更多]*,以顯示此資料表中下列資料列的選項。Click *Show more to display the options in the following rows of this table.
查詢範本Query template 您可以在 [基礎]**** 索引標籤,或是在 [新增結果來源] 頁面之 [查詢轉換]**** 區段的文字方塊中檢視定義的查詢。You can view the query as it is defined in the BASICS tab or in the text box in the Query transform section on the Add Result Source page.
查詢範本變數Query template variables 您可以透過指定查詢變數以測試查詢範本。You can test the query template by specifying values for the query variables.

最後,在 [新增結果來源]**** 頁面的 [認證資訊]**** 區段中,選取當使用者連線至結果來源時,您想要的驗證類型。Finally, on the Add Result Source page, in the Credentials Information section, select the authentication type that you want for users to connect to the result source.

將結果來源設定為預設值Set a result source as default

您可以將任何結果來源設定為預設結果來源。將結果來源指定為預設值,可以使該項查詢在搜尋網頁組件中更容易編輯。舉例來說,當您將內容搜尋網頁組件新增至頁面時,網頁組件會自動使用預設結果來源。如需詳細資訊,請參閱<在 SharePoint Server 中設定搜尋網頁組件>。You can set any result source as the default result source. Specifying a result source as default can make it easier to edit the query in Search Web Parts. For example, when you add a Content Search Web Part to a page, the Web Part automatically uses the default result source. For more information, see Configure Search Web Parts in SharePoint Server.

將結果來源設定為預設值To set a result source as default

依設定結果來源所在的層級,執行下列清單中適當的程序。Perform the appropriate procedures in the following list depending on the level at which the result source was configured.

  • 如果該項結果來源建立於 Search Service 應用程式層級,請執行下列操作:If the result source was created at the Search service application level, do the following:

    1. 確認執行此程序的使用者帳戶為否為 Search Service 應用程式管理員。Verify that the user account that performs this procedure is an administrator for the Search service application.

    2. 在管理中心中,按一下 [應用程式管理]**** 區段的 [管理服務應用程式]*In Central Administration, in the *Application Management section, click Manage service applications.

    3. 按一下您要將其結果來源設為預設值的 Search Service 應用程式。Click the Search service application for which you want to set the result source as default.

    4. 在 [搜尋管理]**** 頁面的 [查詢與結果]**** 區段中,按一下 [結果來源]*On the *Search Administration page, in the Queries and Results section, click Result Sources.

  • 如果結果來源位於網站集合層級,請執行下列操作:If the result source is at the site collection level, do the following:

    1. 確認執行此程序的使用者帳戶為網站集合管理員的管理員。Verify that the user account that performs this procedure is an administrator for the site collection administrator.

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

    3. 在 [網站設定]**** 頁面的 [網站集合管理]**** 區段中,按一下 [搜尋結果來源]*On the *Site Settings page, in the Site Collection Administration section, click Search Result Sources.

  • 如果該項結果來源位於網站層級,請執行下列操作:If the result source is at the site level, do the following:

    1. 請確認執行此程序的使用者帳戶為網站擁有人群組的成員。Verify that the user account that performs this procedure is a member of the Owners group for the site.

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

    3. 在 [網站設定]**** 頁面的 [搜尋]**** 區段中,按一下 [結果來源]*On the *Site Settings page, in the Search section, click Result Sources.

  • 在「管理結果來源」頁面,指向您要設為預設值的結果來源,按一下顯示的箭頭,然後按一下 [設為預設值]。On the Manage Result Sources page, point to the result source that you want to set as default, click the arrow that appears, and then click Set as Default.

另請參閱See also

在 SharePoint Server 中查詢變數Query variables in SharePoint Server