SharePoint24x7 It's all about SharePoint.

18Nov/140

Article – Customizing SharePoint 2013 Search Results with Query Rules – User Intent

Posted by Joy

One of the best new features of SharePoint 2013 Search is the introduction of Query Rules. Query Rules in SharePoint 2013 replaces the Best Bet functionality in SharePoint 2010.

Query Rules allows us to create:

  • Result Blocks
  • Promoted Results
  • Change Ranked Results
  • Act on user “Intent”
  • Publishing

Act on user “Intent”

Act on user intent is all about searching in a natural way. It means mixing our natural vocabulary with search queries.

Most of us refer to PowerPoint presentations as “Deck” and Word documents as “Doc”. In SharePoint 2010 search, when we want to search for any Word or PowerPoint content, you need to first search by giving the search query and then refine using file type.

What if we want to combine our natural vocabulary with search keywords? For example, what if I issue search queries such as “SharePoint deck” and “SharePoint doc” trying to locate Word or PowerPoint content which contains SharePoint keyword? In SharePoint 2010 search, it will search for content which contains “SharePoint deck” and “SharePoint doc” within the content. It doesn’t understand that “deck” and “doc” are two words we use in our day-to-day vocabulary. But in SharePoint 2013, if you search by giving “SharePoint deck” and “SharePoint doc”, it will return Word and PowerPoint content which contains “SharePoint” keyword within the content. SharePoint 2013 understands that “deck” and “doc” are two words which we use commonly in our day-to-day work.

Following is a screen capture of a search result without using any user intent:

SharePoint 2013 Search result

Following is a screen capture of a search result with the use of new SharePoint 2013 Search user intent features:

SharePoint 2013 Search result with user intent

SharePoint 2013 Search result with user intent

“Deck” and “doc” are two built-in user intents provided by SharePoint 2013 Search. We also can introduce custom user intent with the help of new Query Rules concept.

Adding custom user intents

We often refer images as “pics”. It will be very convenient for end-users for being able to search for images by combining “pics” user intent rather than searching and then refining using file type search refinement.

Following is a screen capture of a search result which gives no results when you use “pics” user intent since “pics” is not a built-in search user intent rule and it’s trying to search for content which contains “sharePoint pics” within the content:

SharePoint 2013 Search result

Following steps demonstrate how we can get custom user intents integrated to SharePoint 2013 search.

Task – Creating a custom User Intent Query Rule
  • Navigate to your Search Center. In my case, it’s http://intranet.team.com/search
  • Click Settings from top-right corner and select Site Settings to navigate to Site Settings page.
  • Select Search Query Rules from the Site Collection Administration section to navigate to Manage Query Rules pageSite Settings
  • Select Local SharePoint Results (System) for For what context do you want to configure rules? parameter and click New Query Rule to open Add Query Rule page.Manage Query Rules page
  • Give a Rule Name, and select Query Contains Action Term for Query Condition. Enter “pics” for the option Action term is one of these phrasesAdd Query Rule page
  • Select Add Result Block under Result Blocks in Actions section to open Add Result Block dialog boxAdd Query Rule page
  • Amend the Block Title and click Launch Query Builder to open Build Your Query window.Add Result Block
  • Select Pictures (System) for Select a query option and click Test query button and observe the SEARCH RESULT PREVIEWBuild Your QueryBuild Your Query
  • Click OK to go back to Add Result Block dialog. Change the Items value depending on how many items you need to show in the search result.Add Result Block
  • Click Settings link to expand Settings section. Select Picture Item for Item Display Template and click OK.Add Result Block
  • Click Save to exit from Add Query Rule page
Task 2 – Testing the custom User Intent Query Rule
  • Navigate to Search Center.
  • Search using the new User Intent. Following screen capture shows a result of a search query which is combined with “pics” user intent
    SharePoint 2013 Search result with user intent