Query Transforms – SharePoint 2013 Search

I was just amazed to see how much improvement has been made to Search in SharePoint 2013.
Here I would like to share how to make Search to give results in an orderly manner using query Transforms (configurable query tool).

SharePoint 2010 had People Search, Best Bets and so many other search options but SharePoint 2013 has advanced pre-designed search verticals like People, Conversations, videos, Reports and Everything. Along with this, it enables us to create our own query transforms too. For example, we can have a Query transform for pdf documents, or excel documents, Music, Pictures, Blogs, etc.

Query Transforms and Query Variables:

Query Transform is a tool which helps to overwrite the default query using Query Variable which again act as an overwriting parameters. The Query variables could be to get data based on certain conditions, or also help in sorting the search results.
Query tranform contains Query Variables which act as a placeholders for values or parameters in a normal query term. Query Transforms are set from Result Sources in Site Settings Page under Search Category. Here we set the Search Vertical we want to have for eg: Music and provide the Variable accordingly.


There are different Query Variables available to use and complete list is given in this Technet link. Let us just look at some of the examples here.

{User} or {User.Name} Display name of the user who issued the query. Example:Gayathri
{User.Email} Email address of the user who issued the query. Example:gayathri@email.com
{searchTerms} The query that the user typed, as changed by the most recent transform. Example:sun

There is a query template that is being used by the Query Transform. It will have one Query Variable and the parameters like the one below:

Eg: {searchTerms} contenttype:music

Configuring Query Transforms

You can configure Query transforms in three places

  • Web Part
  • Query Rule
  • Result Source (as seen in above image)

1. Web Part

The two webparts where Query tranforms can be configured are Content Search Web Part and the Search Results Web Part. But these configuration will be overridden by Query rule or an Result Source

2. Query rules

Query rules are rules applied on site level usually but it might be used on a site collection level too.

  • First step is to specify the context of the rule
  • Next step is to specify the condition that will cause the rule to be applied
  • Third step is to specify to which action to trigger when the rule is applied.

3. Result Source

We can specify the query Transform and over write the default search query using Result source. You can also create more than one result source per search provider and set different query transforms on one Result source.

Result source is the one that transforms the query last meaning, it over rides all the other query variable used.

There is a Query Builder too to build your query as and how you need to use it. To build the query we should use Keyword Query Language (KQL) and we can also test the Query using the Query builder. More on Configuration and Query Builder will be discussed in the following post.


About gai3kannan

I am working with NCS Pte Ltd as a Lead Consultant I have taken SharePoint as my full time action and thoughts.
This entry was posted in SharePoint 2013 and tagged , , , . Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s