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 contains “SharePoint” as shown below-
https://howtodowithsharepoint.files.wordpress.com/2015/01/12.png?w=450&h=357
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”
https://howtodowithsharepoint.files.wordpress.com/2015/01/22.png?w=450&h=446
- Under “Search” section Click on “Query Rules”
https://howtodowithsharepoint.files.wordpress.com/2015/01/32.png?w=281&h=300
- Create & Configure Query Rule
- Select the required “Result Source”, in our case we can go with “Local SharePoint Search Results”.
- Click on “New Query Rule” in order to create a new Query Rule.
- Specify rule name as “Custom Video Intent”
- 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”.
- Click on “Add Result Block” to specify the query based on which Result Block will be rendered.
https://howtodowithsharepoint.files.wordpress.com/2015/01/41.png?w=450&h=153
https://howtodowithsharepoint.files.wordpress.com/2015/01/51.png?w=450&h=215
https://howtodowithsharepoint.files.wordpress.com/2015/01/61.png?w=450&h=105
- Configure Result Block
- Specify the “Block Title” as shown below
- Click on “Launch Query Builder” button to configure the query
https://howtodowithsharepoint.files.wordpress.com/2015/01/71.png?w=450&h=353
- Configure query
- Select result source “Local Video Results”
- Click on “Test Query” button to test the query based result source selected in Step 1
- “Search Result Preview” Section on the right will show the results returned as a part of the query specified earlier.
- Click “OK” to save the Query Changes.
https://howtodowithsharepoint.files.wordpress.com/2015/01/81.png?w=450&h=303
- Configure Display Templates
Choose suitable Display Template from “Item Display Template” dropdown list.
https://howtodowithsharepoint.files.wordpress.com/2015/01/9.png?w=450&h=210
https://howtodowithsharepoint.files.wordpress.com/2015/01/10.png?w=450&h=126
And that’s it. We are all done with our new Query Rule defining Custom User Intent.
https://howtodowithsharepoint.files.wordpress.com/2015/01/111.png?w=450&h=155
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.
https://howtodowithsharepoint.files.wordpress.com/2015/01/121.png?w=450&h=408
Hope this will help someone in need.