Problem/Motivation
In the UI, you first insert the main word and then its synonym(s): this produces row like this
jam, marmelade, preserve
All terms are equivalent.
In case of spelling error, you must insert first the correct word than one or more wrong terms, comma separated (see image). This generates a rows like this:
voucher => vaucer,vaucher,vocher
But in Apache Solr documentation the terms must be in reverse order:
marmalade,mermelad,marmellade => marmelade
See Using synonyms in Solr for example.
Steps to reproduce
Install a full working Search API Solr server and index, with some fields as rendered_html, title, body etc.
Install this module, than export the file created when cron runs in Solr cofiguration folder and reload the server.
Proposed resolution
The UI is correct, you must swap the order of main word token with its synonyms:
/src/Plugin/search_api_synonym/export/Solr.php >> Line 60 and 63
$line = "{$synonyms}, {$word}";
...
$line = "{$synonyms} => {$word}";
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | img02.png | 14.2 KB | brandonlira |
| #9 | img01.png | 33.32 KB | brandonlira |
| synonym_error.jpeg | 89.71 KB | charly71 |
Issue fork search_api_synonym-3486807
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
charly71 commentedComment #3
charly71 commentedI tried this patch and it works:
Comment #4
aaron.ferris commentedAgreed with this, I don't think we need to change the synonym case but the spelling error does need a switch I believe.
Comment #5
aaron.ferris commentedComment #7
aaron.ferris commentedMR raised
Comment #8
aaron.ferris commentedComment #9
brandonlira commentedHi @aaron, I tested this and it's working as expected.
The export file correctly shows the spelling correction in the expected format:
marmalade,mermelad,marmellade => marmeladeThanks for the fix, everything looks good!
Comment #10
aaron.ferris commentedThanks @brandonlira!
Comment #11
aaron.ferris commented