Smile-SA / elasticsuite

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

Thesaurus issues #2809

Closed TectonicKestrel closed 1 year ago

TectonicKestrel commented 1 year ago

I am using the thesaurus synonyms feature to allow customers to search for a old SKU, but find the new product. Sometimes my SKU has to change and i have a replacement product which has the same/similar product title.

EDIT: I have noticed that my magento2_default_thesaurus index is blank. I assume this is the cause, but why isnt my thesaurus index containing data? I have a few other synonym entries too along with some expansions.

I found the following in my elasticsearch.log. It appears it deletes the index as soon as it creates it?

[2022-12-31T17:11:35,209][INFO ][o.e.c.m.MetadataCreateIndexService] [my-hostname] [magento2_default_thesaurus_20221231_171135] creating index, cause [api], templates [], shards [1]/[0] [2022-12-31T17:11:35,244][INFO ][o.e.c.r.a.AllocationService] [my-hostname] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[magento2_default_thesaurus_20221231_171135][0]]]). [2022-12-31T17:11:35,284][INFO ][o.e.c.m.MetadataDeleteIndexService] [my-hostname] [magento2_default_thesaurus_20221231_131530/GWWcmV89S9i_mFV2iIjvqQ] deleting index [2022-12-31T17:15:28,783][INFO ][o.e.c.m.MetadataCreateIndexService] [my-hostname] [magento2_default_thesaurus_20221231_171528] creating index, cause [api], templates [], shards [1]/[0] [2022-12-31T17:15:28,817][INFO ][o.e.c.r.a.AllocationService] [my-hostname] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[magento2_default_thesaurus_20221231_171528][0]]]). [2022-12-31T17:15:28,858][INFO ][o.e.c.m.MetadataDeleteIndexService] [my-hostname] [magento2_default_thesaurus_20221231_171135/QZ99k1JSSsuETMV88fLhlQ] deleting index

Preconditions

Magento Version : 2.4.5-p1 CE

ElasticSuite Version : 2.10.12.1

Environment : Production

Third party modules : AKP_CSP - Allow custom CSP rules ClickSavePrint_CustomNoRoute - My own module to turn everything after the last "/" into a search query when no product is found Fooman_Connect Fooman_ConnectLicenseSub Klaviyo_Reclaim Litespeed_Litemage MagePal_Core MagePal_GmailSmtpApp MageSuite_Magepack MageVision_FreeShippingAdmin Magefan_AdminUserGuide Magefan_Community Magefan_Blog Magefan_BlogGraphQl Magefan_GoogleShoppingFeed Magefan_WysiwygAdvanced Mageplaza_Core Mageplaza_DeleteOrders Mageplaza_Search Mageplaza_Smtp OlegKoval_RegenerateUrlRewrites SITC_Sinchimport - product import plugin Smartwave_Core Smartwave_Dailydeals Smartwave_Filterproducts Smartwave_Megamenu Smartwave_Porto Smartwave_Socialfeeds Smile_ElasticsuiteAdminNotification Smile_ElasticsuiteCore Smile_ElasticsuiteCatalog Smile_ElasticsuiteCatalogGraphQl Smile_ElasticsuiteCatalogRule Smile_ElasticsuiteCatalogOptimizer Smile_ElasticsuiteTracker Smile_ElasticsuiteThesaurus Smile_ElasticsuiteSwatches Smile_ElasticsuiteIndices Smile_ElasticsuiteAnalytics Smile_ElasticsuiteVirtualCategory Ssx_RemoveElasticSuiteNotification StripeIntegration_Payments

Steps to reproduce

  1. Add synonym including old SKU, new SKU, unique part of product name/title
  2. Search for old SKU

Expected result

  1. Find correct product

Actual result

  1. No products found/only incorrect products found
vahonc commented 1 year ago

Hello @alexsmith2709,

We need more details for a better understanding of your issue.

EDIT: I have noticed that my magento2_default_thesaurus index is blank. I assume this is the cause, but why isnt my thesaurus index containing data? I have a few other synonym entries too along with some expansions.

Please clarify what exactly you mean by saying that your index is "blank". To do this, provide the output of this command:

curl http://localhost:9200/_cat/indices?v

so that we can understand it better. If you are worried that the Thesaurus index contains 0 documents, then this is normal, since the index contains only settings.

Also, provide us with your Thesaurus index settings, to rich this you can use Magento BO, go to Elasticsuite -> Indices, select your index, and then click on View Settings:

Screenshot from 2023-01-04 12-01-08

BR, Vadym

TectonicKestrel commented 1 year ago

so that we can understand it better. If you are worried that the Thesaurus index contains 0 documents, then this is normal, since the index contains only settings.

Ok, yes it contains 0 documents.

Output of curl http://localhost:9200/_cat/indices?v: { "0": { "health": "green", "status": "open", "index": ".geoip_databases", "uuid": "clKasuO8QeC-F01CnczO2A", "pri": "1", "rep": "0", "docs.count": "0", "docs.deleted": "0", "store.size": "249b", "pri.store.size": "249b" }, "1": { "health": "green", "status": "open", "index": ".security-7", "uuid": "XYFIVpyNT3aSxmQ4IMLYug", "pri": "1", "rep": "0", "docs.count": "7", "docs.deleted": "0", "store.size": "25.7kb", "pri.store.size": "25.7kb" }, "2": { "health": "green", "status": "open", "index": "magento2_default_thesaurus_20230102_164714", "uuid": "53sR3X_ERZSufqZ6HL9_yQ", "pri": "1", "rep": "0", "docs.count": "0", "docs.deleted": "0", "store.size": "226b", "pri.store.size": "226b" }, "3": { "health": "green", "status": "open", "index": "magento2_default_tracking_log_event_202212", "uuid": "8jDcctmsT86hl62lVVqvug", "pri": "1", "rep": "0", "docs.count": "737", "docs.deleted": "0", "store.size": "781.3kb", "pri.store.size": "781.3kb" }, "4": { "health": "green", "status": "open", "index": "magento2_default_tracking_log_event_202301", "uuid": "kLSKmSFoTJSXylKsiKMWoA", "pri": "1", "rep": "0", "docs.count": "3", "docs.deleted": "0", "store.size": "31.7kb", "pri.store.size": "31.7kb" }, "5": { "health": "green", "status": "open", "index": "magento2_default_catalog_product_20230102_164518", "uuid": "bkvtR0yfT3-0F5R5ypuOlQ", "pri": "1", "rep": "0", "docs.count": "107800", "docs.deleted": "2845", "store.size": "1.1gb", "pri.store.size": "1.1gb" }, "6": { "health": "green", "status": "open", "index": "magento2_default_tracking_log_session_202301", "uuid": "z33GWDn4SreHzOKO3lFZWQ", "pri": "1", "rep": "0", "docs.count": "1", "docs.deleted": "0", "store.size": "7.2kb", "pri.store.size": "7.2kb" }, "7": { "health": "green", "status": "open", "index": "magento2_default_catalog_category_20230102_164714", "uuid": "GwLDzON0RraGGCm9EfPl3A", "pri": "1", "rep": "0", "docs.count": "109", "docs.deleted": "0", "store.size": "126kb", "pri.store.size": "126kb" }, "8": { "health": "green", "status": "open", "index": "magento2_default_tracking_log_session_202212", "uuid": "CLNJoeNzTXOlgdbHyRcKaQ", "pri": "1", "rep": "0", "docs.count": "89", "docs.deleted": "4", "store.size": "65.6kb", "pri.store.size": "65.6kb" }, "9": { "health": "green", "status": "open", "index": "magento2_default_cms_page_20221205_174003", "uuid": "ESrHC_PmSWS0pW4cpwHkDg", "pri": "1", "rep": "0", "docs.count": "12", "docs.deleted": "0", "store.size": "594.7kb", "pri.store.size": "594.7kb" } }

Thesaurus settings: { ["routing"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): { ["allocation"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): { ["include"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): { "_tier_preference": "data_content" } } }, "refresh_interval": "180s", "number_of_shards": "1", "provided_name": "magento2_default_thesaurus_20230102_164714", "max_shingle_diff": "10", "creation_date": "1672678034921", ["requests"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): { ["cache"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): { "enable": "true" } }, ["analysis"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): { ["filter"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): { ["shingle"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): { "max_shingle_size": "10", "token_separator": "_", "type": "shingle", "output_false": "true" }, ["synonym"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): { "type": "synonym", ["synonyms"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): [ "printer_ink,ink,toner,printing_ink", "cat,cheetah,leopard,lion", "rhp301,101h030131,101h030130,101h030113,101h030101", "101h030401,101h030413,101h030430,101h030431,rhp304", "rhp305,no_305,305,101h030586,101h030561,hp_305", "101h030001,101h030013,101h030030,101h030031,rhp300", "101h030331,rhp303,101h030330", "002_01_sp07anxl,62xl_colour,hir62xlc,rhp62xl", "002_01_sp05anxl,62xl_black,hir62xlb,rhp62xl" ] }, ["type_filter"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): { "type": "keep_types", ["types"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): [ "SYNONYM" ] }, ["analyze_shingle"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): { "max_shingle_size": "10", "min_shingle_size": "2", "token_separator": "_", "output_unigrams": "false", "type": "shingle" }, ["expansion"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): { "type": "synonym", ["synonyms"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): [ "refill=>compatible,recharged,refilled,refills,remanufactured,replacement", "multipack=>multi_buy,multi_pack,multibuy,pack,set,set_of_4" ] } }, ["analyzer"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): { ["synonym"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): { ["filter"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): [ "lowercase", "asciifolding", "synonym", "type_filter", "shingle" ], "tokenizer": "whitespace" }, ["expansion"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): { ["filter"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): [ "lowercase", "asciifolding", "expansion", "type_filter", "shingle" ], "tokenizer": "whitespace" }, ["shingles"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): { ["filter"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): [ "lowercase", "asciifolding", "analyze_shingle" ], "tokenizer": "whitespace" } } }, "number_of_replicas": "0", "uuid": "53sR3X_ERZSufqZ6HL9_yQ", ["version"](https://my-domain.com/admin/smile_elasticsuite_indices/index/settings/name/magento2_default_thesaurus_20230102_164714/key/cce3fa0fa5707ef1d54a5f451b7c50b23578665b9ae9afffe5ed2380919c7c04/): { "created": "7170899" } }

vahonc commented 1 year ago

@alexsmith2709,

I have analyzed the settings of your thesaurus index and it looks like they are fine.

We have one hotfix for a similar problem reported by our customer. It's already merged into our dev branch and will be included in our next release. You could try to create a patch from this commit and test if this solution solves your problem.

BR, Vadym

TectonicKestrel commented 1 year ago

I have applied that patch and reindexed but still have some issues. As you can see i have the synonyms "002_01_sp05anxl,62xl_black,hir62xlb,rhp62xl". If i search for "002-01-sp05anxl" (old SKU, the module converted hyphens to underscores) none of the results are relevant. If i search for "RHP62XL" i get the expected result. "HIR62XLB" is the current SKU which when searching for does produce a result as expected. Is the problem now the hyphens? Is there anyway to fix that? Even searching for a partial old SKU of "sp05anxl" doesnt return relevant results. Other numerical synonyms now seem to be returning the relevant results

vahonc commented 1 year ago

@alexsmith2709,

I was not able to reproduce your issue on my test environment, including the patch that was mentioned in my previous comment.

Here are my steps for reproducing:

Screenshot from 2023-01-17 17-43-56

Screenshot from 2023-01-17 16-07-39

Screenshot from 2023-01-17 16-06-12

Screenshot from 2023-01-17 17-48-12

It looks like all is working as I expected or perhaps I smth missing...

Can you provide some screenshots from your environment?

BR, Vadym

TectonicKestrel commented 1 year ago

Hi @vahonc, This screenshot shows a search for the old SKU: search1

This screenshot shows a search for the current SKU: search2

As you can see, searching for the old SKU does not find the current SKU like i would expect given the synoyms i have used. The current SKU finds it as well as a related product.

The difference between what you have done and what my setup is, is that i no longer have a product with SKU 002-01-sp05anxl anymore, i expected with the synonyms i have setup for that to find my current SKU. This does work with old SKU's that i have setup which do not have hyphens in (tested alphanumeric characters).

romainruaud commented 1 year ago

I close this issue since we're not able to reproduce it by our side.

Best regards