Skip to content

Commit 857be4c

Browse files
authored
Merge pull request #1311 from algolia/feat/MAGE-583
HOTFIX FOR 3.10.0 - Feat/mage 583
2 parents 943eba9 + 7064bc5 commit 857be4c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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('

0 commit comments

Comments
 (0)