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

348 Views Asked by At

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.

1

There are 1 best solutions below

1
oliver_t On BEST ANSWER

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:

  • put a boost function on the price, as the main products usually have higher prices as the accessories e.g bf=log(price)
  • use a field to categorize your items in products and accessories - and put a boost on this, e.g. bq=category:product
  • create a field to list the products that an assessory can be used with. This will also help you to advertise the accessories in future. But it will now also help to find the main products, by boosting the the documents that don't contain references here.

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.