Query Rules in SharePoint 2013

Leaving both the SharePoint Conference in Las Vegas and the recent European SharePoint Conference in Copenhagen behind, Findwise continues sharing impressions about the new search in SharePoint 2013! We have previously given an overview of what is new in search in SharePoint 2013 and discussed Microsoft’s focus areas for the release. In this post, we focus more on the ranking of the search results using the query rules.

Understanding user intent in search is one of the key developments in the new release. The screenshots below, showing out-of-the-box functionality on some sample content, exemplify how the search engine adapts to the user query. Keywords such as ‘deck’, ‘expert’, or ‘video’ can express the user’s needs and expectations for different search results and information types, and what the search engine does in this case is promoting those results that have a higher probability to be relevant to the user’s search.

Query rules

Source: Microsoft

 

The adaptability of the search results can seem remarkable, as we see in these examples, aiming to provide more relevant search results through a better understanding of the user intent. Actually, this is powered by a new feature in SharePoint 2013 called query rules. Even more interesting maybe is that you can define your own custom query rules matching your specific needs without writing any code!

The simplest query rule would be to promote a specific result for a given search query. For example, you can promote a product’s instruction manual when the users search for that product name. Previously, in SharePoint 2010, you were able to define such promoted results (or “best bets”) using the Search Keywords. The query rules in SharePoint 2013 extend this functionality, providing an easy way to create powerful search experiences that adapt to user intent and business needs.

When defining a query rule, there are two main things to consider: conditions and corresponding actions. The conditions specify when the rule will be applied and the actions specify what to do when the rule is matched. There are six different condition types and three action types that can be defined.

For example, a query condition can be that a query keyword matches a specified phrase or a term from a dictionary (such as ‘picture’, ‘download’ or a product name from the term store), or that the query is more popular for a certain result type (such as images when for example searching for ‘cameras’), or that it matches a given regular expression (useful for matching phone numbers for example). The correlated actions can consist of promoting individual results on top of the ranked search results (promoting for example the image library), promoting a group of search results (such as image results, or search results federated from a web search engine), or changing the ranking of the search results by modifying the query (by changing the sorting of results or filtering on a content type). Another thing to consider is where you define the rule. Query rules can be created at Search Service Application, Site Collection, or Site level. The rules are inherited by default but you can remove, add, configure and change the order of query rules at each level. Fortunately, it also allows you to test a query and see which rules will fire.

There is one more thing though that you need to take into account: some features of query rules are limited in some of the licensing plans. Some plans only allow you to add the promoted results, and the more advanced actions on query rules are disabled. Check TechNet for guidelines on managing query rules and a list of features available across different licensing plans.

With the query rules, you have the freedom and power to change the search experience and adapt it to your 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.

Let’s have a chat about how you can create great search experiences that match your specific users and business needs!

6 thoughts on “Query Rules in SharePoint 2013

  1. This seems like a useful way for non-programmers such as site owners and content librarians to control some aspects of search results in a fairly scalable way.

    Do you know if there any cross-checks with click ranking? I’m sure that ecommerce uses it, they are very data-driven. But for other kinds of sites, I’d worry about the long tail, as site owners tend to optimize for their idea of the information need. It seems like these could overshadow the transparency of matching terms in context snippets, and might lose user confidence as a result.

    • Thanks for your comment! Those are two interesting points.

      Actually, the user’s interaction with SharePoint is stored as usage events entries and by default used in the ranking of results. Events such as clicking and viewing a search results are analysed by the new Analytics Processing Component and stored in the search index.

      As for using this kind of information with the query rules, there is indeed some cross-checking, though limited. In addition to defining a condition for matching on specific entries (a keyword, action term, dictionary, or regular expression), query rules can also be defined based on the interaction recorded for previous searches. And there are two condition types for this: query rules can be defined based on the frequency of previous searches of the query in a specific result source, or based on the previous clicks on a particular result type for that query. So the latter one can use previous clicks to influence the ranking.

      While being a simple-to-use feature (no coding involved), the process must be very well managed to avoid over-optimization. Also, such decisions should be based on the web analytics reports (called usage reports in SharePoint 2013) that reveal the actual usage, including the usage of the query rules. I would see this feature going hand in hand with a governance strategy that takes into account both the business-specific rules and the various user information needs.

  2. Hi,
    This was really helpful. I am trying to figure out if query rules can be used in my scenario here. I am trying to sort results in the by Display name in people search. User profile properties office address, about me are also searchable. I have enabled the sort drop down in the search results page and made Display name as the default sort option. When a user searches for a keyword say “Fisher”, the person named “Amy fisher” comes up as the first result as Amy works at “2 Fisher street” and alphabetically the first results sorted and James Fisher comes at the bottom. Can we use query rules to say matches in the name should come up on the top?

    • Hi Kranthi,
      Thanks for the question. It sounds like what you want to do is change the ranking of the people search results. The query rules will help you in defining what should happen when the query matches something, but if you want to change the ranking of the people search no matter what the query is, then you could change directly the People Search Core Results web part. Using the Query Builder on your People Search Core Results web part might help you, and if not you might go into changing the ranking model. Hope this helps and let me know how it works out!

  3. Hi,

    I was wondering if there is a way that on a particular search you can turn off the query rules? Like a “switch” that can be added to the query string. I know if I encapsulate the term in quotes it will not run query rules but I was hoping for something different

Leave a Reply

Your email address will not be published. Required fields are marked *