M
M
mShpakov2018-08-27 12:10:43
PostgreSQL
mShpakov, 2018-08-27 12:10:43

How to do a column search with json data?

Given:
- Laravel 5.6
- postgresql 9.6
Need to do a search among ALL the data inside the json column. All that I found on the Internet is of the type: But the problem is that there is an untyped structure and you need to go through all the properties of the object inside the json column. How can I do that?
->where('column->field', 'LIKE', 'search data')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Melkij, 2018-08-27
@melkij

Upgrade to postgresql 10 and you will have a full-fledged full-text search for json quickly and for indexes: https://wiki.postgresql.org/wiki/New_in_postgres_1...
And for 9.6 - you can look at the jsquery extension, maybe it can do something useful.
Or manually iterate over the structure, stored in any language or by request via jsonb_each_text and others.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question