Add json(b)_to_tsvector function
Teodor Sigaev <teodor@sigaev.ru>
Add json(b)_to_tsvector function Jsonb has a complex nature so there isn't best-for-everything way to convert it to tsvector for full text search. Current to_tsvector(json(b)) suggests to convert only string values, but it's possible to index keys, numerics and even booleans value. To solve that json(b)_to_tsvector has a second required argument contained a list of desired types of json fields. Second argument is a jsonb scalar or array right now with possibility to add new options in a future. Bump catalog version Author: Dmitry Dolgov with some editorization by me Reviewed by: Teodor Sigaev Discussion: https://www.postgresql.org/message-id/CA+q6zcXJQbS1b4kJ_HeAOoOc=unfnOrUEL=KGgE32QKDww7d8g@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/func.sgml | modified | +20 −0 |
| src/backend/tsearch/to_tsany.c | modified | +108 −20 |
| src/backend/utils/adt/jsonfuncs.c | modified | +163 −16 |
| src/include/catalog/catversion.h | modified | +1 −1 |
| src/include/catalog/pg_proc.h | modified | +16 −8 |
| src/include/utils/jsonapi.h | modified | +17 −4 |
| src/test/regress/expected/jsonb.out | modified | +122 −0 |
| src/test/regress/expected/json.out | modified | +122 −0 |
| src/test/regress/sql/jsonb.sql | modified | +30 −0 |
| src/test/regress/sql/json.sql | modified | +30 −0 |
Documentation touched
Discussion
- json(b)_to_tsvector with numeric values 16 messages · 2018-04-01 → 2018-04-07