Smile-SA / elasticsuite

Smile ElasticSuite - Magento 2 merchandising and search engine built on ElasticSearch
https://elasticsuite.io
Open Software License 3.0
760 stars 339 forks source link

Results only ending with searchterm found #3070

Open LaurensGoedel opened 11 months ago

LaurensGoedel commented 11 months ago

We have installed Elasticsuite 2.10.12 on a Magento 2.4.5-p2 instance. It seems to work ok, however the searchresults will not show any results if a product is starting with the searchterm.

For example, we search for "citrus". As results we get products where "citrus" is in the description or ends with "citrus". However product with the name "citruspers" is not found.

Is this something i can configure?

rbayet commented 11 months ago

Hello @LaurensGoedel,

The default language analyzer for you site probably does not consider that "citrus" and "citruspers" are small variations of the same word. You can make sure by using the Elasticsuite > System > Analysis and check how the words are analyzed in your catalog product index (that will depend on the actual language associated with the store).

As an example, for an english (en_US) store view/index, those are considered two different words : image

If enabled on the attribute that contain those words (Used in Spellcheck = Yes), the default fuzziness configuration should allow Elasticsuite to go from "citruspers" to citrus" (based on the analysis above, only two letters need to change) in an en_US catalog.

BUT if you have other products with exactly "citrus" in the index, then in your case Elasticsuite is probably launching an exact match query with fuzziness disabled.

There are two alternatives :

For the second alternative, basically, it means that when you'll push a field (like the product name) with the standard_edge_ngram analyzer in the search engine, it will index partial words. "citrus" and "citruspers" will share some partial words as seen below image

Hence, searching for "citrus" will also find products with "citruspers".

Regards,

LaurensGoedel commented 11 months ago

Hi @rbayet

Thank you for the fast and really extensive response! I have changed some settings and attributes and the autocomplete now shows more results!

However the resultpage itself, still only shows one product. In Magento i have checked the settings for "Catalog search" > "Search Engine" and it is set to "ElasticSuite".

Any suggestions where to search?

romainruaud commented 11 months ago

Hi @LaurensGoedel

first, try to enable this setting : Elasticsuite > Search Relevance > Exact matching configuration > Use default analyzer in exact matching filter query.

If this does not work, try to also enable the Elasticsuite > Search Relevance > Spellchecking configuration > Term Vectors Configuration > [Experimental] Use edge ngram analyzer in term vectors

LaurensGoedel commented 11 months ago

Hi @romainruaud,

We have updated to 2.10.18.1 and after that changed above settings. However this seems not to change any results.

Attribute "name" is set to "standard_edge_ngram", "Use this field for span queries" is also set to yes.

On the Elasticsuite configuration we have the following settings: Phrase Match Configuration > Enable Boost on Phrase Match > Yes Span Match Configuration > Enable Boost on Span Match > Yes Exact Match Configuration > [Experimental] Use default analyzer in exact matching filter query > Yes Search Fuzziness Configuration > Enable Fuzziness > Yes (value auto, prefix 0) Term Vectors Configuration > all 3 options to yes Thesaurus Configuration > Max Allowed Rewrites > 2

But we can't seems to get the partial match working.

I have tried the demo (https://demo.magento-elastic-suite.io/), but there seems to be the same issue. For example product Selena Pants (https://demo.magento-elastic-suite.io/index.php/selena-pants.html) if i search for "sele", the product won't show up.

vahonc commented 11 months ago

Hello @LaurensGoedel,

Most likely, our demo site does not use the latest version of ElasticSuite, and it is also possible that the experimental settings are not active there. But we will try to look at your test case in more detail.

BR, Vadym

gkopec commented 8 months ago

@vahonc did you find answer for "sele"'s issue?