Tips and Tricks for Kentico Search Boosting

   —   

People do more searching than browsing today. You are likely already using strategies for optimizing SEO on external search engines, but what about your site’s own search? I have seen many people ask about search boosting in Kentico, but the solutions were either not clear or required custom coding, making it hard for marketers to boost results. I recently worked with three partners/clients on Kentico smart search, and boosting results was a common request. In this article, I’ll share some tips and tricks for search boosting in Kentico without custom coding, and I hope you can benefit from them.

In order to demonstrate and explain how you can boost without custom coding, I’m going to show you an example using the Dancing Goat site. In our scenario, the visitor is searching for the word “chocolate”. Out of the box, several coffees and a couple of articles are returned for this. I unchecked a few Coffee page type from the search result, and added “chocolate” to the description of the “AeroPress Filters” filter pack. Also I’ve added the relevancy score value to the transformation using the “{%Score%}” macro so you can see how it changes based on boosting. Without any boosting applied we see:

Boosting by page type(s)

One common boosting scenario is when you want to favor certain results over others based on page types. For example, when a client wants to feature products more heavily than news articles. In our example, we have a mix of results with some roasts, the filter, and a couple of articles. Let’s say we really want to favor coffees first, then articles, then any other results. Here is how you can do exactly that.

In the “Search condition” property of the Smart search result web part, add the following lines,

classname: "dancinggoat.coffee"^0.7
classname: "dancinggoat.article"^0.5

And in the Search sort, add “##SCORE##”.

The ^0.7 and ^0.5 are boost factors against the original document score based on keyword. They indicate how much you want to boost the result based on the conditions. You may want or need to adjust your numbers depending on your data to get the best result.

With the boosting and sort in place, now the result looks like the following. Notice the scores are very different now.

Boosting by keyword(s)

Boosting by keyword is another commonly requested search feature. For example, how could you boost result #20 to the #1 spot? Or, how can you boost the score of a new product to the first page, when it might otherwise be listed on the second page?

One of my initial ideas was to add appropriate keywords to the Description and Keywords metadata fields. However, the problem with this approach is that those values are indexed as part of the main content of the page. Because of this, the keywords appear 1 or 2 times more for the page and boost its score, but only a little bit.

The best way to boost by keyword(s) is either use the existing tagging feature to tag the page or by adding a Page Type field that is marked as “Searchable” in the page type search field tab (see documentation for more information).

If we continue with my example, let’s boost the “Coffee Beverages Explained” article, which currently is towards the bottom of our results, to result #1. To do this, I first tagged the page with “chocolate”. Next I added the below to the search condition property to boosting based on tags (the indexed field is called “documenttags”):

Documenttags:({% QueryString.searchtext %})^1
classname: "dancinggoat.coffee"^0.7
classname: "dancinggoat.article"^0.5

Now the search result looks like what I was hoping for, with that article boosted to #1 and other results in the same order as before.

Conditional boosting

Now that we have some easy ways to control the boosting, we can take this one step further by doing conditional boosting. Let’s say I only want to do the keyword boosting from the previous example for authenticated users and show regular result order for non-authenticated visitors.

Without the tricks we’ve learned about so far, you would need to build separate custom indexes for each audience. Now we can simply use macro condition to control when the boosting should happen. To do this, all I had to do was change the first boosting condition from the previous example to the following:

                {% if (CurrentUser.IsAuthenticated){ "Documenttags:(" + QueryString.searchtext +")^1"} %}

Now the keyword boosting only happens when someone is authenticated.

Taking it further

Now you see how you can boost search result in different way, there many possibilities. For example:

  • Boost pages with search keywords in the page’s name field over pages that just have the keyword a bunch of times in the description.
  • Boost articles by persona by tagging articles with personas and injecting the visitor’s persona instead of the search query.
  • Boost pages by visitor location by marking a location field on the page searchable and injecting a visitor attribute value (e.g. state) into the search condition for that field.
  • The possibilities are endless.

Wrapping up

I hope you have a better understanding of how you can alter search results in Kentico. These approaches can make your site search experience significantly better for your customers. Let me know in the comments if these examples helped you or if you have more tips and tricks to share.

Share this article on   LinkedIn Google+

Rui Wang

Senior Solution Architect for Kentico located in US.