Full-text search on jsonb column
Hey, I was experimenting with full-text search and drizzle. I saw in the docs an example for full-text search https://orm.drizzle.team/docs/sql, but this seems to only work with text columns. How would I convert the where statement to make it work with jsonb? @Angelelz
7 Replies
What dialect are you using?
I'm honesly not super familiar with jsonb tbh
Well for Postgresql I found this: https://dba.stackexchange.com/questions/179598/how-can-i-use-a-full-text-search-on-a-jsonb-column-with-postgres
Database Administrators Stack Exchange
How can I use a full-text search on a jsonb column with Postgres?
So i have a jsonb column that has entries like this: https://pastebin.com/LxJ8rKk4
Is there any way to implement a full-text search on the entire jsonb column?
Postgresql @Angelelz
thanks, will see if I can get this to work
In the Postgresql docs https://www.postgresql.org/docs/11/functions-textsearch.html if you search for
json(b)
you can see a couple of ways of doing it.PostgreSQL Documentation
9.13. Text Search Functions and Operators
9.13. Text Search Functions and Operators Table 9.40, Table 9.41 and Table 9.42 summarize the functions and operators that are provided for full text …
Or this link (newest docs version 16) https://www.postgresql.org/docs/current/functions-textsearch.html search for
jsonb
PostgreSQL Documentation
9.13. Text Search Functions and Operators
9.13. Text Search Functions and Operators # Table 9.42, Table 9.43 and Table 9.44 summarize the functions and operators that are provided for full …
This is for future dwellers:
I ended up doing the simplest thing ever (which was enough for my use-case of just searching for any substring in a nested json tree)
thanks! did you find any way to query arrays in JSONb columns?