Skip to content

Commit b0fc4de

Browse files
authored
Merge pull request #1315 from algolia/develop
Release/3.10.1 Hotfix
2 parents a3cee3d + 2788ec8 commit b0fc4de

19 files changed

+71
-42
lines changed

Block/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ public function getConfiguration()
309309
'relevance' => __('Relevance'),
310310
'categories' => __('Categories'),
311311
'products' => __('Products'),
312+
'suggestions' => __('Suggestions'),
312313
'searchBy' => __('Search by'),
313314
'searchForFacetValuesPlaceholder' => __('Search for other ...'),
314315
'showMore' => __('Show more products'),

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# CHANGE LOG
22

3+
## 3.10.1
4+
5+
### UPDATES
6+
- Added recommended js version in readme file.
7+
8+
### Bug Fixes
9+
- Add caching on category name lookup (scoped by store) to fix slowness in indexing.
10+
- Prevent loss of synonyms while copying from tmp index during Indexing in Algolia Dashboard.
11+
- Fixed the translation issue of labels in Algolia autocomplete dropdown
12+
- Ensured compatibility of the extension with PHP 7.4
13+
- Resolved the deployment issue related to prefixing Magento database tables
14+
315

416
## 3.10.0
517

Helper/Entity/CategoryHelper.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class CategoryHelper
5050
protected $categoryRepository;
5151

5252
protected $isCategoryVisibleInMenuCache;
53+
protected $coreCategories;
5354
protected $idColumn;
5455
protected $categoryAttributes;
5556
protected $rootCategoryId = -1;
@@ -548,7 +549,12 @@ public function isCategoryVisibleInMenu($categoryId, $storeId)
548549
*/
549550
public function getCoreCategories($filterNotIncludedCategories = true, $storeId = null)
550551
{
551-
$key = $filterNotIncludedCategories ? 'filtered' : 'non_filtered';
552+
// Cache category look up by store scope
553+
$key = ($filterNotIncludedCategories ? 'filtered' : 'non_filtered') . "-$storeId";
554+
555+
if (isset($this->coreCategories[$key])) {
556+
return $this->coreCategories[$key];
557+
}
552558

553559
$collection = $this->categoryCollectionFactory->create()
554560
->distinct(true)
@@ -562,14 +568,14 @@ public function getCoreCategories($filterNotIncludedCategories = true, $storeId
562568
$collection->addAttributeToFilter('include_in_menu', '1');
563569
}
564570

565-
$coreCategories[$key] = [];
571+
$this->coreCategories[$key] = [];
566572

567573
/** @var \Magento\Catalog\Model\Category $category */
568574
foreach ($collection as $category) {
569-
$coreCategories[$key][$category->getId()] = $category;
575+
$this->coreCategories[$key][$category->getId()] = $category;
570576
}
571577

572-
return $coreCategories[$key];
578+
return $this->coreCategories[$key];
573579
}
574580

575581
/**

Helper/Entity/ProductHelper.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,8 @@ public function setSettings($indexName, $indexNameTmp, $storeId, $saveToTmpIndic
485485
} else {
486486
foreach ($sortingIndices as $values) {
487487
$replicaName = $values['name'];
488-
array_unshift($customRanking,$values['ranking'][0]);
489-
$replicaSetting['customRanking'] = $customRanking;
488+
array_unshift($customRanking,$values['ranking'][0]);
489+
$replicaSetting['customRanking'] = $customRanking;
490490
$this->algoliaHelper->setSettings($replicaName, $replicaSetting, false, false);
491491
$this->logger->log('Setting settings to "' . $replicaName . '" replica.');
492492
$this->logger->log('Settings: ' . json_encode($replicaSetting));
@@ -502,6 +502,15 @@ public function setSettings($indexName, $indexNameTmp, $storeId, $saveToTmpIndic
502502
// $this->deleteUnusedReplicas($indexName, $replicas, $setReplicasTaskId);
503503

504504
if ($saveToTmpIndicesToo === true) {
505+
try {
506+
$this->algoliaHelper->copySynonyms($indexName, $indexNameTmp);
507+
$this->logger->log('
508+
Copying synonyms from production index to TMP one to not erase them with the index move.
509+
');
510+
} catch (AlgoliaException $e) {
511+
$this->logger->error('Error encountered while copying synonyms: ' . $e->getMessage());
512+
}
513+
505514
try {
506515
$this->algoliaHelper->copyQueryRules($indexName, $indexNameTmp);
507516
$this->logger->log('

Observer/Insights/CheckoutCartProductAddAfter.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ class CheckoutCartProductAddAfter implements ObserverInterface
1818
{
1919

2020
/** @var Data */
21-
protected Data $dataHelper;
21+
protected $dataHelper;
2222

2323
/** @var InsightsHelper */
24-
protected InsightsHelper $insightsHelper;
24+
protected $insightsHelper;
2525

2626
/** @var LoggerInterface */
27-
protected LoggerInterface $logger;
27+
protected $logger;
2828

2929
/** @var ConfigHelper */
30-
protected ConfigHelper $configHelper;
30+
protected $configHelper;
3131

3232
/** @var PersonalizationHelper */
33-
private PersonalizationHelper $personalizationHelper;
33+
protected $personalizationHelper;
3434

3535
/** @var SessionManagerInterface */
36-
protected SessionManagerInterface $coreSession;
36+
protected $coreSession;
3737

3838
/**
3939
* @param Data $dataHelper

Observer/Insights/CheckoutCartProductAddBefore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class CheckoutCartProductAddBefore implements ObserverInterface
1010
{
1111
/** @var SessionManagerInterface */
12-
protected SessionManagerInterface $coreSession;
12+
protected $coreSession;
1313

1414
/**
1515
* @param SessionManagerInterface $coreSession

Observer/Insights/CheckoutOnepageControllerSuccessAction.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
class CheckoutOnepageControllerSuccessAction implements ObserverInterface
1717
{
1818
/** @var Data */
19-
protected Data $dataHelper;
19+
protected $dataHelper;
2020

2121
/** @var InsightsHelper */
22-
protected InsightsHelper $insightsHelper;
22+
protected $insightsHelper;
2323

2424
/** @var OrderFactory */
25-
protected OrderFactory $orderFactory;
25+
protected $orderFactory;
2626

2727
/** @var LoggerInterface */
28-
protected LoggerInterface $logger;
28+
protected $logger;
2929

3030
/** @var ConfigHelper */
31-
protected ConfigHelper $configHelper;
31+
protected $configHelper;
3232

3333
/**
3434
* @param Data $dataHelper

Observer/Insights/CustomerLogin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class CustomerLogin implements ObserverInterface
1111
{
1212

1313
/** @var InsightsHelper */
14-
protected InsightsHelper $insightsHelper;
14+
protected $insightsHelper;
1515

1616
/**
1717
* @param InsightsHelper $insightsHelper

Observer/Insights/WishlistProductAddAfter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@
1515
class WishlistProductAddAfter implements ObserverInterface
1616
{
1717
/** @var Data */
18-
protected Data $dataHelper;
18+
protected $dataHelper;
1919

2020
/** @var PersonalizationHelper */
21-
protected PersonalizationHelper $personalisationHelper;
21+
protected $personalisationHelper;
2222

2323
/** @var InsightsHelper */
24-
protected InsightsHelper $insightsHelper;
24+
protected $insightsHelper;
2525

2626
/** @var LoggerInterface */
27-
protected LoggerInterface $logger;
27+
protected $logger;
2828

2929
/**
3030
* CheckoutCartProductAddAfter constructor.

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Algolia Search for Magento 2
22
==================
33

4-
![Latest version](https://img.shields.io/badge/latest-3.10.0-green)
4+
![Latest version](https://img.shields.io/badge/latest-3.10.1-green)
55
![Magento 2](https://img.shields.io/badge/Magento-2.4.x-orange)
66

77
![PHP](https://img.shields.io/badge/PHP-8.1,7.4-blue)
@@ -89,12 +89,13 @@ These libraries are here to help add to your customisation but because the exten
8989
#### The Extension JS Bundle
9090
Knowing the version of the library will help you understand what is available in these libraries for you to leverage in terms of customisation. This table will help you determine which documentation to reference when you start working on your customisation.
9191

92-
| Extension Version | autocomplete.js | instantsearch.js | search-insights.js |
93-
|-------------------|-------------------------------------------------------------------| --- | --- |
94-
| v1.x | [0.26.0](https://github.com/algolia/autocomplete.js/tree/v0.26.0) | [2.10.2](https://github.com/algolia/instantsearch.js/tree/v2.10.2) | [0.0.14](https://cdn.jsdelivr.net/npm/[email protected]) |
95-
| v2.x | [0.38.0](https://github.com/algolia/autocomplete.js/tree/v0.38.0) | [4.7.2](https://github.com/algolia/instantsearch.js/tree/v4.7.2) | [1.4.0](https://github.com/algolia/search-insights.js/tree/v1.4.0) |
96-
| v3.x | [0.38.0](https://github.com/algolia/autocomplete.js/tree/v0.38.0) | [4.15.0](https://github.com/algolia/instantsearch.js/tree/v4.15.0) | [1.7.1](https://github.com/algolia/search-insights.js/tree/v1.7.1) |
97-
| v3.8.x | [1.6.3](https://github.com/algolia/autocomplete.js/tree/v1.6.3) | [4.41.0](https://github.com/algolia/instantsearch.js/tree/v4.41.0) | [1.7.1](https://github.com/algolia/search-insights.js/tree/v1.7.1) |
92+
| Extension Version | autocomplete.js | instantsearch.js | search-insights.js | recommend.js |
93+
|-------------------|-------------------------------------------------------------------| --- | --- | --- |
94+
| v1.x | [0.26.0](https://github.com/algolia/autocomplete.js/tree/v0.26.0) | [2.10.2](https://github.com/algolia/instantsearch.js/tree/v2.10.2) | [0.0.14](https://cdn.jsdelivr.net/npm/[email protected]) | NA |
95+
| v2.x | [0.38.0](https://github.com/algolia/autocomplete.js/tree/v0.38.0) | [4.7.2](https://github.com/algolia/instantsearch.js/tree/v4.7.2) | [1.4.0](https://github.com/algolia/search-insights.js/tree/v1.4.0) | NA |
96+
| v3.x | [0.38.0](https://github.com/algolia/autocomplete.js/tree/v0.38.0) | [4.15.0](https://github.com/algolia/instantsearch.js/tree/v4.15.0) | [1.7.1](https://github.com/algolia/search-insights.js/tree/v1.7.1) | NA |
97+
| v3.9.1 | [1.6.3](https://github.com/algolia/autocomplete.js/tree/v1.6.3) | [4.41.0](https://github.com/algolia/instantsearch.js/tree/v4.41.0) | [1.7.1](https://github.com/algolia/search-insights.js/tree/v1.7.1) | [1.5.0](https://github.com/algolia/recommend/tree/v1.5.0) |
98+
| v3.10.x | [1.6.3](https://github.com/algolia/autocomplete.js/tree/v1.6.3) | [4.41.0](https://github.com/algolia/instantsearch.js/tree/v4.41.0) | [1.7.1](https://github.com/algolia/search-insights.js/tree/v1.7.1) | [1.8.0](https://github.com/algolia/recommend/tree/v1.8.0) |
9899

99100
The autocomplete and instantsearch libraries are accessible in the `algoliaBundle` global. This bundle is a prepackage javascript file that contains it's dependencies. What is included in this bundle can be seen here:
100101

0 commit comments

Comments
 (0)