管理查询规则Manage query rules

在 Microsoft 365 中作为全局或 SharePoint 管理员,可以通过创建和管理查询规则来改进经典搜索体验中的搜索结果。As a global or SharePoint admin in Microsoft 365, you can improve search results in the classic search experience by creating and managing query rules. 查询规则可帮助搜索响应用户的意图。Query rules help searches respond to the intent of users.

在查询规则中,指定条件和相关操作。In a query rule, you specify conditions and associated actions. 当查询满足查询规则中的条件时,搜索系统将执行规则中指定的操作,以提高搜索结果的相关性。When a query meets the conditions in a query rule, the search system performs the actions specified in the rule to improve the relevance of the search results. 这可能是由于缩小结果或更改结果的显示顺序而引起的。This could be by narrowing results or changing the order in which results are displayed. 例如,查询规则条件可能是查询中的某个术语与 SharePoint 术语集中的某个特定术语相匹配,也可能是对搜索系统中的某个特定结果源(如视频)经常执行某个查询。For example, a query rule condition could be that a term in a query matches a particular term in a SharePoint term set, or that a query is frequently performed on a particular result source in a search system, such as videos. 满足查询规则条件时,相关联的操作可能是在搜索结果的顶部显示特定项目。When the query rule condition is met, an associated action could be to show a specific item at the top of the search results. 假设您有一个 intranet 网站,其中所有公司事件都在库中进行维护,并且您想要促进第一次研讨会。Say you have an intranet site where all company events are maintained in a library, and you want to promote a first-aid seminar. 为此,您创建了一个推动急救研讨会在某人搜索“seminar”或“event”时显示在搜索结果顶部的查询规则。To do this, you create a query rule that boosts the first-aid seminar to the top of the search results when someone searches for "seminar" or "event."

查询规则可以指定以下三种类型的操作:A query rule can specify the following three types of actions:

  • 将搜索结果升级为显示在排名结果上方。Promote a search result to appear above ranked results. 例如,对于查询 "病假",查询规则可以指定特定的结果,如指向具有 "休息时间" 的公司策略声明的网站的链接。For example, for the query "sick leave", a query rule could specify a particular result, such as a link to a site that has a statement of company policy regarding time off work.
  • 添加一个或多个搜索结果组(称为 "结果块")。Add one or more groups of search results, called result blocks. 例如,对于包含“Fabrikam 销售报表”的查询,查询规则可能会使用分类字典将“Fabrikam”识别为客户,再显示一个结果块,其中包含客户关系管理 (CRM) 系统中与 Fabrikam 相关的结果。For example, for a query that contains “Fabrikam sales report”, a query rule might use a taxonomy dictionary to recognize “Fabrikam” as a customer, and then display a result block with pertinent results about Fabrikam from your customer relationship management (CRM) system.
  • 更改搜索结果的排名。Change the ranking of search results. 例如,对于包含 "下载工具箱" 的查询,查询规则可以将 "下载" 一词识别为 action 术语,并提高指向 intranet 上的特定下载网站的搜索结果。For example, for a query that contains “download toolbox”, a query rule could recognize the word “download” as an action term and boost search results that point to a particular download site on your intranet.

您可以在不同的级别创建查询规则:针对整个租户、网站集或网站。You can create query rules at different levels: for the whole tenant, for a site collection, or for a site. 在租户级别创建查询规则时,可以在所有网站集中使用查询规则。When you create query rules at tenant level, the query rules can be used in all site collections. 在网站集级别创建查询规则时,可以在网站集中的所有网站上使用这些规则。When you create query rules at site collection level, the rules can be used on all sites in the site collection. 在网站级别创建查询规则时,只能在该网站上使用这些规则。When you create query rules at site level, the rules can only be used on that site.

您可以为一个或多个结果源配置查询规则,并且可以指定查询规则处于活动状态的时间段。You can configure query rules for one or more result sources, and you can specify a time period for when the query rule is active.

SharePoint 同时具备经典和新式搜索体验。SharePoint has both a classic and a modern search experience. 仅在搜索结果顶部提升单个结果并为默认结果源定义的查询规则可能影响新式搜索体验。Only query rules that promote an individual result towards the top of search results and that are defined for the default result source can affect the modern search experience. 当用户在所有 SharePoint 中进行搜索时,用户可能会在搜索结果页面上的 " 全部 " 选项卡上看到此类已升级结果。Users might see such promoted results on the All tab on the search results page when they search across all of SharePoint. 了解有关 SharePoint 中的经典和新式搜索体验之间的差异的详细信息Learn more about the differences between the classic and modern search experiences in SharePoint.

提升搜索结果Promote a search result

You can add several individual promoted results.You can add several individual promoted results. When there is more than one promoted result, you can specify the relative ranking.When there is more than one promoted result, you can specify the relative ranking.

  1. 转到租户、网站集或网站的 " 管理查询规则 " 页:Go to the Manage Query Rules page for the tenant, for a site collection, or a site:
  • 对于租户,在新 SharePoint 管理中心中,选择 " 更多功能"。For a tenant, in the new SharePoint admin center, select More features. 在 " 搜索" 下,选择 " 打开",然后在 "搜索管理" 页上,选择 " 管理查询规则"。Under Search, select Open, and then on the search administration page, select Manage Query Rules.

  • 对于网站集,在网站集中,选择 " 设置  设置" 图标。 ,然后选择 " 网站设置"。For a site collection, in your site collection, select Settings Settings icon., and then select Site settings. 如果看不到 " 网站设置",请选择 " 网站信息",然后选择 " 查看所有网站设置"。If you don't see Site settings, select Site information, and then select View all site settings. 在 " 网站集管理" 下,选择 " 搜索查询规则"。Under Site Collection Administration, select Search Query Rules.

  • 对于 "网站",选择 " 设置  设置 " 图标。,然后选择 " 网站设置"。For a site, select Settings Settings icon., and then select Site settings. 如果看不到 " 网站设置",请选择 " 网站信息",然后选择 " 查看所有网站设置"。If you don't see Site settings, select Site information, and then select View all site settings. 在 " 搜索" 下,选择 " 查询规则"。Under Search, select Query Rules.

  1. 在 " 管理查询规则 " 页上的 " 选择结果源 " 列表中,选择新查询规则的结果源。On the Manage Query Rules page, in the Select a Result Source list, select a result source for the new query rule.

  2. 选择“新建查询规则”****。Select New Query Rule.

  3. 在“添加查询规则”**** 页的“常规信息”**** 部分的“规则名称”**** 字段中,键入查询规则的名称。On the Add Query Rule page, in the General Information section, in the Rule name field, type the name for the query rule.

  4. 选择以展开 " 上下文 " 部分。Select to expand the Context section.

  5. 在 " 上下文 " 部分中,执行下列操作之一:In the Context section, do one of the following:

  • 若要将查询规则应用于所有结果源,请选择“所有源”****。To apply the query rule to all result sources, select All sources.

  • 若要将查询规则应用于一个或多个特定结果源,请选择“这些源之一”****。To apply the query rule to one or more specific result sources, select One of these sources. 默认情况下,选择您之前指定的结果源。By default, the result source that you specified earlier is selected. 若要向查询规则中添加结果源,请选择 " 添加源",在对话框中选择一个结果源,然后选择 " 保存"。To add a result source to the query rule, select Add Source, select a result source in the dialog, and then select Save.

  1. 若要将查询规则限制为类别(例如,仅当查询中包含托管导航术语集中的某个术语时才会触发查询规则),请执行以下操作:To restrict the query rule to categories—for example, that a query rule should fire only when a term from your managed navigation term set is included in the query, do as follows:
  • 若要将查询规则限制为一个类别,请选择 " 添加类别"。To restrict the query rule to a category, select Add category. 在 " 从术语库导入 " 对话框中,选择一个术语,当您将其包含在查询中时,将导致查询规则触发,然后选择 " 保存"。In the Import from term store dialog, select a term which, when you include it in a query, will cause the query rule to fire, and then select Save.

  • 若要将查询规则限制为用户区段,请选择 " 添加用户区段"。To restrict the query rule to a user segment, select Add User Segment. 在对话框中的 " 标题 " 字段中,键入此规则的名称,然后选择 " 添加用户区段术语"。In the dialog, in the Title field, type the name for this rule, and then select Add user segment term. 在 " 从术语库导入 " 对话框中,选择一个术语,表示在查询中出现时将导致查询规则触发的用户区段。In the Import from term store dialog, select a term that represents a user segment that will cause the query rule to fire when it appears in a query. 选择“保存Select Save

  1. 在 " 查询条件 " 部分中,执行下列操作之一:In the Query Conditions section, do one of the following:
  • 选择触发查询规则的条件概述中列出的条件之一。Select one of the conditions listed in Overview of conditions that make a query rule fire.

    备注

    当 any 条件为 true 时,将触发规则。The rule fires when any condition is true.

    若要添加更多条件,请选择 "添加替代条件"To add more conditions, select Add Alternate Condition

  • 选择 " 删除条件 " 可配置此查询规则,以对用户在创建规则的级别键入的每个查询触发,然后转到下一步。Select Remove Condition to configure this query rule to fire for every query that users type at the level at which you are creating the rule, and then go to the next step. 例如,如果您要为网站集创建此规则,请选择 " 删除条件 " (如果希望用户在网站集的任何搜索框中键入的每个查询都触发此规则)。For example, if you are creating this rule for a site collection, select Remove Condition if you want this rule to fire for every query that users type inside any search box in the site collection.

  1. 在“操作”**** 部分,指定要在查询规则触发时执行的操作。In the Actions section, specify the action to take when the query rule fires. 请指定以下任一操作:Specify one of the following:
  • 若要提升各个结果,使其显示在搜索结果的顶部,请选择 "在 SharePoint 2010 产品中 添加已升级的结果 (这称为最佳匹配") "。To promote individual results so that they appear towards the top of search results, select Add Promoted Result (in SharePoint 2010 Products this was called Best Bets). 在对话框中的 " 标题 " 字段中,键入要为此升级结果提供的名称。In the dialog, in the Title field, type the name that you want to give this promoted result. 在“URL”**** 字段中,键入应升级的结果的 URL。In the URL field, type the URL of the result that should be promoted. 选择 "将 URL 呈现为横幅,而不是作为超链接"Choose Render the URL as a banner instead of as a hyperlink. 选择“保存”。Select Save.

    You can add several individual promoted results.You can add several individual promoted results. 如果有多个提升的结果,则指定相对排名。When there's more than one promoted result, specify the relative ranking.

  • 若要升级一组搜索结果,请选择 " 添加结果块"。To promote a group of search results, select Add Result Block. 有关详细信息,请参阅 创建和显示结果块 ,再向下一点。For more information, see Create and display a result block a bit further down.

  • 若要更改排名搜索结果,请选择 "通过更改查询更改排名结果"To change ranked search results, select Change ranked results by changing the query. 有关详细信息,请参阅 更改排名的搜索结果,方法 是将查询再向下更改一位。For more information, see Change ranked search results by changing the query a bit further down.

  1. 若要使查询规则在特定时间段内处于活动状态,请选择 " 发布",然后指定时间段。To make the query rule active during a particular time period, select Publishing, and then specify the period.

  2. 选择“保存”。Select Save.

创建并显示结果块Create and display a result block

结果块包含在某个方面与查询相关的一小部分结果。A result block contains a small subset of results that are related to a query in a particular way. 与单个结果一样,您可以升级结果块,并将其与其他搜索结果一起排名。Like individual results, you can promote a result block or rank it with other search results.

为结果块配置查询条件时,使用 查询变量When you configure a query condition for a result block, you use query variables. 在指定查询时,查询变量类似于您尚不知道的值的占位符。Query variables are like placeholders for values that you don't yet know, when you specify the query. 但是,当查询运行时,此信息可用,系统会使用它将查询发送到索引。However, when the query's run, this information is available and the system uses it to send the query to the index. 例如,{User.Name} 代表键入查询的用户的显示名称。For example, {User.Name} stands for the display name of the user who typed in the query. 另一个 {searchBoxQuery},它代表用户在搜索框中键入的查询。Another one's {searchBoxQuery}, which stands for the query a user typed in a search box. 当您使用查询生成器配置查询时,将显示查询变量的列表。When you use the Query Builder to configure the query, a list of query variables is shown. (请参阅下面的过程中的步骤3。 ) (See step 3 in the procedure right below.)

  1. 在过程 创建查询规则的步骤9中,在 " 添加查询规则 " 页上的 " 操作 " 部分,单击 " 添加结果块"。In step 9 of the procedure Create a query rule, on the Add Query Rule page, in the Actions section, click Add Result Block.

  2. Enter the title that shall appear in the result block in the Title field in the Block Title section.Enter the title that shall appear in the result block in the Title field in the Block Title section.

  3. Configure the query that gives results for the block.Configure the query that gives results for the block. 在 " 查询 " 部分,单击 " 启动查询生成器 ",并在 " 基本 " 选项卡上执行以下操作:In the Query section, click Launch Query Builder and on the BASICS tab do the following:

  • 从 " 选择查询 " 部分的下拉列表中选择一个结果源,选择要搜索的内容。Select which content to search by selecting a result source from the drop-down list in the Select a query section

  • 指定您的查询。Specify your query. 有关可用查询变量的列表,请参阅 SharePoint Server 2013 中的查询变量See Query variables in SharePoint Server 2013 for a list of available query variables. 您可以从 "关键字筛选器" 下拉列表中选择预定义的查询变量,然后通过单击 "添加关键字筛选器" 将它们添加到 "查询" 文本框中。You can select pre-defined query variables from the Keyword filter drop-down list, and then add them to the Query text box by clicking Add keyword filter

  • 如果适用,使用属性筛选器来查询搜索架构中设置为可查询的托管属性的内容。你可以从“属性筛选器”下拉列表中选择托管属性。单击“添加属性筛选器”,将筛选器添加到查询中。********If relevant, use property filters to query the content of managed properties that are set to queryable in the search schema. You can select managed properties from the Property filter drop-down list. Click Add property filter to add the filter to the query.

    备注

    自定义托管属性不会显示在 属性筛选器 列表中。Custom managed properties are not shown in the Property filter list. 若要向查询中添加自定义托管属性,请在 " 查询" 文本框 中,输入自定义托管属性的名称,后跟查询条件,例如 MyCustomColorProperty:绿色To add a custom managed property to your query, in the Query text box, enter the name of your custom managed property followed by the query condition, for example MyCustomColorProperty:Green

  1. Specify how the search results within your result block should be sorted.Specify how the search results within your result block should be sorted. 搜索结果排序需区分大小写。Sorting of search results is case sensitive. 在 " 排序 " 选项卡上的 " 排序依据" 下拉列表中,选择一个托管属性,然后选择 " 降序 " 或 " 升序"。On the SORTING tab, in the Sort by drop-down list, select a managed property, and then select Descending or Ascending. The list only contains managed properties that are set as sortable in the search schema.The list only contains managed properties that are set as sortable in the search schema. You can also sort by rank.You can also sort by rank. 若要添加多个排序级别,请单击"添加排序级别"。To add more sorting levels, click Add sort level.

  2. 如果选择按排名进行排序,可以根据需要执行下列操作:If you chose to sort by rank, you can optionally:

  • 选择要用于对搜索结果进行排名的模型(可选)。使用“排名模型”下拉列表。****Select which model to use for ranking search results (this selection is optional). Use the Ranking Model drop-down list.

  • 定义动态更改结果排序的规则。在“动态排序”部分,从下拉列表中选择条件,再指定是提升还是降级结果,从而定义何时更改排名。若要添加更多规则,请单击“添加动态排序规则”****************Define rules for dynamically changing the ordering of results. In the Dynamic ordering section, define when to change ranking by selecting a condition from the drop-down list and then specifying whether to promote or demote the result. To add more rules, click Add dynamic ordering rules

  1. 在“测试”选项卡上,预览“内容搜索 Web 部件”将运行的最终查询。此预览是基于动态变量由当前值替换的原始查询模板进行的。对查询的其他更改可能必须通过查询规则执行。单击“显示更多”,以查看详细信息。********Preview the final query that will be run by the Content Search Web Part, on the TEST tab. The preview 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.
  • 查询文本显示内容搜索 Web 部件将运行的最终查询。The Query text shows the final query that'll be run by the Content Search Web Part. 它基于原始查询模板,其中动态变量将替换为当前值。It's based on the original query template where dynamic variables are replaced with current values. 您可能最终会将对查询所做的其他更改作为查询规则的一部分进行更改。You might end up making other changes to the query as part of query rules.

  • “查询模板”框显示应用于查询的查询模板的内容。****The Query template box shows the content of the query template that is 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.

  1. 单击 "确定" 以关闭 " 生成查询 " 对话框。Click OK to close the build your query dialog.

  2. Define which result source this result block should be applied to.Define which result source this result block should be applied to. 使用 "查询" 部分中的 "搜索此源" 下拉列表Use the Search this Source drop-down list in the Query section

  3. 在 " 项目 " 下拉列表中,选择要在结果块中显示的结果数。In the Items drop-down list, select how many results to show in the result block.

  4. 单击展开“设置”**** 部分。Click to expand the Settings section.

    结果块仅显示您在上一步中指定的搜索结果的数量。The result block only displays the number of search results that you specified in the previous step. 但是,您可以在结果块底部添加 " 显示更多 " 链接,以显示结果块的所有搜索结果。However, you can add a Show more link at the bottom of the result block that'll show all search results for the result block. 若要添加 " 显示更多 " 链接,请选择 "更多" 链接转到以下 url,然后键入 URL。To add a Show more link, select "More" link goes to the following URL, and then type a URL. 您可以在此 URL 中使用查询变量,例如 http://www 。 <site>/search/results.aspx? k = {subjectTerms}You can use query variables in this URL—for example, http://www.<site>/search/results.aspx?k={subjectTerms}.

  5. 单击“确定”****。Click OK.

通过更改查询更改排名搜索结果Change ranked search results by changing the query

排名模型将计算搜索结果的排序顺序。The ranking model calculates a ranking order of search results. 您可通过升级或降级搜索结果中的项来更改此排名。You can change this ranking by promoting or demoting items within the search results. 例如,对于包含 "下载工具箱" 的查询,您可以创建一个查询规则,将 "下载" 一词识别为操作术语。For example, for a query that contains "download toolbox", you can create a query rule that recognizes the word "download" as an action term. 完成此操作后,您可以更改排名搜索结果,这将提升 intranet 上特定下载网站的 URL。Once you've done this, you can change the ranked search results and this will promote the URL of a specific download site on your intranet.

您还可以根据多个变量(如文件扩展名或特定关键字)动态更改搜索结果的排序顺序。You can also dynamically change the sorting order of the search results, based on several variables such as file name extension or specific keywords. 通过更改查询更改排名搜索结果时,您将看到您的结果是安全修整和可精简。When you change ranked search results by changing the query, you'll see that your results are security trimmed and refinable. 此外,如果文档不再存在,则不会显示搜索结果。Moreover, the search results don't show up if the document's no longer there.

  1. 在过程 创建查询规则的步骤9中,在 " 添加查询规则 " 页上的 " 操作 " 部分,单击 " 通过更改查询更改排名结果"。In step 9 of the procedure Create a query rule, on the Add Query Rule page, in the Actions section, click Change ranked results by changing the query. 将显示 " 生成查询 " 对话框The build your query dialog appears

  2. 在 " 基本 " 选项卡上,执行以下操作:On the BASICS tab, do the following:

  • 从 " 选择查询 " 部分的下拉列表中选择一个结果源,选择要搜索的内容。Select which content to search by selecting a result source from the drop-down list in the Select a query section

  • 指定您的查询。Specify your query. 有关可用查询变量的列表,请参阅 SharePoint Server 2013 中的查询变量See Query variables in SharePoint Server 2013 for a list of available query variables. 您可以从 "关键字筛选器" 下拉列表中选择预定义的查询变量,然后通过单击 "添加关键字筛选器" 将它们添加到 "查询" 文本框中。You can select pre-defined query variables from the Keyword filter drop-down list, and then add them to the Query text box by clicking Add keyword filter

  • 如果适用,使用属性筛选器来查询搜索架构中设置为可查询的托管属性的内容。你可以从“属性筛选器”下拉列表中选择托管属性。单击“添加属性筛选器”,将筛选器添加到查询中。********If relevant, use property filters to query the content of managed properties that are set to queryable in the search schema. You can select managed properties from the Property filter drop-down list. Click Add property filter to add the filter to the query.

  1. Specify how the search results within your result block should be sorted.Specify how the search results within your result block should be sorted. 搜索结果排序需区分大小写。Sorting of search results is case sensitive. 在 " 排序 " 选项卡上的 " 排序依据" 下拉列表中,选择一个托管属性,然后选择 " 降序 " 或 " 升序"。On the SORTING tab, in the Sort by drop-down list, select a managed property, and then select Descending or Ascending. The list only contains managed properties that are set as sortable in the search schema.The list only contains managed properties that are set as sortable in the search schema. You can also sort by rank.You can also sort by rank. 若要添加多个排序级别,请单击"添加排序级别"。To add more sorting levels, click Add sort level.

  2. 如果选择按排名进行排序,可以根据需要执行下列操作:If you chose to sort by rank, you can optionally:

  • 选择要用于对搜索结果进行排名的模型(可选)。使用“排名模型”下拉列表。****Select which model to use for ranking search results (this selection is optional). Use the Ranking Model drop-down list.

  • 定义动态更改结果排序的规则。在“动态排序”部分,从下拉列表中选择条件,再指定是提升还是降级结果,从而定义何时更改排名。若要添加更多规则,请单击“添加动态排序规则”****************Define rules for dynamically changing the ordering of results. In the Dynamic ordering section, define when to change ranking by selecting a condition from the drop-down list and then specifying whether to promote or demote the result. To add more rules, click Add dynamic ordering rules

  1. 在“测试”选项卡上,预览“内容搜索 Web 部件”将运行的最终查询。此预览是基于动态变量由当前值替换的原始查询模板进行的。对查询的其他更改可能必须通过查询规则执行。单击“显示更多”,以查看详细信息。********Preview the final query that will be run by the Content Search Web Part, on the TEST tab. The preview 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.
  • 查询文本显示内容搜索 Web 部件将运行的最终查询。The Query text shows the final query that'll be run by the Content Search Web Part. 它基于原始查询模板,其中动态变量将替换为当前值。It's based on the original query template where dynamic variables are replaced with current values. 您可能最终会将对查询所做的其他更改作为查询规则的一部分进行更改。You might end up making other changes to the query as part of query rules.

  • “查询模板”框显示应用于查询的查询模板的内容。****The Query template box shows the content of the query template that is 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.

  1. 单击 "确定" 以关闭 " 生成查询 " 对话框。Click OK to close the Build Your Query dialog.

  2. 单击“保存”。Click Save.

使查询规则在网站上是非活动的Make a query rule inactive on a site

在租户级别创建的查询规则由网站集和网站继承。Query rules that are created at the tenant level are inherited by site collections and sites. 同样,在网站集级别创建的查询规则将由网站集中的网站继承。Similarly, query rules that are created at the site collection level are inherited by sites in the site collection. 如果不希望将查询规则应用于继承它的网站,可以使查询规则对该网站不活动。If you don't want a query rule to apply to a site that inherits it, you can make the query rule inactive for the site.

  1. 在您的网站上,选择 " 设置  设置" 图标。 ,然后选择 " 网站设置"。On your site, select Settings Settings icon., and then select Site settings. 如果看不到 " 网站设置",请选择 " 网站信息",然后选择 " 查看所有网站设置"。If you don't see Site settings, select Site information, and then select View all site settings.

  2. 在"网站设置"页的"搜索"部分,单击"查询规则"。On the Site Settings page, in the Search section, click Query Rules.

  3. 在"管理查询规则"页的"选择结果源"菜单上,选择包含要将其设置为非活动的查询规则的结果源。On the Manage Query Rules page, on the Select a Result Source menu, select the result source that contains the query rule that you want to make inactive.

  4. 在"名称"列中,指向要将其设置为非活动的查询规则,单击出现的箭头,然后单击"设为非活动"。In the Name column, point to the query rule that you want to make inactive, click the arrow that appears, and then click Make Inactive.

对网站集的查询规则排名Rank query rules for a site collection

当租户、网站集或网站的多个查询规则处于活动状态时,可以为在该级别执行的查询触发多个规则。When multiple query rules are active for a tenant, a site collection, or a site, more than one rule can fire for a query that is performed at that level. 默认情况下,不会按给定顺序触发规则。By default, the rules don't fire in a given order. 但是,如果要控制规则的触发顺序,则必须将您创建的查询规则添加到查询组中。However, if you want to control the order in which the rules fire, you have to add the query rules that you create to query groups. 若要执行此操作,请选择要添加到组中的规则,然后指定组中的规则在被触发时将触发的顺序。To do this, you select rules to add to a group, and then you specify the order in which the rules in the group will fire if they're triggered. 您还可以阻止对组中最低级别的查询规则进行触发,即使它们确实被触发。You can also prevent query rules that rank lowest in a group from firing even if they do get triggered.

  1. 在网站集中,选择 " 设置  设置" 图标。 ,然后选择 " 网站设置"。In the site collection, select Settings Settings icon., and then select Site settings. 如果看不到 " 网站设置",请选择 " 网站信息",然后选择 " 查看所有网站设置"。If you don't see Site settings, select Site information, and then select View all site settings.

  2. 在"网站设置"页的"网站集管理"部分,单击"搜索查询规则"。On the Site Settings page, in the Site Collection Administration section, click Search Query Rules.

  3. 在"管理查询规则"页的"选择结果源"菜单上,选择包含要将其分组的查询规则的结果源。On the Manage Query Rules page, on the Select a Result Source menu, select the result source that contains the query rules that you want to group.

  4. 对于创建的要添加到某个组中的所有查询规则,请指向相应规则,然后选中复选框。For each query rule that you created that you want to add to a group, point to the rule and select the check box.

    备注

    为此网站集创建的查询规则将列出在"已针对此网站集定义"部分。Query rules that you created for this site collection are listed in the Defined for this site collection section.

  5. 单击"对选定的规则进行排序"。Click Order Selected Rules.

  6. 在 " 选择的规则顺序 " 对话框中,执行下列操作之一,然后单击 "确定"In the Order Selected Rules dialog, do either of the following, and then click OK:

  • 选中"将规则移动到具有此名称的新组",然后键入该组的名称。Select Move rules to new group with this name, and then type a name for the group.

  • 选择 " 将规则移动到现有组 ",然后在列表中选择一个组。Select Move rules to existing group and select a group in the list.

  1. 在 " 管理查询规则 " 页上:On the Manage Query Rules page:
  • 若要更改在组中的规则触发时将触发该规则的顺序,请更改该规则的编号顺序。To change the order in which a rule in a group will fire if it's triggered, change the number ordering of the rule.

  • 若要防止触发组中最低级别的查询规则,请转到应最后触发的组的查询规则对应的行,然后在 " 操作 " 列中的 " 继续/停止 " 列表中,选择 " 停止"。To prevent query rules that are ranked lowest in the group from firing, go to the row for the group's query rule that should fire last, and then in the Actions column, in the Continue/Stop list, select Stop.

触发查询规则的条件概述Overview of conditions that make a query rule fire

查询条件Query condition 说明Description 配置Configuration 示例Example
查询完全匹配关键字Query Matches Keyword Exactly
当查询与您指定的词或短语完全匹配时,将触发查询规则。The query rule fires when a query exactly matches a word or phrase that you specify.
在"查询中包含这些短语之一"文本框中,键入一个或多个短语(用逗号分隔)。In the Query exactly matches one of these phrases text box, type one or more phrases separated by semicolons.
键入 "picture;pic "在框中。Type "picture; pic" in the box. 当用户在搜索框中键入 "picture" 或 "pic" 时,将触发查询规则。The query rule fires when a user types "picture" or "pic" in a search box. 如果用户键入 "图片" 或 "sunny 图片",则不会触发该规则。The rule doesn't fire if a user types "pictures" or "sunny picture."
查询包含操作术语Query Contains Action Term
当查询包含用户要执行的操作的术语时,将触发查询规则。The query rule fires when a query contains a term for something that the user wants to do. 该术语必须位于查询的开头或末尾。The term must be at the beginning or end of the query.
通过执行下列操作之一,输入导致查询规则触发的操作术语:Enter the action term that causes the query rule to fire by doing one of the following:
选择“操作术语是这些短语之一”****,然后键入一个或多个短语。Select Action term is one of these phrases, and type one or more phrases.
选择 " 操作术语" 是此字典中的一个条目,然后单击 " 从术语库导入"。Select Action term is an entry in this dictionary, and then click Import from term store. 在对话框中,从术语集中选择一个术语,然后单击 " 保存"。In the dialog, select a term from a term set, and then click Save.
在 " 操作术语 " 框中键入 "下载" 一词,其中是 "短语" 框中的一个。Type the word "download" in the Action term is one of these phrases box. 当用户在搜索框中键入 "下载 Contoso 电子数据表" 时,用户很可能不会搜索包含 "下载"、"Contoso"、"电子产品" 和 "数据表" 这一词的文档。When a user types "download Contoso Electronics datasheet" in a search box, there are chances the user isn't searching for a document that contains the words "download," "Contoso," "Electronics," and "datasheet." 相反,用户很可能想要下载 Contoso 电子数据表。Instead, the user most likely wants to download a Contoso Electronics datasheet. 查询规则将触发,并且仅将单词 "Contoso"、"电子产品" 和 "数据表" 发送到搜索索引。The query rule fires, and only the words "Contoso," "Electronics," and "datasheet" are sent to the search index.
查询完全匹配词典Query Matches Dictionary Exactly
当查询与字典条目完全匹配时,将触发查询规则。The query rule fires when the query is an exact match of a dictionary entry.
查询中完全匹配 "此词典中的条目 " 列表中,选择一个词典。From the Query exactly matches an entry in this dictionary list, select a dictionary. 若要指定不同的词典,请单击 " 从术语库导入",从对话框中的术语集中选择一个术语,然后单击 " 保存"。To specify a different dictionary, click Import from term store, select a term from a term set in the dialog, and then click Save.
用户在搜索框中键入的一个词完全匹配 "预配置 人员姓名 " 字典中的条目。A word that a user types in a search box perfectly matches an entry in the preconfigured People Names dictionary.
查询在源中更常见Query More Common in Source
如果用户经常从另一个已指定的源发送此查询,则会触发查询规则。The query rule fires if users frequently sent this query from another source that you have already specified.
在 " 此源中更有可能使用的查询 " 列表中,选择一个结果源。In the Query is more likely to be used in this source list, select a result source.
您在列表中选择了 " 本地视频结果 "。You selected Local Video Results in the list. 如果用户在搜索框中键入 "培训" 一词,并且该单词在纵向视频的搜索框中经常键入,则会触发查询规则。The query rule fires if a user types the word "training" in a search box and if that word had already been frequently typed in a search box in the Videos vertical.
通常单击的结果类型Result Type Commonly Clicked
如果其他用户在键入相同的查询后经常单击特定的结果类型,则会触发查询规则。The query rule fires if other users frequently clicked a particular result type after typing the same query.
在 " 通常单击的结果匹配结果类型 " 列表中,选择 "结果类型"。In the Commonly clicked results match result type list, select a result type.
您在列表中选择了 " SharePoint 微博帖子 "。You selected SharePoint MicroBlog Post in the list. 如果用户经常单击搜索结果中的微博帖子,请考虑将最近的微博 post 配置为第一个升级后的结果,并在 " 操作 " 部分) 中将最新的微博 post 配置为第二个提升的 (结果。If users frequently click a microblog post in search results, consider configuring the most recent microblog post as the first promoted result, and the next most recent microblog post as the second promoted result (in the Actions section).
高级查询文本匹配Advanced Query Text Match
您希望使用会导致查询规则触发的短语或字典条目,然后在触发查询规则时定义更详细的条件。You want to use a phrase or a dictionary entry that causes the query rule to fire, and then define more detailed conditions for when the query rule fires.
通过执行下列操作之一,输入导致查询规则触发的短语或术语:Enter the phrase or term that causes the query rule to fire by doing one of the following:
选择 " 查询包含其中一个短语",然后键入一个或多个短语。Select Query contains one of these phrases, and type one or more phrases.
选择 " 查询包含此字典中的条目",然后单击 " 从术语库导入"。Select Query contains an entry in this dictionary, and then click Import from term store. 在对话框中,从术语集中选择一个术语,然后单击 " 保存"。In the dialog, select a term from a term set, and then click Save.
然后,通过签出列表中的选项来添加更多条件。Then, add more conditions by checking off options in the lists.
您选择 的查询包含其中一个短语,然后选择 " 开始查询匹配项,但不是整个查询"。You selected Query contains one of these phrases, and then chose Start of query matches, but not entire query. 仅当短语在查询开始时才触发查询规则,而不是在结束时触发查询规则。The query rule fires only if the phrase is at the beginning of a query, not if it's at the end.