PostgreSQL showball algorithm does not work on synonyms

148 Views Asked by At

I created custom config and synonyms for this config.
Here is my synonym_custom.syn file contents

gate    door

These are the creation scripts:

CREATE TEXT SEARCH CONFIGURATION icons (copy='english');

CREATE TEXT SEARCH DICTIONARY my_synonym (
    TEMPLATE = synonym,
    SYNONYMS = synonym_custom
);

ALTER TEXT SEARCH CONFIGURATION icons
    ALTER MAPPING FOR asciiword, asciihword, hword_asciipart,
                  word, hword, hword_part
    WITH my_synonym, english_stem;

Now, when I create vector it does not create lexem for the word gates

postgres=# select to_tsvector('icons','door doors gate gates');
      to_tsvector
-----------------------
 'door':1,2,3 'gate':4
(1 row)

as you see it changes the words door, doors and gate, but not gates. Instead the snowball algorithm worked on gates and created lexem gate.
How to force postgresql to pass the result of synonym throw snowball algorithm. I know, that synonym dictionary has priority over snowball. As a workaround I can add all modifications of the gate word into synonym_custom.syn, but I have 3,500 words with synonyms like this. So it's not a solution in my case.

0

There are 0 best solutions below