Query Rules - Beyond Search box in Sharepoint 2013

Developers often excited about new technology like EF6.0, C#5, Visual Studio VNext, MVC 6, Sharepoint 2013, Cloud platform. But they put the most important fact on the blind side "What features of this new technology we use?"

Don't you think that defeated the purpose of having a car instead of cart.

Whats the point of using SharePoint 2013, if we din't use any new features provided by it. Right?
So developers should evaluate the new features and their limitations before actual implementation or migration from on version to other. 

In this post i would like to talk about couple of features in SharePoint 2013.

There are lot of new features in SharePoint but Search got the most of the tuning in 2013.

Query Rules: The new feature which increases the relevance of the results with simple language expressions while search.
You can get lot of theory if you search with term "Query Rules in SharePoint 2013", but let me show what it means by demonstrating an example.

I have an Document library with different kind of files .ppt, .docx, .xlsx, .pdf. Check the metadata and file types of the documents.

I also have created a Search page in the same site and lets check the search results in a few scenarios.

Look at below screenshot and see what the default search picked up.
Now being a developer, you may say, it worked as expected. User searched with term "slides"  so he got a document which has slides in its name. 

But think in end user perspective, he is searching for all powerpoint slides which has wellington in its metadata. He asked for PowerPoint, and we presented a word document.

This is where we can use the OOTB feature of sharepoint 2013, Query rules.
Go to Central Admin => Search Admin => Now click on Query Rules on the left.

Most people doesn't care about the description, but you should carefully read it. It says, Query Rules promotes qualified results based on generic search terms. It wont eliminate other results.

By default Query rules are enabled in SharePoint 2013,  i just disabled them to show the above scenario. 
Look at basic definition of a Query rule in below screenshot.

These are all OOTB rules which i enabled them now. If you look at condition and action, the last one "PowerPoint" says if a user search with {subject terms}+ slides or .ppt or deck, the results should promote "Ofice Powerpoint" results in the first place.  

Now let me search with term "Wellington Slides", wellignton being {subject term} , look at search results now.

Now it make sense. Search promoted the qualified results and also displayed all the results at the bottom.  

This is a way of personalizing the search behavior for each Line of Business. Query rules can be configured at both Central admin level as well as Site collection administration levels. 

How we can apply in business terms. Let me show you a scenario. 

Scenario: Each Customer has lot of files uploaded by lot of users. But every user want to review the files uploaded by them. to summarize, user says show my files. Imagine how you used to do earlier. User definitely need to use advanced search to achieve this.

Now check how i  create a Query rule to match this scenario.

Step1: Defining the name and condition of the query rule.

Step 2: Defining the name for Action. The Query builder is the one of the best features offered by SP2013. You can build the complex search queries and execute then and there to see results. after checking results, you can save the query actions or conditions.

Step 3: Build and test the action. Observe the highlighted parts of the page.

Now save the Query rule and to verify this i used a different user "SP_User" and uploaded 2 files one for Customer2 and other for Customer4.

Searching as SP_User:

We can even publish or Enable/Disable these Query rules based on date. This means we can give different results set for the same action term based on certain dates. One of the example is promoting Christmas shopping results while December. 

We have seen the significance of "Query rules" and how to configure them and how they make difference in promoting right results or increase the relevance of the search results.

In next post we will see how we can modify the search templates to make the UI of search look great.
Spoiler alert: No more XSLT in formatting search results. Thank God!

No comments:

Post a Comment