Hi allI would like to propose patch with a set of new small functions for fts in case ofjsonb data type:* to_tsvector(config, jsonb) - make a tsvector from all string values and elements of jsonb object. To prevent the situation, when tsquery can find a phrase consisting of lexemes from two different values/elements, this function will add an increment to position of each lexeme from every new value/element.* ts_headline(config, jsonb, tsquery, options) - generate a headline directly from jsonb objectHere are the examples how they work:```=# select to_tsvector('{"a": "aaa bbb", "b": ["ccc ddd"], "c": {"d": "eee fff"}}'::jsonb); to_tsvector------------------------------------------------- 'aaa':1 'bbb':2 'ccc':4 'ddd':5 'eee':7 'fff':8(1 row)=# select ts_headline('english', '{"a": "aaa bbb", "b": {"c": "ccc ddd"}}'::jsonb, tsquery('bbb & ddd & hhh'), 'StartSel = <, StopSel = >'); ts_headline---------------------- aaa <bbb> ccc <ddd>(1 row)```
Any comments or suggestions?
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-hackers
pgsql-hackers by date:
Соглашаюсь с условиями обработки персональных данных