0

I have a table which has "normal" text columns and a single jsonb column and I want to be able to have full text search on all of them.

I understand that I can pass jsonb column to normal to_tsvector function. However jsonb_to_tsvector function has some additional options which are usefule in my situation (for example to exclude keys). Is it possible to create tsvector which combines text columns and data from json without keys?

GUZ
  • 627
  • 1
  • 9
  • 18
  • while it would be better to normalize your data, you can try https://stackoverflow.com/questions/18404055/index-for-finding-an-element-in-a-json-array – nbk Jul 18 '23 at 17:21
  • Please give a concrete example of what you like or don't like about each option. – jjanes Jul 18 '23 at 18:53

1 Answers1

0

You can concatenate the results of different to_tsvector function calls:

to_tsvector(text_col) || to_tsvector(jsonb_col)
Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263