2

I've similliar question as Postgres full text search with unaccent and inflection (conjugation, etc.) .

I want to use FTS but in "unaccent" mode. I'll explain with the example. The "base" word in my dictionary is "príloha" only (no unaccented version whatsoever). Now I want to match the word "priloha" (notice the "i") with the base word in the dictionary.

I've created the text search configuration with unaccent filtering as below:

CREATE TEXT SEARCH DICTIONARY public.slovak_hunspell(
    TEMPLATE  = ispell,
    DictFile  = sk_SK,
    AffFile   = sk_SK,
    StopWords = sk_SK
);

CREATE TEXT SEARCH CONFIGURATION public.slovak (
    COPY = pg_catalog.english
);

ALTER TEXT SEARCH CONFIGURATION public.slovak
    ALTER MAPPING
    FOR
        asciiword, asciihword, hword_asciipart,  word, hword, hword_part
    WITH
        unaccent, slovak_hunspell, simple
;

But the problem with this is that the unaccented string is pass down to the "slovak_hunspell" but because there isn't unaccented word in this dictionary no lexeme is returned. But what I would really need is to use unaccent for words from the "slovak_hunspell" dictionary.

TLDR; from the link above is that it couldn't be done without some drwbacks/restrictions.
The only solution that I could think of is to use 2 dictionaries, one with the diacritics etc. and the another one unaccented, i.e. plain ASCII. And then use the unaccented for the "asciiword" etc. and another one for "word" etc.. Would this work? Or are there some other alternatives?
I've searched a lot but haven't find anything useful, only the link at the beginning of this post.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.