solrfull-text-searchrelevance

Solr - Boost result with exact match in the begginning of term


For an e-commerce store I have two products like these indexed in Solr

  1. easyCover Silicone Protection Cover for Canon EOS 80D (Camouflage)
  2. Canon EOS 80D DSLR Camera with 18-135mm Lens

Now, for a search query "Canon EOS 80D", I am getting product ranked as 1,2 as a result.

How can I rank Product 2, which is "Canon EOS 80D DSLR Camera with 18-135mm Lens" rank first?

Basically, I want to give more boost/weight-age to the product that has term in the beginning of the name phrase compared to those product that has same term not the first in the name phrase.

Pls advise.


Solution

  • I strongly advice not to use the token positions to boost your product over accessories. Imagine a customer is searching for "EOS 80D" - he will still get the silicone cover on first position.

    A better solution would be to boost on a secondary field. Some ideas:

    I know that this answer is not a direct solution for the original question - but sometimes there are much simpler solutions for a problem if you look at it from a distance.