What can we use Dismax tie parameter for ?

Dismax query parser have been with Solr for a long time. Most of the time we use parameters like qf, pf or mm forgetting about a very useful parameter which allows us to control how the lower scoring fields are treated – about the tie parameter.

Tie

The tie parameter allows one to control how the lower scoring fields affects score for a given word. If we set the tie parameter to a 0.0 value, during the score calculation, only the fields that were scored highest will matter. However if we set it to 0.99 the fields scoring lower will have almost the same impact on the score as the highest scoring field. So let’s check if that actually works.

Data structure and data example

To test how the tie parameter works I’ve chosen a simple index structure which would describe products in e-commerce shop, of course in a simple mode:

The text_ws type was defined as follows:

The example documents look like this:

Tie == 0.01 result

Let’s start the test. The first query was the following one:

The above resulted in the following Solr results (visualization – http://explain.solr.pl/explains/cf0wnkpj):

First document

Second document

What can we say about that ?

As you can see, when we passed the 0.01 value to the tie parameter, only those fields that have the highest score for the given query word are most influential. Good example of that behavior is the book word in the first document on the results list. Score for that word is 0.07163518, which was calculated as the sum of the highest scored field (the title field) and the sum of the rest of the fields multiplied by tie.

Tie == 0.99 result

The second query sent to Solr looked as follows:

Which resulted in the following Solr results: (visualization – http://explain.solr.pl/explains/1w7b06lv):

First document

Second document

What can we say about that ?

As you can see the score of the result documents changed. Let’s have a look at the same document and the same book word. In the case, we sent 0.99 as the value of the tie parameter and the score value of that word increased comparing to the score when using tie of 0.01. Of course, the change is not only because the tie parameter but also because of normalization, but let’s forget about it for things to be simple 🙂 So, in the second case, we see the score of 0.071668215, which is the score of the title field summed with the score of the other fields multiplied by 0.99 (tie parameter value).

To sum up

As you can see, the tie parameter allows us, to control how the score is calculated for the DisjunctionMaxQuery. In extreme cases, when we only want the highest scored fields to contribute to the total score we can set the tie parameter to 0.0. Tie lets us control, how we want the low scoring fields to be treated, when score of the documents is calculated and thus where they are on the results list we get from Solr when using Dismax query parser.

In case you are wodering

In case you are wondering what we used to show you the diagrams – please go to http://explain.solr.pl/help and see, maybe http://explain.solr.pl/ may be helpful in Your case.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.