Customizing SharePoint Search with Query Rules and Promoted Results

Recently, I had a colleague of mine come to me with a request for Search. He wanted to “force” a specific person in the organization to show up at the top of the search results, if a user searched on a specific location. So, by searching on “Boston”, the leader of our Boston Practice should display prominently in the search results. It’s a great use case, and a perfect way to demonstrate how we can customize search to meet those needs. For the purpose of this blog post, the examples I will show would assume that:

  • You have SharePoint installed (I’ll be using SharePoint 2013 On-Premises for this post).
  • You have previously configured the Search Service Application.
  • You can successfully crawl all of the information on your SharePoint sites.
  • You have setup and Site Collection with the Enterprise Search Center template (not required, but never a bad idea.)

So, let’s take a look at the default Enterprise Search Center Results screen, and see how we can customize it. In this example, I did a simple search on “SharePoint” so we can see how the search Results are displayed:

On the Top of the screen, I can see the search bar, and right below it are the default Result Sources which will allow me to specify the specific areas of SharePoint I want to focus my search on. As our use case specifies, we will want to focus this particular search around People. Below my results sources, are the actual search results. By hovering over any of the results, I can pull up a preview of the (document, page, person) in the browser, which allows me to gain quick insights into if this was what I am interested in. To the left are the default Search Refiners. These allow me to drill down into my query and refine of the type of content, author, or any other managed property I have defined, to narrow my search results further. Now, let’s look at some options on how we can fulfill our use case.

Query Rules and Promoted Results

A promoted result is a search query that can be set to manually display a URL at the top of the search results. For our example, we’ll do a search on “Boston”. In my test environment, that will bring up results for 4 people. For this test, we’ll say the “Jennifer Rollins” user is the head of the Boston location, and we want to make sure she is listed first anytime someone searches for Boston.

So, our next step will be to add our promoted result. So, let’s go to Site Settings -> and under the “Search” heading, click on Query Rules.

For this particular use case, we want Jennifer to appear at the top when a user Searches for “Boston”. So, we’ll create a Query Rule, when the Keyword matches “Boston”. Then we’ll click on “Add Promoted Result”

For our Promoted Result, we’ll make the Title “Jennifer Rollins”, and then add the URL of her my Site page. We’ll also add a description of Boston Office Lead.

We can then save it, and head back to our Search Results Screen to see how our new query rule works out. As you can see, I now have a Link with Jennifer Rollins’ name, as well as the description we added. Now anytime I search on Boston, I will see her name first!

Add an Image to your Promoted Results

Ok, so the first thing you’re thinking is, “Well, that’s great. But why can’t I see her picture when I can see everyone else’s?” Good Point, so let’s add her picture as well! All we need to do is head back to our Query Rules, and Edit the new Query Rule we just created. Next, just add a new Promoted Result to the query rule. We’ll call this one “Jennifer Rollins Image”. From here, we just need to give it a title, and then we’ll add the URL of her my Site Profile Image. (You get this by inspecting the element in IE or Chrome to get the direct path on the My Site Page.) This time we’ll click “Render the URL as a banner instead of a hyperlink” and then click Save.

Now, back on our Query Rules Page we can sort this rule to show the Image First, and then the Link Second:

If we head back to our Search Page, now we can see her image, as well as the link to her my site page!

As you can see Query Rules are simple to use, but they can also be very powerful in helping you to customize your users search experience.

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: