ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Elastic Search Base for Magento 2
|
||||
*/
|
||||
|
||||
namespace Amasty\ElasticSearch\Plugin\Xsearch\Helper;
|
||||
|
||||
use \Amasty\ElasticSearch\Model\Search\GetRequestQuery\InjectMatchQuery;
|
||||
|
||||
class Data
|
||||
{
|
||||
/**
|
||||
* @var InjectMatchQuery
|
||||
*/
|
||||
private $injectMatchQuery;
|
||||
|
||||
public function __construct(
|
||||
InjectMatchQuery $injectMatchQuery
|
||||
) {
|
||||
$this->injectMatchQuery = $injectMatchQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Amasty\Xsearch\Helper\Data $subject
|
||||
* @param string $text
|
||||
* @param string $query
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function beforeHighlight(
|
||||
\Amasty\Xsearch\Helper\Data $subject,
|
||||
$text,
|
||||
$query
|
||||
) {
|
||||
if ($query) {
|
||||
/**
|
||||
* Quick fix magento bug in \Magento\Framework\DB\Adapter\Pdo::_splitMultiQuery(sql)
|
||||
* This algorithm does not work properly
|
||||
*/
|
||||
$query = str_replace(';', '', $query);
|
||||
$words = $this->injectMatchQuery->removeStopWords(explode(' ', $query));
|
||||
$query = implode(' ', $words);
|
||||
}
|
||||
|
||||
return [$text, $query];
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Elastic Search Base for Magento 2
|
||||
*/
|
||||
|
||||
namespace Amasty\ElasticSearch\Plugin\Xsearch\Plugin\CatalogSearch\Block\Result\ChangeNoResultText;
|
||||
|
||||
use Amasty\ElasticSearch\Model\Search\SubQuery\Helper as SubQueryHelper;
|
||||
use Amasty\Xsearch\Plugin\CatalogSearch\Block\Result\ChangeNoResultText;
|
||||
|
||||
class ReplaceQueryText
|
||||
{
|
||||
/**
|
||||
* @var SubQueryHelper
|
||||
*/
|
||||
private $subQueryHelper;
|
||||
|
||||
public function __construct(SubQueryHelper $subQueryHelper)
|
||||
{
|
||||
$this->subQueryHelper = $subQueryHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function aroundGetQueryText(ChangeNoResultText $subject, callable $proceed): string
|
||||
{
|
||||
if ($subQueryText = $this->subQueryHelper->getQueryText()) {
|
||||
return $subQueryText;
|
||||
}
|
||||
|
||||
return $proceed();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user