Re: json(b)_to_tsvector with numeric values

Поиск
Список
Период
Сортировка
От Dmitry Dolgov
Тема Re: json(b)_to_tsvector with numeric values
Дата
Msg-id CA+q6zcXooHt2o_FSBvOGZ85KD5ag=__A2K6Jv4A=3TYmbSDGfQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: json(b)_to_tsvector with numeric values  (Teodor Sigaev <teodor@sigaev.ru>)
Ответы Re: json(b)_to_tsvector with numeric values  (Teodor Sigaev <teodor@sigaev.ru>)
Список pgsql-hackers
> On 6 April 2018 at 18:55, Teodor Sigaev <teodor@sigaev.ru> wrote:
>
>
> Dmitry Dolgov wrote:
>>>
>>> On 6 April 2018 at 16:25, Teodor Sigaev <teodor@sigaev.ru> wrote:
>>> 1) I don't like jsonb_all_to_tsvector too.. What if we will accept new
>>> variant to index? Let me suggest:
>>>
>>> tsvector jsonb_to_tsvector([regclass,] jsonb, text[])
>>>
>>> where text[] arg is actually a flags, array contains any combination of
>>> literals 'numeric', 'string', 'boolean' (and even 'key' to index keys_ to
>>> point which types should be indexed. More than it, may be, it should a
>>> jsonb
>>> type for possible improvements in future. For now, it shouldbe a jsonb
>>> array
>>> type with string elements described above, example:
>>>
>>> select jsonb_to_tsvector('{"a": "aaa in bbb ddd ccc", "b":123}',
>>>                                  '["numeric", "boolean"]');
>>>
>>>
>>> Form jsonb_to_tsvector('...', '["string"]) is effectively the same as
>>> current to_tsvector(jsonb)
>>
>>
>> Thank you for the suggestion, this sounds appealing. But I have two
>> questions:
>>
>> * why it should be a jsonb array, not a regular array?
>
> To simplify extension of this array in future, for example to add limitation
> of recursion level in converted jsonb, etc.
>
>
>>
>> * it would introduce the idea of jsonb element type expressed in text
>> format,
>>    so "string", "numeric", "boolean" etc - are there any consequences of
>> that?
>>    As far as I understand so far there was only jsonb_typeof.
>
> Good catch, jsonb_typeof strings are okay: "string", "number", "boolean"
> also  "all", "key", "value"
>
> See workable sketch for parsing jsonb flags and new worker variant.

Yep, thanks for the sketch. Here is the new version of patch, does it look
close to what you have in mind?

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: amul sul
Дата:
Сообщение: Re: [HACKERS] Restrict concurrent update/delete with UPDATE ofpartition key
Следующее
От: Tomas Vondra
Дата:
Сообщение: Re: [HACKERS] [PATCH] Incremental sort