Partager via


Query Rule Conditions in SharePoint 2013 Search

I was putting this information together today for the SharePoint 2013 recordings that will be going up on TechNet early next year, and I thought it would be good information to share here as well. I've had a few posts already about search and query rules. One of the things that may be a little hard to understand is the conditions that you can create for a query rule. You actually have a couple of choices before you get there actually - if you decide that you want your query rule to fire every time, then just delete the condition that is added when you create the query rule. If there are no conditions then your query rule will fire every time. If you want to use conditions though, then you can add one or more conditions - as soon as we find one that matches, we'll stop and get onto whatever action you've defined for the rule.

The point of this post though is to talk about the conditions and what they mean; it can be a little tough just from looking at the description them, so that's what I'm hoping to explain here. These are the conditions you can use in a query rule:

  • Query Matches Keyword Exactly
  • Query Contains Action Term
  • Query Matches Dictionary Exactly
  • Query More Common in Source
  • Result Type Commonly Clicked
  • Advanced Query Text Match

 

Matches keyword exactly is pretty straightforward - you can create a condition where the user’s query exactly matches a specific word or phrase; you just type in what you’re looking for. 

Action terms can be words that you type into the condition and the query needs to start or end with one of them. You can also have it look in a term store termset for action words. The difference between typing in a value for an action term versus keyword, is that keyword must match exactly; action terms can be at the start or end of the query.

For matching a dictionary exactly, you select a termset and the query has to exactly match one of the terms in it.

For query more common in source, this means the condition checks to see if the query is one of the top queries in a specific result source you select. For example, if a user queries for “Shareholder Presentation” in the default result source, it may be that the query is actually very popular in the Videos result source, where you query against all of the video presentations to your stockholders. If that’s the case, then you might want to have your query rule also fire the users query against the Videos result source in addition to the source the user is querying.

The result type commonly clicked is similar to query more common in source. What it means is that in your query rule condition you can select a result type, like videos. When the query rule looks at the user’s query, if it sees that when people executed that query previously they commonly clicked on videos in the search results, then your condition would return true. So again – if a query has results that are commonly clicked for a particular result type, then you can use that to have another query execute and return results of that type.

Finally, in the advanced rule you can do all sorts of matching against the user’s query – you can look for a query that contains, starts with or ends with a particular word or phrase, you can look for matches in termsets, you an use regular expressions, etc. 

 

Hope that helps clarify what these conditions mean and how they are meant to be used.

Comments

  • Anonymous
    January 01, 2003
    Hi Steve. What if you have a search page that should load results without a query. e.g. A user goes to a customer search application page, and when they arrive "all results" are shown, but you want to use a query rule to group a certain priority level above the other results. Can't seem to get the query to fire.
  • Anonymous
    January 01, 2003
    The comment has been removed
  • Anonymous
    September 18, 2014
    The comment has been removed