在 SharePoint Server 中設定搜尋網頁組件Configure Search Web Parts in SharePoint Server

摘要:了解如何設定在發佈環境中使用搜尋技術的不同網頁組件。Summary: Learn how to configure the different Web Parts that use search technology in a publishing environment.

使用搜尋技術顯示內容 (以本文做為搜尋網頁組件中稱為) 發佈環境中的網頁組件會顯示已編目並新增至搜尋索引的內容中所述"了解如何新增至和受管理的內容搜尋索引 「跨網站發佈的 SharePoint Server 的概觀。這些網頁組件具有查詢定義,且當使用者瀏覽至包含網頁組件] 頁面上使用搜尋技術、 網頁組件都會自動發出查詢。查詢結果然後會顯示在 [網頁組件。您可以修改搜尋以符合您的內容需求的網頁組件中的查詢。Web Parts that use search technology to show content in a publishing environment (referred to in this article as Search Web Parts) show content that was crawled and added to the search index, as described in "Understanding how content is added to and managed in the search index" in Overview of cross-site publishing in SharePoint Server. These Web Parts have queries defined in them, and when users browse to a page that contains a Web Part that uses search technology, the Web Part issues the query automatically. The query result is then displayed in the Web Part. You can modify the query in the search Web Part to fit your content needs.

開始之前Before you begin

注意

因為在網際網路資訊服務 (IIS) 網站執行 SharePoint Server、 系統管理員和使用者而定的瀏覽器提供的協助工具功能。SharePoint Server 支援支援的瀏覽器的協助工具功能。如需詳細資訊,請參閱下列資源: >規劃瀏覽器支援> SharePoint 2013 的協助工具> SharePoint 2013 產品的協助工具功能> 快速鍵> 觸控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: > Plan browser support> Accessibility for SharePoint 2013> Accessibility features in SharePoint 2013 Products> Keyboard shortcuts> Touch

有提供 SharePoint Server 中的許多搜尋網頁組件。這些網頁組件已預先定義的查詢,例如何種類型的內容搜尋、 要搜尋的內容、 位置及如何顯示內容。如需不同的搜尋網頁組件的資訊,請參閱中的 「 規劃新增搜尋網頁組件至頁面"規劃跨網站發佈的 SharePoint Server 發佈網站。搜尋網頁組件的許多使用結果來源,並已套用至他們的查詢規則。結果來源縮小所擷取的搜尋結果的範圍。查詢規則是一組會導致的特定方式變更查詢的情況。如需結果來源和查詢規則的詳細資訊,請參閱 <規劃結果來源和查詢規則There are many Search Web Parts available in SharePoint Server. These Web Parts have predefined queries, such as what type of content to search for, where to search for content, and how to show content. For information about different Search Web Parts, see "Plan to add search Web Parts to pages" in Plan publishing sites for cross-site publishing in SharePoint Server. Many of the Search Web Parts use result sources and have query rules that are applied to them. Result sources narrow the scope of search results that are retrieved. A query rule is a set of conditions that will cause the query to be changed in a specific way. For more information about result sources and query rules, see Plan result sources and query rules.

若要自訂搜尋網頁組件顯示搜尋結果的方式 — 例如,若要顯示的圖像後面加上標題中粗體右邊的映像-修改顯示範本。搜尋網頁組件最相關的顯示範本的兩種類型的控制顯示範本和項目顯示範本。如需關於預設顯示範本,請參閱顯示範本參考 (英文) SharePoint Server 中To customize how search results appear in Search Web Parts — for example, to show an image followed by a title in bold to the right of the image — you modify display templates. The two types of display templates that are most relevant to Search Web Parts are control display templates and item display templates. For more information about the default display templates, see Display template reference in SharePoint Server.

新增內容搜尋網頁組件至頁面Add a Content Search Web Part to a page

若要新增內容搜尋網頁組件至頁面To add a Content Search Web Part to a page

  1. 確認執行此程序的使用者帳戶為發佈網站集合上的 Designers SharePoint 群組成員。Verify that the user account that performs this procedure is a member of the Designers SharePoint group on the publishing site collection.

  2. 瀏覽至欲新增網頁組件的頁面。Browse to the page where you want to add the Web Part.

  3. 按一下 [設定] 功能表及 [編輯] 頁面Click the Settings menu, and then click Edit page.

  4. 在您要新增網頁組件網頁組件區域,按一下 [新增網頁組件In the Web Part Zone where you want to add the Web Part, click Add a Web Part.

  5. 在 [類別] 清單中,按一下 [內容彙總In the Categories list, click Content Rollup.

  6. 在 [組件] 清單中,按一下 [內容搜尋] 和 [新增In the Parts list, click Content Search, and then click Add.

設定內容搜尋網頁組件的查詢Configure the query for a Content Search Web Part

您可在快速模式中使用內容搜尋網頁組件,並從現有結果來源清單中選取選項,以建立查詢,或者,您可以切換至進階模式,並使用關鍵字查詢語言 (KQL) 來建立自訂的查詢。請僅在您確知 KQL 和 Managed 屬性所啟用的功能時才使用進階模式。You can use the Content Search Web Part in Quick Mode and create a query by selecting options from a list of existing result sources, or you can switch to Advanced Mode to create your own custom query by using Keyword Query Language (KQL). Use the Advanced Mode only if you know KQL and the functionality that is enabled for the managed properties.

若要設定內容搜尋網頁組件的查詢To configure the query for a Content Search Web Part

  1. 確認執行此程序的使用者帳戶為發佈網站集合上的 Designers SharePoint 群組成員。Verify that the user account that performs this procedure is a member of the Designers SharePoint group on the publishing site collection.

  2. 瀏覽至包含欲設定之內容搜尋網頁組件的頁面。Browse to the page that contains the Content Search Web Part that you want to configure.

  3. 按一下 [設定] 功能表及 [編輯頁面]Click the Settings menu, and then click Edit Page.

  4. 網頁組件中按一下內容搜尋網頁組件功能表]箭頭,然後再按一下 [編輯網頁組件In the Web Part, click the Content Search Web Part Menu arrow, and then click Edit Web Part.

  5. 在網頁組件] 工具窗格的 [屬性] 區段的 [搜尋準則] 區段中按一下 [變更查詢]。In the Web Part tool pane, in the Properties section, in the Search Criteria section, click Change query.

  6. 在 [基礎] 索引標籤上執行下列其中一項:On the BASICS tab, do one of the following:

    • 若要使用快速模式來定義查詢,請選取下表中所述的選項:To define your query by using Quick Mode, select options as described in the following table:

    快速模式 (預設值)Quick Mode (default)

選取查詢Select a query
選取結果來源以指定應該搜尋哪些內容。如果您有共用文件庫或清單作為目錄,目錄結果來源將會顯示在此下拉式清單中。根據預設,這設為最近變更的項目 (系統)。Select a result source to specify which content should be searched. If you have shared a document library or list as catalog, the catalog result source will be displayed in this drop-down list. By default, this is set to Recently changed items (System).
依據應用程式限制結果Restrict results by app
從清單選取選項,將結果限制特定網站、 文件庫、 清單或 URL。根據預設,這是設為目前網站Select an option from the list to restrict results to a specific site, library, list, or URL. By default, this is set to Current site.
依標籤限制Restrict by tag
您可將結果限制在標記了字詞組之字詞的內容。You can limit results to content that is tagged with a term from a term set.
請選取下列任一選項:Select one of the following options:
:----- :-----
不要受任何標籤限制Don't restrict by any tag
不會依據標籤來限制搜尋結果 (預設)。Search results will not be limited based on tags (default).
依目前頁面的導覽字詞來限制Restrict by navigation term of current page
搜尋結果會限制在標記了目前頁面之字詞的內容。目前的標記會顯示為易記 URL 的最後一部分。此選項僅適用於使用受管理導覽的網站。Search results will be limited to content that is tagged with the term of the current page. The current tag is displayed as the last part of the friendly URL. This option is only meaningful for sites that use managed navigation.
依據目前和子導覽加以限制Restrict by current and child navigation
搜尋結果會限制在標記了目前頁面 (顯示為易記 URL 的最後一部分) 之字詞的內容以及標記了目前頁面之子字詞的內容。此選項僅適用於使用受管理導覽的網站。Search results will be limited to content that is tagged with the term of the current page (displayed as the last part of the friendly URL), and content that is tagged with sub-terms of the current page. This option is only meaningful for sites that use managed navigation.
> [!NOTE]> 在跨網站發佈案例中,此選項僅適時選取 [查詢] 區段中選取結果來源時的發佈網站連線到目錄建立目錄結果來源。> [!NOTE]> In a cross-site publishing scenario, this selection will only work when the result source selected in the Select a query section is the catalog result source that is created when a publishing site is connected to a catalog.
依此標籤限制Restrict on this tag
搜尋結果會限制在已標記了您在方塊中所輸入標籤的內容。Search results will be limited to content that is tagged with the tag that you type inside the box.

|

  • 若要使用關鍵字查詢語言 (KQL) 來建立您自己的查詢,請按一下 [參數設為進階模式。如需 KQL 詳細資訊,請參閱關鍵字查詢語言 (KQL) 語法參考 (英文)。當您設定查詢進階模式時,您也可以使用查詢變數。查詢變數所要顯示包含內容搜尋網頁組件的頁面時動態變更頁面的內容而值的預留位置。從查詢傳送至索引的內容以動態方式插入正確的資訊。查詢變數的範例是 {User.Name},這代表名稱檢視] 索引標籤或 {searchBoxQuery} 的使用者,其代表使用者輸入的搜尋方塊中的查詢。選取下表所述的選項:To create your own query by using Keyword Query Language (KQL), click Switch to Advanced Mode. For information about KQL, see Keyword Query Language (KQL) syntax reference. When you configure the query in Advanced Mode, you can also use query variables. Query variables are placeholders for values that change dynamically depending on the context of the page when the page that contains the Content Search Web Part is being displayed. The correct information is inserted dynamically from the context the query is sent to the index. Examples of query variables are {User.Name}, which represents the name of the user who is viewing the page, or {searchBoxQuery}, which represents the query that a user typed in a search box. Select options as described in the following table:

    注意

    當您切換為進階模式時,您選取[選取查詢的結果來源會由不同的結果來源取代。這種結果來源可能會影響搜尋結果。因此,請確定您檢查搜尋結果顯示在 [搜尋結果預覽] 區段中,並在 [查詢文字] 欄位中新增查詢設定,如果您需要。When you switch to Advanced Mode, the result source that you selected from Select a query is replaced by a different result source. This result source could affect the search results. Therefore, make sure that you check the search results that are displayed in the SEARCH RESULT PREVIEW section, and add query configuration in the Query text field if you need to.

    進階的模式Advanced Mode

選取查詢Select a query
選取結果來源,以指定要搜尋哪些內容。Select a result source to specify which content should be searched.
預設結果來源為 [本機 SharePoint 結果 (系統)]。Default result source is Local SharePoint Results (System).
關鍵字篩選Keyword filter
您可以使用關鍵字篩選新增至查詢的查詢變數。請參閱SharePoint Server 中的查詢變數可用查詢變數的清單。You can use keyword filters to add query variables to your query. See Query variables in SharePoint Server for a list of available query variables.
您可以從下拉式清單中選取預先定義的查詢變數並再按一下 [新增關鍵字篩選將其新增至查詢。You can select pre-defined query variables from the drop-down list, and then add them to the query by clicking Add keyword filter.
屬性篩選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.
查詢文字Query text
使用關鍵字查詢語言 (KQL) 輸入查詢或使用 [關鍵字篩選] 及 [屬性篩選清單建立查詢。Type your query by using Keyword Query Language (KQL), or use the Keyword filter and Property filter lists to build the query.
關鍵字查詢可包含任意的關鍵字、屬性篩選或運算子。請使用大括弧括住查詢變數,在執行查詢時,系統會自動將查詢變數取代為實際的值。The keyword query can consist of free-text keywords, property filters, or operators. Use braces to enclose query variables. The query variables will be replaced with an actual value when the query is run.
關鍵字查詢的長度上限為 2,048 個字元。Keyword queries have a maximum length of 2,048 characters.
  1. 精簡器] 索引標籤上列出已啟用為精簡器搜尋結構描述中的 managed 的屬性。您可以指定的內容搜尋網頁組件中傳回的搜尋結果應限制為一或多個值從精簡器。按一下清單中的精簡器,然後按一下 [套用] 將其新增至查詢。The REFINERS tab lists the managed properties that are enabled as refiners in the search schema. You can specify that the search results returned in the Content Search Web Part should be limited to one or more values from the refiners. Click a refiner in the list, and then click Apply to add it to the query.

    按一下 [顯示更多如果您想要定義分組的結果。[群組結果,您可以指定的結果應該分組根據一或多個 managed 屬性。當您要顯示特定項目數種變體並想要將這些群組在單一的結果] 底下,這很有用。Click Show more if you want to define grouping of results. Under Group results, you can specify that the results should be grouped based on one or more managed properties. This is useful when you are displaying several variants for a given item, and want to group them under a single result.

  2. 在 [排序] 索引標籤中,您可以指定排序搜尋結果的方式。On the SORTING tab, you can specify how search results should be sorted.

    只有當您使用進階模式使用這個索引標籤。如果您使用快速模式,您可以定義的排序選項中的結果來源。This tab is available only if you use Advanced Mode. If you use Quick Mode, you can define sorting options in the result source.

    在 [排序依據] 下拉式清單中,選取 managed 的屬性清單中的 managed 屬性的設定為可排序的搜尋結構描述中,然後選取 [遞減排序] 或 [遞增。例如,能夠相關性來排序 (也就是使用排名模型) 選取 [排名]In the Sort by drop-down list, 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. For example, to sort by relevance (that is, to use a ranking model) select Rank.

    若要新增更多排序層級,請按一下 [新增排序層級To add more sorting levels, click Add sort level.

    注意

    [!附註] 搜尋結果的排序區分大小寫。Sorting of search results is case sensitive.

    重要

    如果您的結果來源包含排序,則不應該在內容搜尋網頁組件中指定排序。原因是結果來源中的排序會覆寫內容搜尋網頁組件中所指定的排序。If your result source contains sorting, you should not specify sorting in the Content Search Web Part. This is because the sorting in the result source overrides the sorting that you specify in the Content Search Web Part.

    如果您從 [排序依據] 清單選取排名,您可以選取要用來排序的排名模型] 清單中的排名模型。If you selected Rank from the Sort by list, you can select which ranking model to use for sorting in the Ranking Model list.

    在 [動態排序,您可以由新增特定情況時將變更結果順序的規則指定其他排名。按一下 [新增動態排序規則],然後指定 [設定格式化條件規則。Under Dynamic ordering, you can specify additional ranking by adding rules that will change the order of results when certain conditions apply. Click Add dynamic ordering rule, and then specify conditional rules.

  3. 在 [設定] 索引標籤上指定設定所列在下表中。On the SETTINGS tab, specify the settings that are listed in the following table.

查詢規則Query Rules
選取是否要使用查詢規則。Select whether to use Query Rules or not.
URL 重寫URL Rewriting
如果項目詳細資料] 頁面的 URL 重寫應繼續為相對的每個目錄項目所定義的目錄連線設定時,選取。如果您選取 [不要修正 Url、 目錄項目的 Url 會指向直接連線的目錄的文件庫項目。Select if the URL rewrite to the item details page should continue to be relative for each catalog item as defined when you set up the catalog connection. If you select Don't rewrite URLs, the URLs for catalog items are pointed directly to the library item of the connected catalog.
載入行為Loading Behavior
選取 [當內容搜尋網頁組件所傳回的搜尋結果出現在網頁上。預設選項是同步處理選項: 問題查詢伺服器從。藉由使用此載入行為,從伺服器] 發出查詢和搜尋結果都包含在傳送回從 SharePoint Server 的頁面回應。如果您選取 [非同步處理選項: 從瀏覽器的問題查詢,將從使用者瀏覽器發出查詢之後收到 [完成] 頁面。此選項可能會被視為次要內容頁面上的 — 例如建議或常用項目。Select when the search results returned by the Content Search Web Part appear on the web page. The default option is Sync option: Issue query from the server. By using this loading behavior, queries are issued from the server, and the search results are included in the page response that is sent back from SharePoint Server. If you select Async option: Issue query from the browser, the queries will be issued from the end-users browser after the complete page is received. This option may be considered for secondary content on a page — for example Recommendations or Popular Items.
優先順序Priority
選取最適合說明內容由相對於其他搜尋網頁組件此網頁組件顯示的相對重要性層級。如果 SharePoint 伺服器執行負載過重,將會根據其優先順序來執行查詢。Select the level that best describes the relative importance of content that is displayed by this Web Part in relation to other Search Web Parts. If SharePoint Server is running under heavy load, the queries will be run according to their priority.
快取Caching
如果您想要搜尋結果快取的使用者群組中,選取一個 Active Directory 安全性群組。透過快取安全性群組的搜尋結果,您可以減少頁面重新載入時間。Select one Active Directory security group if you want search results to be cached for users in the group. By caching search results for a security group, you can reduce page reload time.
> [!NOTE]> 您應該只選取其中有相同的群組中的所有使用者的搜尋結果的安全性群組。如需詳細資訊,請參閱本文> [!NOTE]> You should only select a security group where search results are identical for all users in the group. For more information, see this article.
  1. 在 [測試] 索引標籤上您可預覽內容搜尋網頁組件傳送出的查詢。On the TEST tab, you can preview the query that is sent by the Content Search Web Part.
查詢文字Query text
可顯示內容搜尋網頁組件所執行的最終查詢。查詢文字會以將動態變數取代為目前值之原始查詢範本為依據,因此其他查詢變更就可能必須以查詢規則形式來進行。Shows the final query that will be run by the Content Search Web Part. It is based on the original query template where dynamic variables are substituted with current values. Other changes to the query may have to be made as part of query rules.
Click **Show more** to display additional information. 
查詢範本Query template
顯示套用至查詢的查詢範本內容。Shows the content of the query template that is applied to the query.
精簡依據Refined by
套用至查詢的精簡器] 索引標籤上定義的方式來顯示。Shows the refiners applied to the query as defined on the REFINERS tab.
群組依據Grouped by
顯示的搜尋結果應該依據所定義的精簡器] 索引標籤上的 managed 的屬性。Shows the managed property on which search results should be grouped as defined on the REFINERS tab.
套用的查詢規則Applied query rules
顯示查詢套用了哪些查詢規則。Shows which query rules are applied to the query.
The **Query template variables** section shows the query variables that will be applied to the query, and the values of the variables that apply to the current page. You can type other values to test the effect they will have on the query. Click the **Test Query** button to preview the search results. 

You can also test how the query works for different user segment terms. Click **Add user segment term** to add terms to be added to the query. Click the **Test query** button to preview the search results. 
查詢文字Query text
可顯示內容搜尋網頁組件所執行的最終查詢。查詢文字會以將動態變數取代為目前值之原始查詢範本為依據,因此其他查詢變更就可能必須以查詢規則形式來進行。Shows the final query that will be run by the Content Search Web Part. It is based on the original query template where dynamic variables are substituted with current values. Other changes to the query may have to be made as part of query rules.

設定內容搜尋網頁組件的顯示範本Configure the display templates for the Content Search Web Part

將發佈網站連接至目錄時,目錄頁面上的內容搜尋網頁組件的預設控制項顯示範本為「分頁提列」(主版頁面圖庫中的名稱為 Control_ListWithPaging)。When you connect a publishing site to a catalog, the default control display template for the Content Search Web Part on your category page is List with Paging (named Control_ListWithPaging in the Master Page Gallery).

內容搜尋網頁組件的預設項目顯示範本為「圖片在上方,底下有 3 行字」(主版頁面圖庫中的名稱為 Item_Picture3Lines)。若您想在目錄頁面上使用其他顯示範本,可變更內容搜尋網頁組件的設定來加以變更。The default item display template for the Content Search Web Part is Picture on top, 3 lines on bottom (named Item_Picture3Lines in the Master Page Gallery). If you want to use other display templates on your category page, you can change them by changing the settings for the Content Search Web Part.

如需如何自訂和建立您自己的顯示範本,請參閱SharePoint 2013 設計管理員顯示範本。如需自訂顯示範本時,您可以使用的 JavaScript 方法的資訊,請參閱Srch.U 物件 (DisplayTemplatesSrch)For information on how to customize and create your own display templates, see SharePoint 2013 Design Manager display templates. For information about JavaScript methods that you can use when you customize your display templates, see Srch.U object (DisplayTemplatesSrch).

新增精簡搜尋網頁組件至頁面Add a Refinement Web Part to a page

您可以將精簡器新增到頁面以便縮小顯示在內容搜尋網頁組件,並協助使用者快速瀏覽至特定內容項目。精簡器為基礎的搜尋索引的 managed 屬性。若要顯示精簡器] 頁面上,您必須先啟用 managed 的屬性要做為精簡器,並再新增至您想要顯示精簡器] 頁面上的 [精簡搜尋網頁組件。您可以設定精簡搜尋網頁組件中的精簡器的兩種類型:獨立精簡器多面向導覽的精簡器。如需不同的精簡器類型的詳細資訊,請參閱 <規劃精簡器和多面向導覽規劃 SharePoint Server 2016 跨網站發佈網站的搜尋You can add refiners to a page to narrow the items that are shown in a Content Search Web Part, and help users quickly browse to specific content. Refiners are based on managed properties from the search index. To display refiners on a page, you must first enable the managed property that you want to use as a refiner, and then add a Refinement Web Part to the page where you want the refiners to appear. You can configure the Refinement Web Part for two types of refiners: Stand-alone refiners and Refiners for faceted navigation. For more information about the different refiner types, see Plan refiners and faceted navigation in Plan search for cross-site publishing sites in SharePoint Server 2016.

開始此程序之前,請先確認下列事項:Before you begin this procedure, verify the following:

  • 您想要做為精簡器啟用為可精簡搜尋的 managed 的屬性的 managed 屬性中所述"編目的屬性對應到可精簡搜尋的 managed 屬性在 SharePoint 網站集合管理中"或者"啟用自動建立受管理屬性為精簡器在 SharePoint 管理中心 」 中設定精簡器 」 和 「 SharePoint Server 中的多層面導覽The managed properties that you want to use as refiners are enabled as refinable managed properties as described in "Map a crawled property to a refinable managed property in SharePoint site collection administration" or "Enable automatically created managed properties as refiners in SharePoint Central Administration " in Configure refiners and faceted navigation in SharePoint Server.

  • 您已完成包含 managed 的屬性啟用為精簡器,或所述您的目錄應完全大致目錄中 「 設定跨網站的搜尋所述的下一個排程編目期間的內容來源的完整編目在 [設定跨網站發佈的 SharePoint Server發佈 」。You have done a full crawl of the content source that contains the managed properties that are enabled as refiners, or indicated that your catalog should be fully reindexed during the next scheduled crawl of the catalog as described in "Configure search for cross-site publishing" in Configure cross-site publishing in SharePoint Server.

  • 如果您使用多面向導覽精簡器,您已設定精簡器 」 將精簡器新增到字詞組 」 中設定精簡器和多面向導覽 SharePoint Server 中的所述。If you are using refiners for faceted navigation, you have configured the refiners as described in "Add refiners to a term set" in Configure refiners and faceted navigation in SharePoint Server.

    新增精簡搜尋網頁組件至頁面To add a Refinement Web Part to a page

  1. 確認執行此程序的使用者帳戶為發佈網站集合上的 Designers SharePoint 群組成員。Verify that the user account that performs this procedure is a member of the Designers SharePoint group on the publishing site collection.

  2. 瀏覽至欲新增網頁組件的頁面。Browse to the page where you want to add the Web Part.

  3. 按一下 [設定] 功能表及 [編輯頁面]Click the Settings menu, and then click Edit Page.

  4. 在您要新增網頁組件網頁組件區域,按一下 [新增網頁組件In the Web Part Zone where you want to add the Web Part, click Add a Web Part.

  5. 在 [類別] 清單中,選取 [搜尋In the Categories list, select Search.

  6. [組件] 清單中選取 [精簡搜尋] 和 [新增]In the Parts list, select Refinement, and then click Add.

設定精簡搜尋網頁組件Configure the Refinement Web Part

若要設定之精簡搜尋組件To configure the Refinement Part

  1. 確認執行此程序的使用者帳戶為發佈網站集合上的 Designers SharePoint 群組成員。Verify that the user account that performs this procedure is a member of the Designers SharePoint group on the publishing site collection.

  2. 瀏覽至包含欲設定之精簡搜尋網頁組件的頁面。Browse to the page that contains the Refinement Web Part that you want to configure.

  3. 按一下 [設定] 功能表及 [編輯頁面]Click the Settings menu, and then click Edit Page.

  4. 網頁組件中按一下精簡搜尋網頁組件功能表]箭頭,然後再按一下 [編輯網頁組件In the Web Part, click the Refinement Web Part Menu arrow, and then click Edit Web Part.

  5. 您可使用下列程序,設定獨立精簡器的網頁組件或多面向導覽精簡器的網頁組件。You can configure the Web Part for stand-alone refiners or for refiners for faceted navigation by using the following procedures,

    • 若要設定獨立精簡器的網頁組件:To configure the Web Part for stand-alone refiners:
  6. 在 [網頁組件工具窗格] 中的精簡搜尋屬性] 區段中,確認已選取 [選擇此網頁組件中的精簡器In the Web Part tool pane, in the Properties for Search Refinement section, verify that the Choose Refiners in this Web Part is selected.

  7. 按一下 [選擇精簡器...Click Choose Refiners…

  8. 在 [精簡搜尋設定] 頁面上可用的精簡器] 區段中,從使用] 按鈕以選取的精簡器應新增至字詞組,以及他們應該要顯示的順序。如果您有指定別名為可精簡搜尋的 managed 屬性,這個別名會顯示在 [設定] 區段中。On the Refinement configuration page, from the Available refiners section, use the buttons to select which refiners should be added to the term set, and also in which order that they should be displayed. If you have specified an alias for a refinable managed property, this alias is displayed in the Configuration for section.

  9. 在 [設定] 區段中設定每個精簡器的顯示方式。In the Configuration for section, set the configuration for how every refiner appears.

    注意

    如果您有單一語言網站,您可以變更顯示名稱] 區段中的精簡器顯示名稱。多語系網站,您必須變更精簡器顯示語言變更精簡器顯示名稱所述。If you have a single language site, you can change the refiner display name in the Display name section. For multilingual sites, you have to change the refiner display language as described in Change the refiner display name.

    • 若要設定多面向導覽精簡器的網頁組件:To configure the Web Part for refiners for faceted navigation:
  10. 在網頁組件] 工具窗格的 [精簡搜尋屬性] 區段中選取設定使用中受管理導覽字詞定義精簡搜尋設定] 選項。In the Web Part tool pane, in the Properties for Search Refinement section, select the option Use the refinement configuration defined in the Managed Navigation term set.

變更精簡器顯示名稱Change the refiner display name

新增精簡搜尋網頁組件,為顯示精簡器的名稱會使用已啟用為精簡器的 managed 屬性的名稱。會在許多情況下,不容易記住的 managed 的屬性名稱 — 例如 RefinableString00 或 ColorOWSTEXT。您可以透過變更 java 指令碼檔案在主版頁面圖庫中的變更精簡器的顯示名稱。When you add a Refinement Web Part, the name of the managed property that is enabled as a refiner will be used as display name for the refiner. In many cases, the managed property name is not user-friendly — for example, RefinableString00 or ColorOWSTEXT. You can change the display name of the refiner by changing a java script file in the master page gallery.

變更精簡器顯示名稱To change the refiner display name

  1. 確認執行此程序的使用者帳戶為發佈網站集合上的 Designers SharePoint 群組成員。Verify that the user account that performs this procedure is a member of the Designers SharePoint group on the publishing site collection.

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

  3. 按一下 [網站設定] 頁面上的 [ Web Designer 圖庫] 區段中的 [主版頁面與版面配置]。On the Site Settings page, in the Web Designer Galleries section, click Master pages and page layouts.

  4. 在 [主版頁面圖庫] 頁面上,按一下 [顯示範本On the Master Page Gallery page, click Display Templates.

  5. 按一下 [顯示範本] 頁面的 [語言檔案]。On the Display Templates page, click Language Files.

  6. 在 [語言檔案] 頁面上,按一下資料夾包含您想要變更的精簡器顯示名稱的語言。On the Language Files page, click the folder that contains the language that you want to change the refiner display name for.

  7. 開啟 CustomStrings.js 檔案。Open the CustomStrings.js file.

  8. 使用下列語法,為每個欲變更顯示名稱之精簡器的 Managed 屬性檔案新增一行:Add one line to the file for each managed property that is enabled as a refiner for which you want to change the display name byusing the following syntax:

    "rf_RefinementTitle_ManagedPropertyName": "Sample Refinement Title for ManagedPropertyName"

    例如,您可新增下列字行,將 Managed 屬性 RefinableInt00 的顯示名稱變更為 Price:For example, you can add the following line to change the display name for the managed property RefinableInt00 to Price:

    "rf_RefinementTitle_RefinableInt00": "Price".

顯示精簡搜尋網頁組件中的精簡器計數Display refiner counts in a Refinement Web Part

當您新增精簡搜尋網頁組件] 頁面上,依預設時,[網頁組件將不會顯示精簡器計數--亦即每個精簡器值的項目數。例如,如果您已啟用 managed 的屬性作為精簡器的色彩、 精簡器值只會顯示紅色、 綠色和藍色的色彩。您可以新增精簡器計數使精簡器值顯示成紅色 (10) 變更為 HTML 檔案中的值 (12)、 綠色和藍色 (8)。When you add a Refinement Web Part to a page, by default, the Web Part will not show refiner counts — that is, the number of items for each refiner value. For example, if you have enabled the managed property Color as a refiner, the refiner values will only show colors such as Red, Green, and Blue. You can add refiner counts by changing a value in an HTML file so that the refiner values are shown as Red (10), Green (12), and Blue (8).

新增精簡器計數至精簡搜尋網頁組件To add refiner counts to the Refinement Web Part

  1. 確認執行此程序的使用者帳戶為發佈網站集合上的 Designers SharePoint 群組成員。Verify that the user account that performs this procedure is a member of the Designers SharePoint group on the publishing site collection.

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

  3. 按一下 [網站設定] 頁面上的 [ Web Designer 圖庫] 區段中的 [主版頁面與版面配置]。On the Site Settings page, in the Web Designer Galleries section, click Master pages and page layouts.

  4. 在 [主版頁面圖庫] 頁面上,按一下 [顯示範本On the Master Page Gallery page, click Display Templates.

  5. 按一下 [顯示範本] 頁面的 [篩選]。On the Display Templates page, click Filters.

  6. 開啟 Filter_Default.html 檔案。Open the Filter_Default.html file.

  7. ShowCounts 的值變更為 trueChange the value for ShowCounts to true.

設定精簡搜尋網頁組件的顯示範本Configure the display templates for the Refinement Web Part

您可在主版頁面圖庫中,找到精簡搜尋網頁組件的顯示範本。The display templates for the Refinement Web Part can be found in the Master Page Gallery.

若要檢視精簡搜尋網頁組件的顯示範本To view display templates for the Refinement Web Part

  1. 確認執行此程序的使用者帳戶為發佈網站集合上的 Designers SharePoint 群組成員。Verify that the user account that performs this procedure is a member of the Designers SharePoint group on the publishing site collection.

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

  3. 按一下 [網站設定] 頁面上的 [ Web Designer 圖庫] 區段中的 [主版頁面與版面配置]。On the Site Settings page, in the Web Designer Galleries section, click Master pages and page layouts.

  4. 在 [主版頁面圖庫] 頁面上,按一下 [顯示範本On the Master Page Gallery page, click Display Templates.

  5. 按一下 [顯示範本] 頁面的 [篩選]。On the Display Templates page, click Filters.

如需如何自訂和建立您自己的顯示範本,請參閱SharePoint 2013 設計管理員顯示範本For information on how to customize and create your own display templates, see SharePoint 2013 Design Manager display templates.

新增分類精簡搜尋面板網頁組件至頁面Add a Taxonomy Refinement Panel Web Part to a page

開始此程序之前,請先確認下列事項:Before you begin this procedure, verify the following:

  1. 確認執行此程序的使用者帳戶為發佈網站集合上的 Designers SharePoint 群組成員。Verify that the user account that performs this procedure is a member of the Designers SharePoint group on the publishing site collection.

  2. 瀏覽至欲新增網頁組件的頁面。Browse to the page where you want to add the Web Part.

  3. 按一下 [設定] 功能表及 [編輯頁面]Click the Settings menu, and then click Edit Page.

  4. 在您要新增網頁組件網頁組件區域,按一下 [新增網頁組件In the Web Part Zone where you want to add the Web Part, click Add a Web Part.

  5. 在 [類別] 清單中,選取 [搜尋In the Categories list, select Search.

  6. 組件中,選取 [分類精簡搜尋面板] 和 [新增In the Parts, select Taxonomy Refinement Panel, and then click Add.

設定分類精簡搜尋面板網頁組件Configure the Taxonomy Refinement Panel Web Part

設定分類精簡搜尋面板網頁組件To configure the Taxonomy Refinement Panel Web Part

  1. 確認執行此程序的使用者帳戶為發佈網站集合上的 Designers SharePoint 群組成員。Verify that the user account that performs this procedure is a member of the Designers SharePoint group on the publishing site collection.

  2. 瀏覽至包含欲設定之分類精簡搜尋面板網頁組件的頁面。Browse to the page where you have the Taxonomy Refinement Panel Web Part that you want to configure.

  3. 在 [設定] 功能表上按一下 [編輯頁面]On the Settings menu, click Edit Page.

  4. 網頁組件中按一下分類精簡搜尋面板網頁組件功能表]箭頭,然後再按一下 [編輯網頁組件In the Web Part, click the Taxonomy Refinement Panel Web Part Menu arrow, and then click Edit Web Part.

  5. 在網頁組件] 工具窗格的 [屬性] 區段的 [查詢] 區段中,按一下 [精簡搜尋目標] 功能表中選取您想要建立分類精簡搜尋面板網頁組件與關聯的網頁組件。In the Web Part tool pane, in the Properties section, in the Query section, on the Refinement Target menu, select the Web Part you want to associate with the Taxonomy Refinement Panel Web Part.

  6. 在網頁組件] 工具窗格的 [屬性] 區段的 [查詢] 區段中,按一下 [精簡器] 功能表中選取已針對受管理導覽所指定的 managed 的屬性。In the Web Part tool pane, in the Properties section, in the Query section, on the Refiner menu, select the managed property that you have specified for Managed Navigation.

您可以使用建議的項目網頁組件以顯示內容如何使用者具有先前與之互動之網站的建議架構。例如,您可以將此網頁組件新增至目錄項目] 頁面上。如果使用者檢視特定的項目、 此網頁組件會顯示項目與其他使用者具有先前檢視,例如 「 檢視此項目的使用者也檢視這些項目 」。如需建議的詳細資訊,請參閱 < Plan search for SharePoint Server 2016 跨網站發佈網站中的 [規劃流量分析、 流量事件及建議You can use the Recommended Items Web Part to show content recommendations based how users have previously interacted with the site. For example, you can add this Web Part to a Catalog Item page. If a user views a specific item, this Web Part will display other items that users have previously viewed, such as "Users who viewed this item also viewed these items." For more information about recommendations, see Plan usage analytics, usage events and recommendations in Plan search for cross-site publishing sites in SharePoint Server 2016.

若要新增建議項目網頁組件至頁面To add a Recommended Items Web Part to a page

  1. 確認執行此程序的使用者帳戶為發佈網站集合上的 Designers SharePoint 群組成員。Verify that the user account that performs this procedure is a member of the Designers SharePoint group on the publishing site collection.

  2. 瀏覽至欲新增網頁組件的頁面。Browse to the page where you want to add the Web Part.

  3. 按一下 [設定] 功能表及 [編輯頁面]Click the Settings menu, and then click Edit Page.

  4. 在您要新增網頁組件網頁組件區域,按一下 [新增網頁組件In the Web Part Zone where you want to add the Web Part, click Add a Web Part.

  5. 在 [類別] 清單中,按一下 [搜尋導向內容In the Categories list, click Search-Driven Content.

  6. 在 [組件] 清單中,按一下 [建議項目,然後按一下 [新增]In the Parts list, click Recommended Items, and then click Add.

若要設定建議項目網頁組件的查詢To configure the query for a Recommended Items Web Part

  1. 確認執行此程序的使用者帳戶為發佈網站集合上的 Designers SharePoint 群組成員。Verify that the user account that performs this procedure is a member of the Designers SharePoint group on the publishing site collection.

  2. 瀏覽至包含欲設定之建議項目網頁組件的頁面。Browse to the page where you have the Recommended Items Web Part that you want to configure.

  3. 在 [設定] 功能表上按一下 [編輯頁面]On the Settings menu, click Edit Page.

  4. 網頁組件中按一下建議的項目網頁組件功能表]箭頭,然後再按一下 [編輯網頁組件In the Web Part, click the Recommended Items Web Part Menu arrow, and then click Edit Web Part.

  5. 在網頁組件] 工具窗格的 [屬性] 區段的 [搜尋準則] 區段中按一下 [變更查詢]。In the Web Part tool pane, in the Properties section, in the Search Criteria section, click Change query.

  6. 在 [基礎] 索引標籤上所選取下表所述的選項以定義查詢。On the BASICS tab, define your query by selecting options described in the following table.

取得針對性建議項目Get recommended items for
從下拉式清單中選取的值應顯示的建議。在目錄案例中,這通常是從 URL 的 token。如果您選取這個選項,您還必須選取您想要取得的建議的 URL token。From the drop-down list, select from which value recommendations should be displayed. In a catalog scenario, this will often be A token from a URL. If you select this option, you will also have to select which URL token you want to obtain recommendations for.
例如,假設您想要取得建議的目錄中的項目。您有其中顯示將目錄項目及項目數目是易記的 URL 部分的目錄項目頁面 — 例如 www.contoso/audio/mp3/4010101。(4010101 代表項目數目)。當您想要從 URL 取得權杖的建議時,您應該從第二個下拉式清單選取 {URLToken.1} (4010101)。For example, let's say that you want to obtain recommendations for items in your catalog. You have a catalog item page where you display your catalog items, and the item number is part of your friendly URL — for example, www.contoso/audio/mp3/4010101. (4010101 represents the item number.) When you want to obtain recommendations for a token from the URL, you should select {URLToken.1} (4010101) from the second drop-down list.
依據應用程式限制結果Restrict results by app
使用此下拉式清單,指定搜尋結果的範圍。Use this drop-down list to specify a scope for the search results.
依據內容類型限制結果Restrict results by content type
使用此下拉式清單,將搜尋結果限制在特定的內容類型。Use this drop-down list to limit the search results to a specific content type.
若建議項目太少If there are too few recommended items
如果您不需要太多流量資料 — 例如,如果您的網站是許多新或項目不需要顯示的建議 — 此網頁組件將不會顯示任何搜尋結果。為了讓網頁組件以顯示建議即使有算沒有足夠的使用者資料,您可以選取以選取要填入其他結果查詢選項。If you don't have much usage data — for example, if your site is fairly new, or if the items do not have recommendations to display — this Web Part will not display any search results. In order for the Web Part to display recommendations even though not enough user data has cumulated, you can select the option to Select a query to fill in with additional results.
  1. [精簡器] 索引標籤列出設為精簡器啟用的搜尋結構描述中的 managed 的屬性。您可以指定的搜尋結果中建議的項目搜尋網頁組件傳回應限制為一或多個值從精簡器。按一下清單中的精簡器,然後按一下 [套用] 將其新增至查詢。The REFINERS tab lists the managed properties that are set as refiner-enabled in the search schema. You can specify that the search results returned in the Recommended Items Search Web Part should be limited to one or more values from the refiners. Click a refiner in the list, and then click Apply to add it to the query.

    按一下 [顯示更多如果您想要定義分組的結果。[群組結果,您可以指定的結果應該分組根據一或多個 managed 屬性。Click Show more if you want to define grouping of results. Under Group results, you can specify that the results should be grouped based on one or more managed properties.

  2. 在 [設定] 索引標籤上指定下列項目:On the SETTINGS tab, specify the following:

查詢規則Query Rules 選取是否要使用查詢規則。Select whether to use Query Rules or not.
URL 重寫URL Rewriting 如果項目詳細資料] 頁面的 URL 重寫應繼續為相對的每個目錄項目所定義的目錄連線設定時,選取。如果您選取 [不要修正 Url,將目錄項目 Url 會指向直接連線的目錄的文件庫項目。Select if the URL rewrite to the item details page should continue to be relative for each catalog item as defined when you set up the catalog connection. If you select Don't rewrite URLs, the URLs for your catalog items are pointed directly to the library item of the connected catalog.
載入行為Loading Behavior 選取 [建議項目網頁組件所傳回的搜尋結果應該顯示在網頁上時。預設選項是的顯示的頁面與網頁協力廠商對同時。藉由使用此載入行為,從伺服器] 發出查詢和搜尋結果都包含在傳送回從 SharePoint Server 的頁面回應。如果您選取分別顯示的頁面和網頁組件,則查詢將會發出,從使用者瀏覽器之後收到 [完成] 頁面。此選項可能會被視為次要內容頁面上的 — 例如建議或常用項目Select when the search results returned by the Recommended Items Web Part should be displayed on the web page. The default option is Display the page and web party simultaneously. By using this loading behavior, queries are issued from the server, and the search results are included in the page response that is sent back from SharePoint Server. If you select Display the page and web part independently, the queries will be issued from the end-users browser after the complete page is received. This option may be considered for secondary content on a page — for example, Recommendations or Popular Items
優先順序Priority 選取最適合說明內容由相對於其他搜尋網頁組件此網頁組件顯示的相對重要性層級。如果 SharePoint 伺服器執行負載過重,將會根據其優先順序來執行查詢。Select the level that best describes the relative importance of content that is displayed by this Web Part in relation to other Search Web Parts. If SharePoint Server is running under heavy load, the queries will be run according to their priority.
快取Caching 如果您想要搜尋結果快取的使用者群組中,選取一個 Active Directory 安全性群組。透過快取安全性群組的搜尋結果,您可以減少頁面重新載入時間。 > [!NOTE]> 您應該只選取其中有相同的群組中的所有使用者的搜尋結果的安全性群組。如需詳細資訊,請參閱本文Select one Active Directory security group if you want search results to be cached for users in the group. By caching search results for a security group, you can reduce page reload time.> [!NOTE]> You should only select a security group where search results are identical for all users in the group. For more information, see this article.
  1. 在 [測試] 索引標籤上您可預覽建議項目網頁組件傳送出的查詢。On the TEST tab, you can preview the query that is sent by the Recommended Items Web Part.
查詢文字Query text
可顯示套用至查詢的查詢範本內容。Shows the content of the query template that is applied to the query.
Click **Show more** to display additional information. 
精簡依據Refined by
套用至查詢的精簡器] 索引標籤中所定義的方式來顯示。Shows the refiners applied to the query as defined in the REFINERS tab.
群組依據Grouped by
顯示的搜尋結果應依據 [精簡器] 索引標籤中所定義的 managed 的屬性。Shows the managed property on which search results should be grouped as defined in the REFINERS tab.
套用的查詢規則Applied query rules
顯示查詢套用了哪些查詢規則。Shows which query rules are applied to the query.
In the **Query template variables** section, the selections that you made on the BASIC tab are displayed. In addition, you can type additional values for testing as outlined in the following table. Click the **Test query** button to preview the search results. 
{RecsURL}*{RecsURL}*
指定要針對哪些值顯示建議時,可顯示所選取的 Token。Shows the token you selected when specifying for which value recommendations should be displayed.
{範圍}*{Scope}*
可顯示您針對搜尋結果所選取的範圍。Shows the scope that you selected for the search results.
{ContentTypeID}*{ContentTypeID}*
可顯示您針對搜尋結果所選取的內容類型。Shows the content type that you selected for the search results.
You can also test how the query works for different user segment terms. Click **Add user segment term for testing** to add terms to be added to the query. Click the **Test query** button to preview the search results. 
查詢文字Query text
可顯示建議項目網頁組件所執行的最終查詢。查詢文字會以將動態變數取代為目前值之原始查詢範本為依據,因此其他查詢變更就可能必須以查詢規則形式來進行。Shows the final query that will be run by the Recommended Items Web Part. It is based on the original query template where dynamic variables are substituted with current values. Other changes to the query may have be made as part of query rules.

建議項目網頁組件的預設控制項顯示範本為「清單」(亦即主版頁面圖庫中的 Control_List)。The default control display template for the Recommended Items Search Web Part is List (known as Control_List in the Master Page Gallery).

建議項目網頁組件的預設項目顯示範本為「建議項目:圖片在上方,3 行字」(亦即主版頁面圖庫中的 Item_RecommendationsClickLogging)。當使用者按一下建議項目網頁組件中顯示的連結時,預設顯示範本就會記錄下一則「已按下建議」使用事件。The default item display template for the Recommended Items Web Part is Recommended Items: Picture on top, 3 lines (known as Item_RecommendationsClickLogging in the Master Page Gallery). When a user clicks a link that is displayed in the Recommended Items Web Part, the default display template logs a Recommendations Clicked usage event.

如需如何自訂和建立您自己的顯示範本,請參閱SharePoint 2013 設計管理員顯示範本。如需自訂顯示範本時,您可以使用的 JavaScript 方法的資訊,請參閱Srch.U 物件 (DisplayTemplatesSrch)For information on how to customize and create your own display templates, see SharePoint 2013 Design Manager display templates. For information about JavaScript methods that you can use when you customize your display templates, see Srch.U object (DisplayTemplatesSrch).

另請參閱See also

概念Concepts

Query variables in SharePoint ServerQuery variables in SharePoint Server

其他資源Other Resources

一系列部落格: 如何設定 SharePoint Server 2013 中以產品為中心網站Blog series: How to set up a product-centric website in SharePoint Server 2013