Skip to content

Commit f67449c

Browse files
committed
MC-18948: Switch default search engine from MySQL to ElasticSearch
- fix admin notice
1 parent 2b9e36f commit f67449c

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

app/code/Magento/CatalogSearch/Setup/Patch/Data/MySQLSearchRemovalNotification.php

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,45 @@
77

88
namespace Magento\CatalogSearch\Setup\Patch\Data;
99

10+
use Magento\Framework\App\Config\ScopeConfigInterface;
11+
use Magento\Framework\Notification\NotifierInterface;
12+
use Magento\Framework\Setup\Patch\DataPatchInterface;
13+
1014
/**
1115
* Implementation of the notification about MySQL search being removed.
1216
*
1317
* @see \Magento\ElasticSearch
1418
*/
15-
class MySQLSearchRemovalNotification implements \Magento\Framework\Setup\Patch\DataPatchInterface
19+
class MySQLSearchRemovalNotification implements DataPatchInterface
1620
{
1721
/**
18-
* @var \Magento\Framework\Search\EngineResolverInterface
22+
* @var NotifierInterface
1923
*/
20-
private $searchEngineResolver;
24+
private $notifier;
2125

2226
/**
23-
* @var \Magento\Framework\Notification\NotifierInterface
27+
* @var ScopeConfigInterface
2428
*/
25-
private $notifier;
29+
private $scopeConfig;
2630

2731
/**
28-
* @param \Magento\Framework\Search\EngineResolverInterface $searchEngineResolver
29-
* @param \Magento\Framework\Notification\NotifierInterface $notifier
32+
* @param NotifierInterface $notifier
33+
* @param ScopeConfigInterface $scopeConfig
3034
*/
3135
public function __construct(
32-
\Magento\Framework\Search\EngineResolverInterface $searchEngineResolver,
33-
\Magento\Framework\Notification\NotifierInterface $notifier
36+
NotifierInterface $notifier,
37+
ScopeConfigInterface $scopeConfig
3438
) {
35-
$this->searchEngineResolver = $searchEngineResolver;
3639
$this->notifier = $notifier;
40+
$this->scopeConfig = $scopeConfig;
3741
}
3842

3943
/**
4044
* @inheritdoc
4145
*/
4246
public function apply()
4347
{
44-
if ($this->searchEngineResolver->getCurrentSearchEngine() === 'mysql') {
48+
if ($this->scopeConfig->getValue('catalog/search/engine') === 'mysql') {
4549
$message = <<<MESSAGE
4650
Catalog Search is currently configured to use the MySQL engine, which has been deprecated and removed. Migrate to one of
4751
the Elasticsearch engines to ensure there are no service interruptions.

0 commit comments

Comments
 (0)