Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-search
Adapter
Query
Preprocessor
Synonyms.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Search\Adapter\Query\Preprocessor
;
7
8
use
Magento\Framework\Search\Adapter\Preprocessor\PreprocessorInterface
;
9
use
Magento\Search\Api\SynonymAnalyzerInterface
;
10
11
class
Synonyms
implements
PreprocessorInterface
12
{
16
private
$synonymsAnalyzer;
17
23
public
function
__construct
(
SynonymAnalyzerInterface
$synonymsAnalyzer)
24
{
25
$this->synonymsAnalyzer = $synonymsAnalyzer;
26
}
27
31
public
function
process
(
$query
)
32
{
33
$synonyms = [];
34
$synonymsArray = $this->synonymsAnalyzer->getSynonymsForPhrase(
$query
);
35
if
(count($synonymsArray) > 0) {
36
foreach
($synonymsArray as $synonymPart) {
37
$synonyms [] = implode(
' '
, $synonymPart);
38
}
39
$query
= implode(
' '
, $synonyms);
40
}
41
return
$query
;
42
}
43
}
Magento\Search\Api\SynonymAnalyzerInterface
Definition:
SynonymAnalyzerInterface.php:13
Magento\Framework\Search\Adapter\Preprocessor\PreprocessorInterface
Definition:
PreprocessorInterface.php:12
Magento\Search\Adapter\Query\Preprocessor\Synonyms\__construct
__construct(SynonymAnalyzerInterface $synonymsAnalyzer)
Definition:
Synonyms.php:23
Magento\Search\Adapter\Query\Preprocessor\Synonyms\process
process($query)
Definition:
Synonyms.php:31
$query
$query
Definition:
popular_query.php:9
Magento\Search\Adapter\Query\Preprocessor\Synonyms
Definition:
Synonyms.php:11
Magento\Search\Adapter\Query\Preprocessor
Definition:
Synonyms.php:6