SharePoint 2013: How To Create Custom Intent Based Results Blocks Using Query Rules

In this post we will explore a new mechanism of Searching data based on Custom User Intents and serve them as Result Blocks on top of the Search Results.

By the way what is Custom User Intent?

Custom User Intent means matching a Search Term specified by the end user with the Phrases defined using Query Rules. For example, PowerPoint Slides are also known as Decks. So if the business user specified a Search Term as “SharePoint Deck”, it was really intended to search all the PowerPoint Slides which contain “SharePoint” as shown in the image below. 

SharePoint

Hope the above example suffices to clarify the Custom User Intent.

Business Scenario:

For the sake of this demo, I have setup an imaginary scenario, where in my organization business users refer all types of videos as “Small Medium Sized Video” or “SMV”. As the matter of habit all users make use of keyword “SMV” in order to search for video files in SharePoint System.

In order to implement the Custom User Intent based on above scenario we have to follow the below steps:

>>Go To “Site Settings”

Site Settings

>>Under “Search” section Click on “Query Rules”

Query Rules

>>Create & Configure Query Rule

  1. Select the required “Result Source”, in our case we can go with “Local SharePoint Search Results”.
  2. Click on “New Query Rule” in order to create a new Query Rule.
  3. Specify rule name as “Custom Video Intent”
  4. Under “Query Conditions” “Query Contains Action Term” and specify the phrases you want to match to identify the User Intent, like we specified as “smv;smvs”.
  5. Click on “Add Result Block” to specify the query based on which Result Block will be rendered.

site setting

site setting

actions

>>Configure Result Block

  1. Specify the “Block Title” as shown below
  2. Click on “Launch Query Builder” button to configure the query

Query Builder

>>Configure query

  1. Select result source “Local Video Results”.
  2. Click on “Test Query” button to test the query based result source selected in Step 1.
  3. “Search Result Preview” Section on the right will show the results returned as a part of the query specified earlier.
  4. Click “OK” to save the Query Changes.

basic

>>Configure Display Templates

  1. Choose suitable Display Template from “Item Display Template” dropdown list.

setting

action

And that’s it. We are all done with our new Query Rule defining Custom User Intent.

setting

Now it is time to see the Query Rule in Action. In order to test it go to Search Center and enter “SharePoint smv” as search term and click Search Icon. You will see the Search Results Block “Video Results for SharePoint” containing items which contains “SharePoint” in their Title or Description.

result

Hope this will help someone in need…

Read more articles on SharePoint: