In a postsgresql v13 database, I want to add a search vector on a table, and i want to put several columns (not all the same type) in that vector.
I have some 7 text columns, 1 json column and 1 jsonb column :/
In my jsonB column, I can have a json like {email: '[email protected], phone: '010203040506', firstname: 'David', lastname:'Goliath'}
In a ideal scenario, i would not like to have the json keys in the vector.
I also wish I could search on ‘@labyrinth.com’ and get a result
For now I manage to do the following, but json key are indexed and partials emails are not searcheable.
ALTER TABLE company ADD COLUMN search_vector tsvector GENERATED ALWAYS AS (
to_tsvector('french', 'name || ' ' || comment || ' ' || address || ' ' || postalCode || ' ' || cga || ' ' || manager || ' ' || franchise || ' ' || coalesce(cast(advantages as text), '') || ' ' || coalesce(cast(contacts as text), '')')
) STORED;
Is there a way to do so ?