OSS TanbouSign in with GitHub

Expose PostgreSQL full-text search, trigrams, ranking, and multi-model search as ActiveRecord scopes

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
1,588
Primary language
Ruby
License
MIT
Repository last updated
Sep 21, 2026
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.

Sources: [2][3][4]

Official sources

  1. [1]Casecommons/pg_search — GitHub repository(2026-10-06)
  2. [2]pg_search — README(2026-10-06)
  3. [3]pg_search — gemspec(2026-10-06)
  4. [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. 1

    Get the source

    git clone --depth 1 https://github.com/Casecommons/pg_search.git
  2. 2

    Enter the repository

    cd pg_search
  3. 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
Check the official README

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

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • pg-search
  • ruby
  • tsearch
  • trigrams
  • search
  • postgresql
  • activerecord
  • metaphone
  • multi-search
Stars
1,588
Forks
380
Watchers
6
Open issues
126
Contributors
72
Owner type
Organization
Primary language
Ruby
License
MIT
Repository last updated
Sep 21, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?