On this page
Overview
pg_search brings PostgreSQL search features into ActiveRecord named scopes. It supports tsearch full-text search, trigrams, dmetaphone, ranking and highlighting, association search, and a multisearch index spanning multiple models. The current version is 2.4.0.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Build model search scopes with tsearch, trigram similarity, and ranking
pg_search_scope can search multiple columns and associations and combine PostgreSQL full-text search, trigram similarity, prefix matching, dictionaries, weighting, ranking, and highlighting.
Sources: [2]
Create one global index across multiple ActiveRecord model types
multisearchable writes searchable documents to pg_search_documents, enabling one query across multiple model classes with rebuild support when the index must be regenerated.
Sources: [2]
Best fit
Fits Rails applications that want application search without operating a separate search engine
It works well for admin search, autocomplete, and small-to-medium site search where teams want to reuse PostgreSQL indexes and ActiveRecord relations.
Sources: [2]
Before adoption
Version 2.4.0 requires Ruby 3.3+ and ActiveRecord 8.0+; index design and rebuild consistency still matter
Version 2.4.0 requires Ruby 3.3+, ActiveRecord and ActiveSupport 8.0+, and PostgreSQL 9.2+. Some features require PostgreSQL extensions. Multisearch can become stale when updates bypass callbacks, so rebuild procedures and appropriate GIN or GiST indexes are operational requirements.
Official sources
- [1]Casecommons/pg_search — GitHub repository(2026-10-06)
- [2]pg_search — README(2026-10-06)
- [3]pg_search — gemspec(2026-10-06)
- [4]pg_search — CHANGELOG(2026-10-06)
Supplemental curator note
It makes PostgreSQL-backed search easy to adopt without a separate search engine, but performance still depends on index design. Include multisearch rebuilds and callback-bypassing updates in operations.
Try it in 3 steps
- 1
Get the source
git clone --depth 1 https://github.com/Casecommons/pg_search.git - 2
Enter the repository
cd pg_search - 3
Check the official steps
Continue with the commands in the README Installation, Quick Start, or Getting Started section.
find . -maxdepth 1 -iname 'README*' -exec sed -n '1,220p' {} \; -quit
Growth
Growth trends · Last 30 days
1,588 Stars
Trend data is still being collected.
Development activity
Last 90 days · weekly
- Commits (last 30 days)
- 16
- Open PRs
- 31
Development activity is still being collected.
Built with
Categories and tags
Categories
GitHub data
GitHub dataView detailed GitHub data
GitHub Topics
- pg-search
- ruby
- tsearch
- trigrams
- search
- postgresql
- activerecord
- metaphone
- multi-search
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- GORM39,982 Stars
2 shared tag(s) · 2 shared category(s)
combine associations, transactions, and SQL building in a full-featured Go ORM
Go - Turso Database24,632 Stars
2 shared tag(s) · 2 shared category(s)
run SQLite-compatible SQL on a Rust database engine with bindings for multiple languages
Rust - HikariCP21,234 Stars
2 shared tag(s) · 2 shared category(s)
keep JDBC connection pooling small and fast with explicit timeout and lifetime controls
Java - sqlc18,348 Stars
2 shared tag(s) · 2 shared category(s)
keep SQL as the source of truth and generate type-safe data-access code
Go - sqlx17,743 Stars
2 shared tag(s) · 2 shared category(s)
extend database/sql with struct scanning and named queries without replacing its interfaces
Go - Ent17,204 Stars
2 shared tag(s) · 2 shared category(s)
generate statically typed query APIs from Go schemas with an entity framework
Go
Report incorrect information
Tell us if any listing information is incorrect or outdated.