Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue/26520 catalog search query error #26803

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\CatalogSearch\Setup\Patch\Data;

use Magento\CatalogSearch\Model\Indexer\IndexStructure;
use Magento\Framework\Indexer\DimensionProviderInterface;
use Magento\Framework\Search\EngineResolverInterface;
use Magento\CatalogSearch\Model\Indexer\Fulltext;

/**
* This patch will create catalogsearch_fulltext tables in MySQL DB.
*/
class MySQLCatalogSearchTableCreation implements \Magento\Framework\Setup\Patch\DataPatchInterface
{
/**
* @var IndexStructure
*/
private $indexStructure;

/**
* @var DimensionProviderInterface
*/
private $dimensionProvider;

/**
* @var EngineResolverInterface
*/
private $searchEngineResolver;

/**
* MySQLCatalogSearchTableCreation constructor.
* @param IndexStructure $indexStructure
* @param DimensionProviderInterface $dimensionProvider
* @param EngineResolverInterface $searchEngineResolver
*/
public function __construct(
IndexStructure $indexStructure,
DimensionProviderInterface $dimensionProvider,
EngineResolverInterface $searchEngineResolver
) {
$this->indexStructure = $indexStructure;
$this->dimensionProvider = $dimensionProvider;
$this->searchEngineResolver = $searchEngineResolver;
}

/**
* @inheritdoc
*/
public function apply()
{
if ($this->searchEngineResolver->getCurrentSearchEngine() === 'mysql') {
foreach ($this->dimensionProvider->getIterator() as $dimension) {
$this->indexStructure->create(Fulltext::INDEXER_ID, [], $dimension);
}
}
}

/**
* @inheritdoc
*/
public function getAliases()
{
return [];
}

/**
* @inheritdoc
*/
public static function getDependencies()
{
return [];
}
}
7 changes: 7 additions & 0 deletions app/code/Magento/CatalogSearch/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,13 @@
</argument>
</arguments>
</type>
<type name="Magento\CatalogSearch\Setup\Patch\Data\MySQLCatalogSearchTableCreation">
<arguments>
<argument name="dimensionProvider" xsi:type="object" shared="false">
Magento\Store\Model\StoreDimensionProvider
</argument>
</arguments>
</type>
<type name="Magento\CatalogSearch\Model\Search\FilterMapper\ExclusionStrategy">
<arguments>
<argument name="priceTableResolver" xsi:type="object">
Expand Down