Sample Header Ad - 728x90

Query Quill-Delta JSON array in Postgres

0 votes
1 answer
642 views
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: 1. if I query content for "hello world" I get row 10; 2. if I query content for "insert" I get no results; 3. 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.
Asked by Giovanni Lovato (465 rep)
Feb 21, 2019, 11:33 AM
Last activity: May 30, 2025, 03:03 AM