Skip to content

Commit dad8bc7

Browse files
committed
MC-18332: Remove MySQL Search Engine
- fix static
1 parent 919ec63 commit dad8bc7

File tree

13 files changed

+67
-58
lines changed

13 files changed

+67
-58
lines changed

app/code/Magento/CatalogSearch/Model/Indexer/IndexStructure.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
use Magento\Framework\App\ObjectManager;
1010
use Magento\Framework\App\ResourceConnection;
11+
use Magento\Framework\DB\Adapter\AdapterInterface;
12+
use Magento\Framework\DB\Ddl\Table;
1113
use Magento\Framework\Indexer\IndexStructureInterface;
1214
use Magento\Framework\Indexer\ScopeResolver\IndexScopeResolver;
1315
use Magento\Framework\Search\Request\IndexScopeResolverInterface;
@@ -88,4 +90,45 @@ private function getEntity()
8890
}
8991
return $this->indexStructureEntity;
9092
}
93+
94+
/**
95+
* Create fulltext index table.
96+
*
97+
* @param string $tableName
98+
* @throws \Zend_Db_Exception
99+
* @return void
100+
* @deprecated
101+
* @see \Magento\ElasticSearch
102+
*/
103+
protected function createFulltextIndex($tableName)
104+
{
105+
$table = $this->resource->getConnection()->newTable($tableName)
106+
->addColumn(
107+
'entity_id',
108+
Table::TYPE_INTEGER,
109+
10,
110+
['unsigned' => true, 'nullable' => false],
111+
'Entity ID'
112+
)->addColumn(
113+
'attribute_id',
114+
Table::TYPE_INTEGER,
115+
10,
116+
['unsigned' => true, 'nullable' => false]
117+
)->addColumn(
118+
'data_index',
119+
Table::TYPE_TEXT,
120+
'4g',
121+
['nullable' => true],
122+
'Data index'
123+
)->addIndex(
124+
'idx_primary',
125+
['entity_id', 'attribute_id'],
126+
['type' => AdapterInterface::INDEX_TYPE_PRIMARY]
127+
)->addIndex(
128+
'FTI_FULLTEXT_DATA_INDEX',
129+
['data_index'],
130+
['type' => AdapterInterface::INDEX_TYPE_FULLTEXT]
131+
);
132+
$this->resource->getConnection()->createTable($table);
133+
}
91134
}

app/code/Magento/CatalogSearch/Model/Indexer/IndexStructureProxy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
* Catalog search index structure proxy.
1212
*
13-
* @deprecated
13+
* @deprecated mysql search engine has been removed
1414
* @see \Magento\Elasticsearch
1515
*/
1616
class IndexStructureProxy implements IndexStructureInterface

app/code/Magento/CatalogSearch/Model/Indexer/IndexSwitcherInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @api
1212
* @since 100.2.0
13-
* @deprecated
13+
* @deprecated mysql search engine has been removed
1414
* @see \Magento\Elasticsearch
1515
*/
1616
interface IndexSwitcherInterface

app/code/Magento/CatalogSearch/Model/Indexer/IndexSwitcherProxy.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
/**
1313
* Proxy for adapter-specific index switcher
14-
* @deprecated
14+
*
15+
* @deprecated mysql search engine has been removed
1516
* @see \Magento\Elasticsearch
1617
*/
1718
class IndexSwitcherProxy implements IndexSwitcherInterface

app/code/Magento/CatalogSearch/Model/Indexer/Scope/ScopeProxy.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66

77
namespace Magento\CatalogSearch\Model\Indexer\Scope;
88

9-
use Magento\Framework\Search\Request\Dimension;
10-
119
/**
1210
* Implementation of IndexScopeResolverInterface which resolves index scope dynamically depending on current scope state
1311
*
14-
* @deprecated
12+
* @deprecated mysql search engine has been removed
1513
* @see \Magento\Elasticsearch
1614
*/
1715
class ScopeProxy implements \Magento\Framework\Search\Request\IndexScopeResolverInterface

app/code/Magento/CatalogSearch/Model/Indexer/Scope/State.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* which means that default indexer table should be left unchanged during indexation
2020
* and temporary table should be used instead.
2121
*
22-
* @deprecated
22+
* @deprecated mysql search engine has been removed
2323
* @see \Magento\Elasticsearch
2424
*/
2525
class State

app/code/Magento/CatalogSearch/Model/ResourceModel/EngineInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
interface EngineInterface
1515
{
1616
/**
17-
* @deprecated
17+
* Field prefix
18+
*
19+
* @deprecated mysql search engine has been removed
1820
* @see \Magento\Framework\Search\EngineResolverInterface
1921
*/
2022
const FIELD_PREFIX = 'attr_';

app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313

1414
/**
1515
* Resolve specific attributes for search criteria.
16-
* @deprecated
16+
*
17+
* @deprecated mysql search engine has been removed
1718
* @see \Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplier
1819
*/
1920
class SearchResultApplier implements SearchResultApplierInterface

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ function () use ($indexer) {
6464
->save();
6565
}
6666
);
67+
return $this;
6768
}
6869

6970
/**

app/code/Magento/CatalogSearch/Test/Unit/Model/Indexer/FulltextTest.php

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
use Magento\CatalogSearch\Model\Indexer\Fulltext;
1111
use Magento\CatalogSearch\Model\Indexer\Fulltext\Action\Full;
1212
use Magento\CatalogSearch\Model\Indexer\Fulltext\Action\FullFactory;
13-
use Magento\CatalogSearch\Model\Indexer\IndexerHandler;
13+
use Magento\Framework\Indexer\SaveHandler\IndexerInterface;
1414
use Magento\CatalogSearch\Model\Indexer\IndexerHandlerFactory;
15-
use Magento\CatalogSearch\Model\Indexer\Scope\IndexSwitcher;
1615
use Magento\CatalogSearch\Model\Indexer\Scope\State;
1716
use Magento\Framework\App\ResourceConnection;
1817
use Magento\Framework\Indexer\Dimension;
@@ -38,7 +37,7 @@ class FulltextTest extends TestCase
3837
protected $fullAction;
3938

4039
/**
41-
* @var IndexerHandler|MockObject
40+
* @var IndexerInterface|MockObject
4241
*/
4342
protected $saveHandler;
4443

@@ -47,11 +46,6 @@ class FulltextTest extends TestCase
4746
*/
4847
protected $fulltextResource;
4948

50-
/**
51-
* @var IndexSwitcher|MockObject
52-
*/
53-
private $indexSwitcher;
54-
5549
/**
5650
* @var DimensionProviderInterface|MockObject
5751
*/
@@ -64,14 +58,13 @@ class FulltextTest extends TestCase
6458

6559
protected function setUp(): void
6660
{
67-
$this->markTestSkipped("MC-18332: Mysql Search Engine is deprecated and will be removed");
6861
$this->fullAction = $this->getClassMock(Full::class);
6962
$fullActionFactory = $this->createPartialMock(
7063
FullFactory::class,
7164
['create']
7265
);
7366
$fullActionFactory->expects($this->any())->method('create')->willReturn($this->fullAction);
74-
$this->saveHandler = $this->getClassMock(IndexerHandler::class);
67+
$this->saveHandler = $this->getClassMock(IndexerInterface::class);
7568
$indexerHandlerFactory = $this->createPartialMock(
7669
IndexerHandlerFactory::class,
7770
['create']
@@ -80,11 +73,6 @@ protected function setUp(): void
8073

8174
$this->fulltextResource = $this->getClassMock(\Magento\CatalogSearch\Model\ResourceModel\Fulltext::class);
8275

83-
$this->indexSwitcher = $this->getMockBuilder(IndexSwitcher::class)
84-
->disableOriginalConstructor()
85-
->setMethods(['switchIndex'])
86-
->getMock();
87-
8876
$this->dimensionProviderMock = $this->getMockBuilder(DimensionProviderInterface::class)
8977
->getMock();
9078
$stateMock = $this->getMockBuilder(State::class)
@@ -102,7 +90,6 @@ protected function setUp(): void
10290
'indexerHandlerFactory' => $indexerHandlerFactory,
10391
'fulltextResource' => $this->fulltextResource,
10492
'data' => [],
105-
'indexSwitcher' => $this->indexSwitcher,
10693
'dimensionProvider' => $this->dimensionProviderMock,
10794
'indexScopeState' => $stateMock,
10895
'processManager' => $this->processManager,
@@ -173,8 +160,6 @@ public function testExecuteFull()
173160
$indexData = new \ArrayObject([new \ArrayObject([]), new \ArrayObject([])]);
174161
$this->setupDataProvider($stores);
175162

176-
$this->indexSwitcher->expects($this->exactly(2))->method('switchIndex');
177-
178163
$this->saveHandler->expects($this->exactly(count($stores)))->method('cleanIndex');
179164
$this->saveHandler->expects($this->exactly(2))->method('saveIndex');
180165
$consecutiveStoreRebuildArguments = array_map(

0 commit comments

Comments
 (0)