2 years ago
#66958

Max Markov
Apply text configuration to array in Postgres
In PostgreSQL database I have an ARRAY field and right now I am trying to build full text search capabilities for it. But what I noticed that PostgreSQL text configuration is not applied to array content as it is applied to text strings. For example next query:
select
setweight(array_to_tsvector(ARRAY['crunchy']), 'A'),
setweight(to_tsvector('english', 'crunchy'), 'A')
FROM (VALUES (1)) AS t (num);
Produces result:
|'crunchy'|'crunchi':1A|
Which is surprising as I expected to see identical 'crunchi'
for both cases.
Is there any way to apply 'english'
TEXT SEARCH CONFIGURATION to every element in the array?
P. S. I think I can use array_to_string
but it looks a little bit ugly.
postgresql
full-text-search
0 Answers
Your Answer