Query Rules in SharePoint 2013

With the help of Query Rules in Sharepoint 2013 without any custom code, we can promote a specific result or even change the ranked result by changing the query. Search Expert or the Search Manager of the organization has the freedom and power to change the search experience and adapt it to the organization needs. Defining the right keywords to be matched on the user queries and mapping the conditions with the relevant actions is easy but the process must undoubtedly be well managed. The management of the query rules should definitely be part of your SharePoint 2013 search governance strategy.

A query rule can specify the following three types of actions:

  • Add Promoted Results
  • Add one or more groups of results, called result blocks
  • Change the ranking of results

How to Add Query Rule:
Let’s take a scenario where an organization is maintaining the list of glossary terms managed in the organization. When we search in google “meaning of activity”, it automatically recognizes that user wants to know the meaning of the word ‘activity’ and it highlights its meaning at the top and displays the rest of the results in the bottom.



 Query Rules in SharePoint 2013
Query Rules in SharePoint 2013
SharePoint also provides this feature using ‘Query Rule’ feature.
By default, when we search for ‘definition of activity’ or ‘meaning of activity’ it returns the results including keywords definition and activity.
 Query Rules in SharePoint 2016
Query Rules in SharePoint 2016
We have managed the list of glossary terms in a list as shown below,



sharepoint search query examples
sharepoint search query examples
Go to Search Setting of the Search Center site and Click on ‘Query Rules’
Select ‘Local SharePoint Sites’ under click on ‘Add Query Rule’
Name it as ‘Glossary Rule’ and select ‘Query Contains Action Term’ as a Query condition as shown below
sharepoint 2013 configure query rules
sharepoint 2013 configure query rules

Add ‘definition of;meaning of’ under the Action Terms phrases. So that whenever end-user search for ‘definition of activity’ it excludes the terms definition of and search only for ‘activity’ in the glossary list.

Click on Change rule query and it will open this window


Select the ‘Glossary’ result source. (You need to create the glossary results source first which returns the results only from the glossary list)

Under the keyword filter select ‘{SubjectTerms} – the unmatched query terms’ and click on ‘Add property filter’

how to create query rules in sharepoint 2013
how to create query rules in sharepoint 2013
Click on ‘Add Result Block’
 Query Rules in SharePoint 2013
Query Rules in SharePoint 2013
Click ok
Publishing section defines from which period of time from start date to end date this query rule should be active.
 Query Rules in SharePoint 2016
Query Rules in SharePoint 2016
Click on ok.
Now go to your search center and search for ‘definition of activity’
 Query Rules in SharePoint 2019
Query Rules in SharePoint 2016
You can see that it promoted the results from the glossary list.

You May Also like the Following SharePoint Online Tutorials:

Leave a Reply