Developer forum

Forum » Ecommerce - Standard features » Control scoring of keywords in search results

Control scoring of keywords in search results

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I have a scenario where I need to control the scoring or relevance of different fields or expressions.

For example, I want to show first the products whose name starts with the keyword then products that contain the keyword in the description or inside the product name.

I have tried setting a 9 scoring on the ProductName_search and use only the Contains rule without analyzing the field but I did not get what I was expecting. I am pretty sure I have not understood correctly how the scoring and relevance works.

Can anybody clarify it for me?

Thank you,
Adrian


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply
This post has been marked as an answer

Hi Adrian,

 

Lucene scoring and boosting is actually really complex. Feel free to google it. I find this StackOverflow reply to be one of the simplest to understand it https://stackoverflow.com/questions/30885219/understanding-apache-lucenes-scoring-algorithm

 

That said, the concept that we can control boosting to granuraly get the expected results of a given scenario become hard or unrealistic as soon as your start adding more and more expressions. That said, I try to manage customer expectations about it and try to only use 4 boosting values (besides the default), which as the same as you get in the Search for Editors options, and create 4 summary fields for it:

 

Then I use as little expressions as possible. I use those 4 fields and then product name and number for exact matches. https://www.screencast.com/t/awBCKBv4

 

Hope this helps,

Nuno Aguiar

Votes for this answer: 1
 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nuno,

Thank you very much. This is extremely useful.

I will start reading and play with the system.

Thank you,
Adrian

 
Nicolai Pedersen
Reply

Scoring will not work with contains.

Use equals on the field in combination with contains. Then terms that equals the term will score higher than things that contains the term.

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

Thank you for the clarification. I am not sure I can do that with all fields but I can surely use it for some.

Nuno's suggestion seems to solve my problem at least partially.

Thank you,

Adrian

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Nicolai,

 

> Scoring will not work with contains.

That's interesting to know, so only expressions like Equal, Match Any and Match All would impact scoring, is that what you mean?

 

Best Regards,

Nuno Aguiar

 
Nicolai Pedersen
Reply

Yes, that is what I mean. Try your query in the query publisher and look at the score (an available tag). It will be more or less the same for all entries except those hit with equals etc.

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Great, thanks for confirming. I'll do that too. It will help justify a few things to customers. They are always looking for a black-and-white response on this, and being able to tell them that "Contains" does not account for scoring (only for document "matching") will be very helpful

 

You must be logged in to post in the forum