Synonyms
The Synonyms are defined in the
%PLUGIN_DIR%/Resources/config/Synonyms.php
. The path to this file is saved in the swag_ses_synonym_dir
parameter of the container and can be overridden with the default Dependency Injection. See how to override for more information.The path parameter is later passed to the
Swag\EnterpriseSearch\Relevance\SynonymProvider
class.Synonyms.php
<?php declare(strict_types=1);
use Swag\EnterpriseSearch\Relevance\SynonymProvider;
return [
SynonymProvider::DEFAULT_KEY => [
'i-pod, i pod => ipod',
'universe, cosmos',
],
];
The
SynonymProvider
supports multi-languages and a default fallback. The language code can be added as an array key for a specific language, like the following:Synonyms.php with multi-language support
<?php declare(strict_types=1);
use Swag\EnterpriseSearch\Relevance\SynonymProvider;
return [
SynonymProvider::DEFAULT_KEY => [
'i-pod, i pod => ipod',
'universe, cosmos',
],
'en-GB' => [
'foozball, foosball',
'sea biscuit, sea biscit => seabiscuit',
],
];
- 1.Shopware configuration
- 1.Shopware is based on Symfony, so it is possible to override the Service parameters in Symfony style.
- 2.Parametername
swag_ses_synonym_dir
- 2.Own plugin
- 1.
- 2.
- 3.
- 4.
services.xml
<parameters>
<parameter key="swag_ses_synonym_dir">%kernel.project_dir%/MySynonyms.php</parameter>
</parameter>
Make sure that the paths match.
Last modified 5mo ago