I need to create suggestion autocomplete for all the columns of a table in a single searchbox using postgres database. I have a search autocomplete in web page and need to autosuggest the options. All columns are varchar.
For searching I am using the approach like
select * from userschema.user_details where to_tsvector(user_details::text) @@ to_tsquery('text:*')
But I am facing an issue getting the options for autocomplete. Is there a way of searching the tsvector and getting all the options that match a criteria. Something like getting text* options from all the words of tsvector so that I can use them for autosuggest.
I am thinking of storing the contents of tsvector into a column. Is there a way of fetching autosuggest words from same?