Skip to content

Commit c9306b0

Browse files
committed
MAGE-986 Remove old replica methods replaced in 3.14
1 parent 151a317 commit c9306b0

File tree

2 files changed

+0
-153
lines changed

2 files changed

+0
-153
lines changed

Helper/ConfigHelper.php

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1957,109 +1957,6 @@ public function isDynamicFacetsEnabled(?int $storeId = null): bool
19571957
return $this->instantSearchConfig->isDynamicFacetsEnabled($storeId);
19581958
}
19591959

1960-
/**
1961-
* @param $originalIndexName
1962-
* @param $storeId
1963-
* @param $currentCustomerGroupId
1964-
* @param $attrs
1965-
* @return array
1966-
* @throws \Magento\Framework\Exception\LocalizedException
1967-
* @throws \Magento\Framework\Exception\NoSuchEntityException
1968-
* @deprecated This method has been deprecated and should no longer be used
1969-
* @see \Algolia\AlgoliaSearch\Service\Product\SortingTransformer
1970-
*/
1971-
public function getSortingIndices($originalIndexName, $storeId = null, $currentCustomerGroupId = null, $attrs = null)
1972-
{
1973-
if (!$attrs){
1974-
$attrs = $this->getSorting($storeId);
1975-
}
1976-
1977-
$currency = $this->getCurrencyCode($storeId);
1978-
$attributesToAdd = [];
1979-
foreach ($attrs as $key => $attr) {
1980-
$indexName = false;
1981-
$sortAttribute = false;
1982-
if ($this->isCustomerGroupsEnabled($storeId) && $attr['attribute'] === 'price') {
1983-
$websiteId = (int)$this->storeManager->getStore($storeId)->getWebsiteId();
1984-
$groupCollection = $this->groupCollection;
1985-
if (!is_null($currentCustomerGroupId)) {
1986-
$groupCollection->addFilter('customer_group_id', $currentCustomerGroupId);
1987-
}
1988-
foreach ($groupCollection as $group) {
1989-
$customerGroupId = (int)$group->getData('customer_group_id');
1990-
$excludedWebsites = $this->groupExcludedWebsiteRepository->getCustomerGroupExcludedWebsites($customerGroupId);
1991-
if (in_array($websiteId, $excludedWebsites)) {
1992-
continue;
1993-
}
1994-
$groupIndexNameSuffix = 'group_' . $customerGroupId;
1995-
$groupIndexName =
1996-
$originalIndexName . '_' . $attr['attribute'] . '_' . $groupIndexNameSuffix . '_' . $attr['sort'];
1997-
$groupSortAttribute = $attr['attribute'] . '.' . $currency . '.' . $groupIndexNameSuffix;
1998-
$newAttr = [];
1999-
$newAttr['name'] = $groupIndexName;
2000-
$newAttr['attribute'] = $attr['attribute'];
2001-
$newAttr['sort'] = $attr['sort'];
2002-
$newAttr['sortLabel'] = $attr['sortLabel'];
2003-
if (!array_key_exists('label', $newAttr) && array_key_exists('sortLabel', $newAttr)) {
2004-
$newAttr['label'] = $newAttr['sortLabel'];
2005-
}
2006-
$newAttr['ranking'] = [
2007-
$newAttr['sort'] . '(' . $groupSortAttribute . ')',
2008-
'typo',
2009-
'geo',
2010-
'words',
2011-
'filters',
2012-
'proximity',
2013-
'attribute',
2014-
'exact',
2015-
'custom',
2016-
];
2017-
$attributesToAdd[$newAttr['sort']][] = $newAttr;
2018-
}
2019-
} elseif ($attr['attribute'] === 'price') {
2020-
$indexName = $originalIndexName . '_' . $attr['attribute'] . '_' . 'default' . '_' . $attr['sort'];
2021-
$sortAttribute = $attr['attribute'] . '.' . $currency . '.' . 'default';
2022-
} else {
2023-
$indexName = $originalIndexName . '_' . $attr['attribute'] . '_' . $attr['sort'];
2024-
$sortAttribute = $attr['attribute'];
2025-
}
2026-
if ($indexName && $sortAttribute) {
2027-
$attrs[$key]['name'] = $indexName;
2028-
if (!array_key_exists('label', $attrs[$key]) && array_key_exists('sortLabel', $attrs[$key])) {
2029-
$attrs[$key]['label'] = $attrs[$key]['sortLabel'];
2030-
}
2031-
$attrs[$key]['ranking'] = [
2032-
$attr['sort'] . '(' . $sortAttribute . ')',
2033-
'typo',
2034-
'geo',
2035-
'words',
2036-
'filters',
2037-
'proximity',
2038-
'attribute',
2039-
'exact',
2040-
'custom',
2041-
];
2042-
}
2043-
}
2044-
$attrsToReturn = [];
2045-
if (count($attributesToAdd) > 0) {
2046-
foreach ($attrs as $key => $attr) {
2047-
if ($attr['attribute'] == 'price' && isset($attributesToAdd[$attr['sort']])) {
2048-
$attrsToReturn = array_merge($attrsToReturn, $attributesToAdd[$attr['sort']]);
2049-
} else {
2050-
$attrsToReturn[] = $attr;
2051-
}
2052-
}
2053-
}
2054-
if (count($attrsToReturn) > 0) {
2055-
return $attrsToReturn;
2056-
}
2057-
if (is_array($attrs)) {
2058-
return $attrs;
2059-
}
2060-
return [];
2061-
}
2062-
20631960
/***
20641961
* @param int|null $storeId
20651962
* @return array<string,<array<string, mixed>>>

Helper/Entity/ProductHelper.php

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -657,54 +657,4 @@ function($sort) {
657657
$sortingIndices
658658
);
659659
}
660-
661-
/**
662-
* Moving to ReplicaManager class
663-
* @param string $indexName
664-
* @param int $storeId
665-
* @param array|bool $sortingAttribute
666-
* @return void
667-
* @throws AlgoliaException
668-
* @throws ExceededRetriesException
669-
* @throws LocalizedException
670-
* @throws NoSuchEntityException
671-
* @throws \Exception
672-
* @deprecated This function will be removed in a future release
673-
* @see Algolia::AlgoliaSearch::Api::Product::ReplicaManagerInterface
674-
*/
675-
public function handlingReplica(string $indexName, int $storeId, array|bool $sortingAttribute = false): void
676-
{
677-
$sortingIndices = $this->configHelper->getSortingIndices($indexName, $storeId, null, $sortingAttribute);
678-
if ($this->configHelper->isInstantEnabled($storeId)) {
679-
$newReplicas = $this->decorateReplicasSetting($sortingIndices);
680-
681-
try {
682-
$currentSettings = $this->algoliaHelper->getSettings($indexName, $storeId);
683-
if (array_key_exists('replicas', $currentSettings)) {
684-
$oldReplicas = $currentSettings['replicas'];
685-
$replicasToDelete = array_diff($oldReplicas, $newReplicas);
686-
$this->algoliaHelper->setSettings(
687-
$indexName,
688-
['replicas' => $newReplicas],
689-
false,
690-
false,
691-
'',
692-
$storeId
693-
);
694-
$setReplicasTaskId = $this->algoliaHelper->getLastTaskId($storeId);
695-
$this->algoliaHelper->waitLastTask($storeId, $indexName, $setReplicasTaskId);
696-
if (count($replicasToDelete) > 0) {
697-
foreach ($replicasToDelete as $deletedReplica) {
698-
$this->algoliaHelper->deleteIndex($deletedReplica, $storeId);
699-
}
700-
}
701-
}
702-
} catch (AlgoliaException $e) {
703-
if ($e->getCode() !== 404) {
704-
$this->logger->log($e->getMessage());
705-
throw $e;
706-
}
707-
}
708-
}
709-
}
710660
}

0 commit comments

Comments
 (0)