when I only have english. I use such way.

  1. add a new english_column to store tsvector.
  2. create gin index on the english_column.
  3. create trigger on insert or update.

However. When I want to support other language. This method need create 3 new column. And query the pattern for 3 different language like

select * from where 
   english_column @@ to_tsquery('english', pattern) or 
   german_column  @@ to_tsquery('german', pattern) 

Can I keep only one new index column to support multi language?

something change like this

    Template = snowball
  , Language = english, german, spanish

CREATE TEXT SEARCH CONFIGURATION public.multi_nostop ( COPY = pg_catalog.english, pg_catalog.german );

Or I got misunderstanding for the dictionary?

  • Why not just add a "language" column?
    – user1822
    Commented Jul 28, 2020 at 9:00
  • You mean detect the language of the pattern and only search on such the special rows match the language?
    – jiamo
    Commented Jul 28, 2020 at 9:03
  • Instead of english_column just have, content and language then use the value of the language column when calling to_tsquery()
    – user1822
    Commented Jul 28, 2020 at 9:10
  • What do you want it to do? Do you want to stem it in all of those languages, then take the union of the stemmed results?
    – jjanes
    Commented Jul 28, 2020 at 17:45


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.