26186 returns 261872T00 but not 261860000, why? #3151
-
I have this strange problem with search results. Searching partial product code as 26186 I get: I get 261860000 only if I type 2618600 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Hello @stravanato, There are quite a lot of parameters that can dictate how and why an EAN-like string would get matches. First things first, please note that there is no notion of "substring" matching. Secondly, what is present in the engine is determined by the (text) analyzer that you can configured on a per-attribute level.
You can check for yourself using the "Elasticsuite > Analysis" screen in your Magento admin. The "reference" analyzer which we recommend using for "EAN-like" attributes (like But long story short, if your attribute is using the "standard" analyzer, when searching "26186", there will be no exact match amongst all the tokens I listed above.
Give a try to the "Elasticsuite > Analysis" to see if the "reference" analyzer would be able to generate from 261860000 a token "not too far" from 26186 (my guess is probably not).
If that's not the case, you can try :
Regards, |
Beta Was this translation helpful? Give feedback.
Hello @stravanato,
Concerning
Come to think of it, you don't really need to "keep the complete" form since when you use a given field/attribute for searching, Elasticsearch will re-apply the same analyzer to your input string.
So if you push "261860000" through an analyzer that trims trailing 0s, it will index "26186".
But when you search for "261860000" it will also trim the trailing 0s, so it will actually search for "26186" and you'll get a match.
Concerning your exact question, yes, the idea was to add a filter after the "reference_word_deli…