在 SharePoint Server 中配置精简 Web 部件的属性

适用于:yes-img-132013 yes-img-162016 yes-img-192019 yes-img-seSubscription Edition no-img-sopSharePoint in Microsoft 365

默认情况下,精简 Web 部件用于所有搜索纵向页面(results.aspx、peopleresults.aspx、conversationresults.aspx、videoresults.aspx)。 Web 部件筛选搜索结果 Web 部件中的结果并对其进行分类,以帮助用户缩小搜索结果范围以查找他们需要的内容。 通过更改精简 Web 部件中的属性,可以执行以下操作:

  • 指定要从中筛选搜索结果的不同搜索结果 Web 部件。

  • 指定要在 Web 部件中显示哪些精简条件。

  • 更改应用于每个精简条件的显示模板。

在开始这些过程之前,请确认以下各项:

  • The managed properties that you want to use as refiners are set to refinable and queryable in the search schema. You can verify or change this by viewing or editing the Main characteristics of the managed property as described in To add a managed property.

  • 您已按照 Start, pause, resume, or stop a crawl in SharePoint Server中所述,完成包含作为精简条件启用的托管属性的内容源的完全爬网。

配置精简 Web 部件的属性

配置精简 Web 部件的属性

  1. 确认执行此过程的用户帐户是企业搜索中心网站上 SharePoint 组“Designers”的成员。

  2. 浏览到包含您要配置的精简 Web 部件的页面。

  3. 单击“设置”菜单,然后单击“编辑页面”

  4. 在 Web 部件中,单击“精简 Web 部件菜单”箭头,然后单击“编辑 Web 部件”

  5. In the Web Part tool pane, in the Refinement Target section, select the Web Part from which from which to filter search results. By default, the Search Results Web Part is selected.

  6. 在 Web 部件工具窗格中,确认“在此 Web 部件中选择精简条件”处于选中状态。

  7. 单击“选择精简条件”。

  8. On the Refinement configuration page, from the Available refiners section, use the buttons to select which refiners should be shown in the Web Part, and also in what order that they should be shown. If you have specified an Alias for a refinable managed property, this alias is shown in the Configuration for section.

  9. 在“配置”部分,配置每个精简程序的显示方式。

    注意

    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.

更改精简程序的显示名称

默认情况下,作为精简程序启用的托管属性名称将用作精简程序的显示名称。 在许多情况下,托管属性名称不具备用户友好性 — 例如,RefinableString00 或 ColorOWSTEXT。 您可以通过更改母版页样式库的 Java 脚本文件来更改精简程序的显示名称。

更改精简程序的显示名称

  1. 确认执行此过程的用户帐户是企业搜索中心网站上 SharePoint 组“Designers”的成员。

  2. 在“设置”菜单上,单击“网站设置”

  3. 在"网站设置"页上,在"Web 设计器库"部分,单击"母版页和页面布局"。

  4. 在"母版页样式库"页上,单击"显示模板"。

  5. 在“显示模板”页上,单击“语言文件”

  6. 在“语言文件”页上,单击包含你要为其更改精简程序显示名称的语言的文件夹。

  7. 打开“CustomStrings.js”文件。

  8. 您可以使用以下语法,将一行添加到为其更改显示名称的作为精简程序启用的每个托管属性的文件中:

    "rf_RefinementTitle_ManagedPropertyName": "Sample Refinement Title for ManagedPropertyName"

    例如,您可以添加以下行以将托管属性 RefinableInt00 的显示名称更改为 Price:

    "rf_RefinementTitle_RefinableInt00": "Price".

将精简条件计数添加到精简 Web 部件

默认情况下,精简条件 Web 部件不显示精简条件计数 — 即每个精简程序值的项的数目。 例如,如果您已启用托管属性"颜色"作为精简程序,精简程序值将仅显示"颜色",如红色、绿色和蓝色。 您可以通过更改 HTML 文件中的值来添加精简条件计数,以便精简程序值显示为红色 (10)、绿色 (12) 和蓝色 (8)。

将精简条件计数添加到精简 Web 部件

  1. 确认执行此过程的用户帐户是企业搜索中心网站上 SharePoint 组“Designers”的成员。

  2. 在“设置”菜单上,单击“网站设置”

  3. 在"网站设置"页上,在"Web 设计器库"部分,单击"母版页和页面布局"。

  4. 在"母版页样式库"页上,单击"显示模板"。

  5. 在"显示模板"页上,单击"筛选器"。

  6. 打开"Filter_Default.html"文件。

  7. 将“ShowCounts”的值更改为“true”

  8. 保存该文件。