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 syntax in the association may look a bit strange, it's the Solr syntax.
The path parameter is afterwards passed to the Swag\EnterpriseSearch\Relevance\SynonymProvider class.

Example

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! For a specific language the language code can be added as an array key, 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',
],
];

How to override

  1. 1.
    Shopware Configuration
    1. 1.
      Shopware is based on symfony, so it's possible to override the Service parameters in symfony style.
    2. 2.
      Parametername swag_ses_synonym_dir
  2. 2.
    Own Plugin 1. Create a plugin
    1. 2.
      Create a file with your synonyms, see Example
    2. 3.
      Add a parameter to the Dependency Injection File.
services.xml
<parameters>
<parameter key="swag_ses_synonym_dir">%kernel.project_dir%/MySynonyms.php</parameter>
</parameter>
Make sure that the paths matches!
Copy link
Edit on GitHub
On this page
Example
How to override