Boost your search results with document level boosting

Document level boosting is just as important as field level boosting, and they have their own purposes.  Field level allows you to boost directly on a field value, targeting the content field or a title field.  Document level boosting adds “weight” to a document as whole, giving it more relevance than other documents.

How Collette Utilizes Document Level Boosting

For our search index we crawl Collette’s product (tours) and apply a boost based off a simple algorithm that calculates several backend indicators. The output of this algorithm is some number where the largest calculation would never exceed 1.0.  Let’s take a look at the screenshot below. We can see Reflections of Italy has a calculated score of 0.592 and Discover Tuscany is lower at 0.549.  From what I have shown you thus far we are only using a computed field to get that calculation stored on the document.  Now that we have the calculated score set on the document we can tell Solr to look at that field and apply that value to its boosting process.

docBoost

Let’s Apply Some Boosting

Here we are going to dig down in Solr.  Go to your core’s config folder and open the SolrConfig.xml file.  Follow these steps and explanations:

  1. When we query this core we need to change the default parser to ‘edismax’.  The standard parser, dismax, has many limitations from what I read and does not handle boosting well. In the SolrConfig.xml we need to set the defType parameter to edismax, to do this search for <requestHandler name=”/select”.edismax
  2. Just below where you defined the edismax parser you need to tell Solr to apply the value of the calculatedScore field to its boosting functionality.  You want to remove the line that says: <str name=”fq”>inStock:true</str> and replace it with what is shown in the screenshot below.bfField
  3. Follow the steps through one more time but change the /query request handler this time.  You will want to search for <requestHandler name=”/query”.
  4. Rebuild your index and if you do a default search of *:* you should see Solr will return the results in the order of your calculatedScore computed field.

*Note: I was not able to get the Solr web console to use the defaults I set. I believe they are overriding the defaults in their code, but if you make a request from Sitecore or from HTTP you should see the results in the proper order.

*Second Note: Sitecore does have a document boosting pipeline in the Sitecore.ContentSearch.config. I believe their was a bug in earlier versions of Sitecore 7 and we were unable to get boosting applied using that pipeline. This is why we made the change directly to Solr.  The index name is called <indexing.resolveItemBoost>

This entry was posted in Solr and tagged on by .

About tbraga1983

Digital Professional, Sitecore MVP, started working with Sitecore back in 2008 when I worked for Velir. I joined Collette in 2013 to lead up their new website from the ground up. We started fresh on Sitecore 7, Solr, EXM and xDB.

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