I need to store text in Quill-Delta format, which is in the form of a JSON array, e.g.
-----------------------------------------------------------------
| id | title | content |
-----------------------------------------------------------------
| 10 | Hello | [ { "insert": "Hello" }, { "insert": "World" } ] |
| 20 | Image | [ { "insert": { "image": "data:image/j..." } } ] |
-----------------------------------------------------------------
Then, I need to query it, e.g. select where text contains "hello world" such as:
- if I query
content
for "hello world" I get row 10; - if I query
content
for "insert" I get no results; - if I query
content
form "image" I get no results.
In practice, it should search only the insert
key of array objects, where the value is a JSON string (no other types).
Can I achieve this storing data in Postgres? I read about full-text search over JSONB, but I couldn't come up with a working example.