timescale/pg_textsearch — explained in plain English
Analysis updated 2026-07-03
Add relevance-ranked full-text search to a Postgres app so users see the most matching results first instead of arbitrary order
Index a JSON column in Postgres and rank search results by BM25 score using a single SQL ORDER BY clause
Create separate language-specific search indexes on the same table to serve multilingual content with correct ranking
Speed up full-text search on a large partitioned Postgres table using parallel index builds and Block-Max WAND optimization
| timescale/pg_textsearch | dekunukem/nintendo_switch_reverse_engineering | ibireme/yyjson | |
|---|---|---|---|
| Stars | 3,736 | 3,734 | 3,738 |
| Language | C | C | C |
| Setup difficulty | moderate | hard | easy |
| Complexity | 3/5 | 4/5 | 3/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
Requires PostgreSQL 17 or 18, must be installed as a database extension before use.
pg_textsearch is a PostgreSQL extension that adds modern full-text search ranking to Postgres databases. It implements BM25, a well-established algorithm for scoring search results by how relevant each document is to a given query. Standard Postgres text search can tell you whether a document matches, but BM25 lets you order results by how closely they match, so the most relevant ones come first rather than in arbitrary order. Using the extension follows normal SQL patterns. You create an index on a text column, then write a query with an ORDER BY clause using a special operator. For example: SELECT * FROM documents ORDER BY content <@> 'database system' LIMIT 5. The extension handles the scoring math. Two tunable parameters, k1 and b, let you adjust how the algorithm weighs term frequency versus document length if the defaults do not suit your data. The extension supports multiple languages because it builds on Postgres's existing text search configurations. English, French, German, and other language configurations all work. You can also create separate indexes for different languages on the same table using partial indexes, each covering only rows tagged with a particular language. Beyond plain text columns, pg_textsearch supports expression indexes. This means you can index fields extracted from JSON data, combinations of multiple columns concatenated together, or text that has been transformed before indexing. Partial indexes cover only a subset of rows based on a condition, which keeps the index smaller and queries faster when searches always target a specific category or status. Performance tuning is built in. The extension uses an optimization called Block-Max WAND internally, which avoids scoring documents that cannot possibly rank in the top results of a given query. Parallel index builds are supported for large tables. Partitioned tables are also supported. pg_textsearch is developed by Timescale, released under the PostgreSQL open-source license, and works with PostgreSQL versions 17 and 18.
pg_textsearch is a PostgreSQL extension that adds BM25 full-text search ranking so your search results come back ordered by relevance, not random order, using plain SQL.
Mainly C. The stack also includes C, PostgreSQL, SQL.
Use freely for any purpose under the PostgreSQL open-source license, one of the most permissive available.
Setup difficulty is rated moderate, with roughly 30min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.