By Digoal
PostgreSQL has a very vibrant community that is constantly helping to release new features and make sure that these features are stable. This is one reason for the great stability and reliability of PostgreSQL.
In version 10.0 of PostgreSQL, the full-text search of JSON-formatted content and ts rank and phrase indexes for searching are supported. This means specifically that you can query natural-language documents to location those words or expressions that best match your query. Ts rank and phrase indexes involve both tsvector and tsquery. Tsvector, specifically, is used for a document that is optimized for text search.
Below is a patch that discusses in detail support for ts rank and phrase indexes, which was detailed in the mail group. This was produced by the ever so enthusiastic community. The link for this email patch is given in the references of this blog.
Hi all, I would like to propose patch with a set of new small functions for fts in case of jsonb data type:
Here are examples of 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?
There are many great resourses found at PostgreSQL. There happens to be a very active and enthusiastic community. A patch like the one above may be discussed in the mail group for several months or even a few years. After repeated revisions according to the opinions of everyone, the patch to be merged into the master is already quite mature. This is one reason why PostgreSQL is known for its stability.
[[PATCH] few fts functions for jsonb](https://www.postgresql.org/message-id/flat/CA+q6zcWm_1Ygg5QOq0gYbnB_=zq7G51uexQt3QEgDJa0qQnPKw@mail.gmail.com#CA+q6zcWm_1Ygg5QOq0gYbnB_=zq7G51uexQt3QEgDJa0qQnPKw@mail.gmail.com)
How You Can Use Trigonometric Functions in PostgreSQL to Obtain Further Insights
Range Types in PostgreSQL and GiST Indexes Increases Speed of MySQL Index Combine Queries
ApsaraDB - October 20, 2020
Alibaba Clouder - July 26, 2019
ApsaraDB - June 16, 2023
digoal - December 11, 2019
Alibaba Clouder - January 9, 2018
digoal - September 12, 2019
An online MPP warehousing service based on the Greenplum Database open source program
Learn MoreAlibaba Cloud PolarDB for PostgreSQL is an in-house relational database service 100% compatible with PostgreSQL and highly compatible with the Oracle syntax.
Learn MoreAn on-demand database hosting service for PostgreSQL with automated monitoring, backup and disaster recovery capabilities
Learn MoreReach global users more accurately and efficiently via IM Channel
Learn MoreMore Posts by digoal