Developer forum

Forum » Ecommerce - Standard features » Search scoring doesn't appear to work for Equals

Search scoring doesn't appear to work for Equals

Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply

Hello,

I have a site where I'm trying to use the boost scoring to pick the top 1 result where the priority is important. It doesn't appear to work on this site though, on 9.9.4. 

When I change the Equals to Contains, then there is a score. Otherwise, the score is zero. We would prefer to use Equals though.

Here's a test: https://devcatalog-drteeth.dw-demo.com/quickaddtest. The _score is always zero. That feed's query is eCommerce -> QuickAdd.

What am I doing wrong?

Scott


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Scott

You are searching the wrong field. I made one change - chaning one of the criterias from the "product number" field which is analyzed to the custom mapping of the field you already created as the "ItemNumber" field. The latter is not analyzed (which is a requirement in this case since product numbers contains numbers, hyphens and the like and are then broken down to terms by the analyzer. I.e. AF15MBK becomes "AF", "15", "MBK" in the index when analyzed.).

You can see the result here: https://devcatalog-drteeth.dw-demo.com/quickaddtest?ProductNumber=AF15MBK

You probably still have the issue with the UPC and the ReplacementProduct fields since they are still analyzed. Maybe that is ok, maybe not. If those fields are "sku1, sku2, sku3" you have to index as a string array but not analyzed. You cannot index them as just strings and use analyze because of the above issue.

BR Nicolai

Screenshot_2020-12-14_090657.JPG
Votes for this answer: 1
 
Nicolai Pedersen
Reply

Hi Scott

You are searching the wrong field. I made one change - chaning one of the criterias from the "product number" field which is analyzed to the custom mapping of the field you already created as the "ItemNumber" field. The latter is not analyzed (which is a requirement in this case since product numbers contains numbers, hyphens and the like and are then broken down to terms by the analyzer. I.e. AF15MBK becomes "AF", "15", "MBK" in the index when analyzed.).

You can see the result here: https://devcatalog-drteeth.dw-demo.com/quickaddtest?ProductNumber=AF15MBK

You probably still have the issue with the UPC and the ReplacementProduct fields since they are still analyzed. Maybe that is ok, maybe not. If those fields are "sku1, sku2, sku3" you have to index as a string array but not analyzed. You cannot index them as just strings and use analyze because of the above issue.

BR Nicolai

Screenshot_2020-12-14_090657.JPG
 
Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply

Hi Nicolai,

Thanks. Knowing that analyzed fields can't be used for scoring does answer that. It's actually the Replacement Products field that is the focal part of this query, and it has to be analyzed, BUT, that's not a problem because we only need the score to prioritize the ProductNumber and UPC, and a score of 0 on Replacement Products is ok. 

So we'll update UPC and button it up, and this will work.

Thanks!

Scott

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Scott

Analyzed fields can be used for scoring! But scoring will not happen if you do not have an exact match on a term - not to be confused with the field value. So in the example above, the product field with the value "AF15MBK" which will broken into the terms "AF", "15" and "MBK" when analyzed. So searching ProductNumber=MBK would also score that document because there is a term match, but not ProductNumber=AF15MBK because there is not a term match.

BR Nicolai

Votes for this answer: 1
 
Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply

Hi Nicolai,

Thanks for the further clarification. That makes perfect sense.

Scott

 

You must be logged in to post in the forum