algoliasearch-magento-2 icon indicating copy to clipboard operation
algoliasearch-magento-2 copied to clipboard

Fix saving and loading data by the wrong cache key for the popular queries

Open abramchukm opened this issue 2 years ago • 1 comments

Summary Currently, the implementation of the method \Algolia\AlgoliaSearch\Helper\Entity\SuggestionHelper::getPopularQueries is incorrect, because it caches the data by a cache tag $popularQueriesCacheId which leads to the wrong popular queries search results on different stores. Example Let's take a look at the next example. You have a store with ID 1 and it has suits, pants popular query. Store with ID 2 has Salon de jardin popular query. After the cache is cleaned, you visit a store with ID 1, and you have a correct popular query search result (here, the result is cached by tag, specified in the $popularQueriesCacheId property). But, for the store with ID 2 it won't be a Salon de jardin anymore, but suits, pants which is incorrect behavior. Result A fix adds a store_id to the cache tag. This will provide correct results for the requested store and the situation described above will be fixed.

abramchukm avatar Oct 03 '22 14:10 abramchukm

Thank you for @abramchukm We will take a look at this

rachel-trott avatar Oct 04 '22 17:10 rachel-trott

@abramchukm Thank you for the PR. We have brought it in as part of this, https://github.com/algolia/algoliasearch-magento-2/pull/1267

rachel-trott avatar Nov 08 '22 14:11 rachel-trott