Skip to content

Commit f3dbabd

Browse files
authored
Merge branch 'develop' into feature/MAGE-571
2 parents c4f3b1b + fe698b1 commit f3dbabd

19 files changed

+57
-36
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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGE LOG
22

3+
## 3.10.1
4+
5+
### Bug Fixes
6+
- Add caching on category name lookup (scoped by store) to fix slowness in indexing.
7+
- Prevent loss of synonyms while copying from tmp index during Indexing in Algolia Dashboard.
38

49
## 3.10.0
510

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 to 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: 1 addition & 1 deletion
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)

0 commit comments

Comments
 (0)