Multilang text search. Is this correct? - Mailing list pgsql-general

From Florents Tselai
Subject Multilang text search. Is this correct?
Date
Msg-id 92C5D7E0-A9C6-441B-80D8-C86F80AB7F30@gmail.com
Whole thread Raw
Responses Re: Multilang text search. Is this correct?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
In my table (mix of text and jsonb columns ) I have text in multiple languages. 
I’d like search in all the possible regconfigs, so I’ve come up with the following recipe:

CREATE FUNCTION to_tsvector_multilang(text) RETURNS tsvector AS
$$
SELECT to_tsvector('english', $1) ||
to_tsvector('greek', $1) ||
to_tsvector('simple', $1)
$$ LANGUAGE sql IMMUTABLE;

CREATE FUNCTION jsonb_to_tsvector_multilang(jsonb, jsonb) RETURNS tsvector AS
$$
SELECT jsonb_to_tsvector('english', $1, $2) ||
jsonb_to_tsvector('simple', $1, $2) ||
jsonb_to_tsvector('greek', $1, $2)
$$ LANGUAGE sql IMMUTABLE;

CREATE FUNCTION to_tsquery_multilang(query text) RETURNS tsquery AS
$$
SELECT websearch_to_tsquery('english', query) ||
websearch_to_tsquery('simple', query) ||
websearch_to_tsquery('greek', query)
$$ LANGUAGE sql IMMUTABLE;
Thus, in searching I use  to_tsvector_multilang(TEXT') @@ to_tsquery_multilang(QUERY);
Looks like it’s working as expected from my prelim tests, but anyone seeing any potential pitfalls? 

Note: I’m using GIN & RUM indices as well.

pgsql-general by date:

Previous
From: Dominique Devienne
Date:
Subject: Re: Using CTID system column as a "temporary" primary key
Next
From: Francisco Olarte
Date:
Subject: Re: Using CTID system column as a "temporary" primary key