Posted on 31/08/2017 10:00:59
Hi Nuno
You can publish the query/search with the querypublisher to see the score.
You have to remember that "Contains" operator does not give any scores at all. Nothing. Only Equals operator will score the result. You might want to read this: https://lucene.apache.org/core/3_5_0/scoring.html
So to get scoring to work, setup your search like in the dumps. Set boost on the "Free text name" field only.
It works by searching the same thing twice. One with CONTAINS operator: field like "search*" that will never give a score and one with EQUALS operator: field = "search" that will give a score if the term is found in full. You can never get a score out of searching for 123 looking for 1234 - that is not possible.
Also setting the "Free text name" field as analyzed or not will have an impact. Consider a situation where product numbers have a seperator. i.e. abc-123. Analyzing that string will give you 2 terms, resulting in a search for 123 will score this document high. If you do NOT analyze, there will be no score. Not untill a search for abc-123 is conducted.
- Free text (Name, Number, descriptions, etc) analyzed => search field using CONTAINS
- Free text (Name, Number) analyzed = boost 5 => search field using EQUALS
- Product name, NOT analyzed = boost 10 => search field using EQUALS
- Product number, NOT analyzed = boost 20 => search field using EQUALS
BR Nicolai