5 ms·
Fine tuning full text search with PostgreSQL 12
- Deimorz 7y agoIt's only offhandedly mentioned at the bottom of the post, but the websearch_to_tsquery() function added in PostgreSQL 11 is extremely useful and lets you create a pretty decent search system immediately without having to implement any sort of query-parsing yourself. It supports searching for alternatives with "or", phrases in quotes, and excluding terms with a minus sign, which is all syntax that a lot of people are already used to. For example it can handle a query like: blizzard or overwatch -"hong kong" That would find anything with "blizzard" or "overwatch" in it, but exclude anything with "hong kong" (if you wanted to avoid results about that recent controversy). It's a great addition, and made it even easier to implement reasonable search functionality with PostgreSQL.
- johnthescott 7y agobe sure to investigate the new "rum" index for text search, which is not in pg core. rum is written by the same folks who wrote the core fts. stunningly fast and flexible. also, a query is a first class data type, allowing for a simple, elegant classification: find all queries which match a certain document. https://github.com/postgrespro/rum https://github.com/postgrespro/rum