Skip to content

Commit 1cd44fb

Browse files
committed
Merge branch 'release/3.15.0-dev' into epic/MAGE-997
2 parents 3e8ed32 + d138d2d commit 1cd44fb

File tree

114 files changed

+7391
-3573
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+7391
-3573
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Algolia\AlgoliaSearch\Api\IndexBuilder;
4+
5+
interface IndexBuilderInterface
6+
{
7+
public function buildIndex(int $storeId, ?array $entityIds, ?array $options): void;
8+
9+
public function buildIndexFull(int $storeId, ?array $options): void;
10+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace Algolia\AlgoliaSearch\Api\IndexBuilder;
4+
5+
interface UpdatableIndexBuilderInterface extends IndexBuilderInterface
6+
{
7+
public function buildIndexList(int $storeId, ?array $entityIds, ?array $options): void;
8+
}

Block/Adminhtml/LandingPage/SearchConfiguration.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ class SearchConfiguration extends \Magento\Backend\Block\Template
2222
/** @var Data */
2323
private $coreHelper;
2424

25-
/** @var int */
26-
protected $planLevel;
27-
2825
/**
2926
* @param Context $context
3027
* @param SessionManagerInterface $backendSession

Block/Configuration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ public function getConfiguration()
247247
'indexName' => $coreHelper->getBaseIndexName(),
248248
'apiKey' => $algoliaHelper->generateSearchSecuredApiKey(
249249
$config->getSearchOnlyAPIKey(),
250-
$attributesToFilter
250+
$attributesToFilter,
251+
$this->getStoreId()
251252
),
252253
'attributeFilter' => $attributesToFilter,
253254
'facets' => $facets,

CHANGELOG.md

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

3+
## 3.15.0-beta.1
4+
5+
## Updates
6+
- Added support for Multi-Application IDs
7+
8+
## 3.14.3
9+
10+
### Updates
11+
- Updated PHP client version in the composer file
12+
- Tests: added new integration scenarios including multi-stores ones.
13+
14+
### Bug Fixes
15+
- Fixed landing page typing error
16+
- Improved query method for alternate root categories - Thank you @igorfigueiredogen
17+
- Fixed an error where a missing prefix can throw errors with strong types added to ConfigHelper
18+
- Fixed an error where stale cache data was preventing ranking applied on replica
19+
- Fixed reindexing issue with NeuralSearch
20+
- Tests : Fixed current integration tests
21+
322
## 3.14.2
423

524
### Updates

Console/Command/ReplicaSyncCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Algolia\AlgoliaSearch\Exceptions\ExceededRetriesException;
1212
use Algolia\AlgoliaSearch\Helper\Entity\ProductHelper;
1313
use Algolia\AlgoliaSearch\Service\StoreNameFetcher;
14-
use Magento\Framework\App\State;
14+
use Magento\Framework\App\State as AppState;
1515
use Magento\Framework\Console\Cli;
1616
use Magento\Framework\Exception\LocalizedException;
1717
use Magento\Framework\Exception\NoSuchEntityException;
@@ -27,12 +27,12 @@ public function __construct(
2727
protected ReplicaManagerInterface $replicaManager,
2828
protected ProductHelper $productHelper,
2929
protected StoreManagerInterface $storeManager,
30-
State $state,
30+
AppState $appState,
3131
StoreNameFetcher $storeNameFetcher,
3232
?string $name = null
3333
)
3434
{
35-
parent::__construct($state, $storeNameFetcher, $name);
35+
parent::__construct($appState, $storeNameFetcher, $name);
3636
}
3737

3838
protected function getReplicaCommandName(): string

Controller/Adminhtml/Landingpage/Save.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,15 @@ public function execute()
107107
$data['configuration'] = $data['algolia_configuration'];
108108
if ($this->configHelper->isCustomerGroupsEnabled($data['store_id'])) {
109109
$configuration = json_decode($data['algolia_configuration'], true);
110-
$priceConfig = $configuration['price'.$data['price_key']];
111-
$customerGroups = $this->customerGroupCollectionFactory->create();
112-
$store = $this->storeManager->getStore($data['store_id']);
113-
$baseCurrencyCode = $store->getBaseCurrencyCode();
114-
foreach ($customerGroups as $group) {
115-
$groupId = (int) $group->getData('customer_group_id');
116-
$configuration['price.'.$baseCurrencyCode.'.group_'.$groupId] = $priceConfig;
110+
if (isset($configuration['price'.$data['price_key']])) {
111+
$priceConfig = $configuration['price'.$data['price_key']];
112+
$customerGroups = $this->customerGroupCollectionFactory->create();
113+
$store = $this->storeManager->getStore($data['store_id']);
114+
$baseCurrencyCode = $store->getBaseCurrencyCode();
115+
foreach ($customerGroups as $group) {
116+
$groupId = (int) $group->getData('customer_group_id');
117+
$configuration['price.'.$baseCurrencyCode.'.group_'.$groupId] = $priceConfig;
118+
}
117119
}
118120
$data['configuration'] = json_encode($configuration);
119121
}

Controller/Adminhtml/Reindex/Save.php

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,47 +9,27 @@
99
use Algolia\AlgoliaSearch\Exception\UnknownSkuException;
1010
use Algolia\AlgoliaSearch\Helper\Data as DataHelper;
1111
use Algolia\AlgoliaSearch\Helper\Entity\ProductHelper;
12+
use Algolia\AlgoliaSearch\Service\Product\IndexBuilder as ProductIndexBuilder;
1213
use Magento\Backend\App\Action\Context;
1314
use Magento\Catalog\Api\ProductRepositoryInterface;
1415
use Magento\Framework\Controller\ResultFactory;
16+
use Magento\Framework\Exception\LocalizedException;
1517
use Magento\Framework\Exception\NoSuchEntityException;
1618
use Magento\Store\Model\StoreManagerInterface;
1719

1820
class Save extends \Magento\Backend\App\Action
1921
{
2022
public const MAX_SKUS = 10;
2123

22-
/** @var ProductRepositoryInterface */
23-
protected $productRepository;
24-
25-
/** @var StoreManagerInterface */
26-
protected $storeManager;
27-
28-
/** @var DataHelper */
29-
protected $dataHelper;
30-
31-
/** @var ProductHelper */
32-
protected $productHelper;
33-
34-
/**
35-
* @param Context $context
36-
* @param ProductRepositoryInterface $productRepository
37-
* @param StoreManagerInterface $storeManager
38-
* @param DataHelper $dataHelper
39-
* @param ProductHelper $productHelper
40-
*/
4124
public function __construct(
42-
Context $context,
43-
ProductRepositoryInterface $productRepository,
44-
StoreManagerInterface $storeManager,
45-
DataHelper $dataHelper,
46-
ProductHelper $productHelper
25+
protected Context $context,
26+
protected ProductRepositoryInterface $productRepository,
27+
protected StoreManagerInterface $storeManager,
28+
protected DataHelper $dataHelper,
29+
protected ProductHelper $productHelper,
30+
protected ProductIndexBuilder $productIndexBuilder
4731
) {
4832
parent::__construct($context);
49-
$this->storeManager = $storeManager;
50-
$this->dataHelper = $dataHelper;
51-
$this->productHelper = $productHelper;
52-
$this->productRepository = $productRepository;
5333
}
5434

5535
/**
@@ -131,6 +111,7 @@ public function execute()
131111
* @param $stores
132112
* @return void
133113
* @throws NoSuchEntityException
114+
* @throws LocalizedException
134115
*/
135116
protected function checkAndReindex($product, $stores)
136117
{
@@ -220,7 +201,7 @@ protected function checkAndReindex($product, $stores)
220201
$productIds = [$product->getId()];
221202
$productIds = array_merge($productIds, $this->productHelper->getParentProductIds($productIds));
222203

223-
$this->dataHelper->rebuildStoreProductIndex($storeId, $productIds);
204+
$this->productIndexBuilder->buildIndexList($storeId, $productIds);
224205
$this->messageManager->addSuccessMessage(
225206
__(
226207
'The Product "%1" (%2) has been reindexed for store "%3 / %4 / %5".',

Exception/DiagnosticsException.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Algolia\AlgoliaSearch\Exception;
4+
5+
use Magento\Framework\Exception\LocalizedException;
6+
7+
class DiagnosticsException extends LocalizedException
8+
{
9+
10+
}

Helper/AdapterHelper.php

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,23 @@
33
namespace Algolia\AlgoliaSearch\Helper;
44

55
use Algolia\AlgoliaSearch\Helper\Adapter\FiltersHelper;
6-
use Algolia\AlgoliaSearch\Helper\Data as AlgoliaDataHelper;
6+
use Algolia\AlgoliaSearch\Service\AlgoliaCredentialsManager;
7+
use Algolia\AlgoliaSearch\Service\Product\BackendSearch;
78
use Magento\CatalogSearch\Helper\Data as CatalogSearchDataHelper;
89

910
class AdapterHelper
1011
{
1112
public const INSTANTSEARCH_ORDER_PARAM = 'sortBy';
1213
public const BACKEND_ORDER_PARAM = 'product_list_order';
1314

14-
/** @var CatalogSearchDataHelper */
15-
private $catalogSearchHelper;
16-
17-
/** @var AlgoliaDataHelper */
18-
private $algoliaHelper;
19-
20-
/** @var FiltersHelper */
21-
private $filtersHelper;
22-
23-
/** @var ConfigHelper */
24-
private $configHelper;
25-
26-
/**
27-
* @param CatalogSearchDataHelper $catalogSearchHelper
28-
* @param AlgoliaDataHelper $algoliaHelper
29-
* @param FiltersHelper $filtersHelper
30-
* @param ConfigHelper $configHelper
31-
*/
3215
public function __construct(
33-
CatalogSearchDataHelper $catalogSearchHelper,
34-
AlgoliaDataHelper $algoliaHelper,
35-
FiltersHelper $filtersHelper,
36-
ConfigHelper $configHelper
37-
) {
38-
$this->catalogSearchHelper = $catalogSearchHelper;
39-
$this->algoliaHelper = $algoliaHelper;
40-
$this->filtersHelper = $filtersHelper;
41-
$this->configHelper = $configHelper;
42-
}
16+
protected CatalogSearchDataHelper $catalogSearchHelper,
17+
protected BackendSearch $backendSearch,
18+
protected FiltersHelper $filtersHelper,
19+
protected ConfigHelper $configHelper,
20+
protected AlgoliaCredentialsManager $algoliaCredentialsManager
21+
)
22+
{}
4323

4424
/**
4525
* Get search result from Algolia
@@ -72,7 +52,7 @@ public function getDocumentsFromAlgolia()
7252
}
7353
}
7454

75-
return $this->algoliaHelper->getSearchResult($algoliaQuery, $storeId, $searchParams, $targetedIndex);
55+
return $this->backendSearch->getSearchResult($algoliaQuery, $storeId, $searchParams, $targetedIndex);
7656
}
7757

7858
/**
@@ -142,8 +122,7 @@ public function isAllowed()
142122
$storeId = $this->getStoreId();
143123

144124
return
145-
$this->configHelper->getApplicationID($storeId)
146-
&& $this->configHelper->getAPIKey($storeId)
125+
$this->algoliaCredentialsManager->checkCredentials($storeId)
147126
&& $this->configHelper->isEnabledFrontEnd($storeId)
148127
&& $this->configHelper->makeSeoRequest($storeId);
149128
}

0 commit comments

Comments
 (0)