when I only have english. I use such way.
- add a new english_column to store tsvector.
- create gin index on the english_column.
- 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
CREATE TEXT SEARCH DICTIONARY multi_stem_nostop (
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?
english_column
just have,content
andlanguage
then use the value of thelanguage
column when callingto_tsquery()