Answer the question
In order to leave comments, you need to log in
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
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 questionAsk a Question
731 491 924 answers to any question