json(b)_to_tsvector with numeric values

Поиск
Список
Период
Сортировка
От Dmitry Dolgov
Тема json(b)_to_tsvector with numeric values
Дата
Msg-id CA+q6zcXJQbS1b4kJ_HeAOoOc=unfnOrUEL=KGgE32QKDww7d8g@mail.gmail.com
обсуждение исходный текст
Ответы Re: json(b)_to_tsvector with numeric values  (Arthur Zakirov <a.zakirov@postgrespro.ru>)
Список pgsql-hackers
Hi,

We've just noticed, that current implementation of `json(b)_to_tsvector` can be
confusing sometimes, if the target document contains numeric values.
In this case
we just drop them, and only string values will contribute to the result:

    select to_tsvector('english', '{"a": "The Fat Rats", "b": 123}'::jsonb);
       to_tsvector
    -----------------
     'fat':2 'rat':3
    (1 row)

The result would be less surprising if all values, that can be converted to
string representation (so, strings and numeric values, nothing to do for null &
boolean), will take part in it:

    select to_tsvector('english', '{"a": "The Fat Rats", "b": 123}'::jsonb);
           to_tsvector
    -------------------------
     '123':5 'fat':2 'rat':3
    (1 row)

Attached patch contains small fix that's necessary to get the described
behavior. This patch doesn't touch `ts_headline` though, because following the
same approach it would require changing the type of element in the resulting
json(b).

Any opinions about this suggestion? Can it be considered as a bug fix and
included into this release?

Вложения

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

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: [HACKERS] Re: Improve OR conditions on joined columns (commonstar schema problem)
Следующее
От: Дмитрий Воронин
Дата:
Сообщение: Re: Diagonal storage model