# Casecommons/pg_search

pg_search builds ActiveRecord named scopes that take advantage of PostgreSQL’s full text search

Repository: https://github.com/Casecommons/pg_search
Canonical: https://ross.abutalabs.com/products/pg_search
Homepage: http://www.casebook.net
Language: Ruby
License: MIT
License Family: permissive
Topics: pg-search, ruby, tsearch, trigrams, search, postgresql, activerecord, metaphone, multi-search
Last push: 2026-08-10T20:39:42+00:00

## Health v2 (maintenance only)
Score: 76/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 97, release rhythm 35, longevity 100
- inputs: {"age_days": 5710, "days_push": 23, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1575, forks 381 (observed 2026-08-28T04:05:05.948073+00:00)

## What it is
pg_search is a Ruby gem that adds ActiveRecord named scopes leveraging PostgreSQL's built-in full text search, including tsearch, trigram, and metaphone features. It also offers a multisearchable global index for searching across multiple models, letting Rails applications implement search without an external engine like Elasticsearch.

## Use cases
- add full text search to a Rails ActiveRecord model
- search across multiple models with one global query
- implement trigram similarity search in PostgreSQL
- rank and weight search results across model columns
- avoid running Elasticsearch or Solr for app search
- add fuzzy name matching with metaphone or trigrams

## When to choose
- your app uses Ruby on Rails or ActiveRecord with a PostgreSQL database
- you want search scoped naturally into ActiveRecord query chains
- you prefer keeping search inside PostgreSQL instead of operating a separate search server
- you need multi-model search via a single indexed table

## When to avoid
- your database is MySQL, SQLite, or anything other than PostgreSQL
- your project is not Ruby or does not use ActiveRecord
- you need massive-scale distributed search, faceting, or advanced analytics better served by Elasticsearch or Solr
- you need language features or typo tolerance beyond what PostgreSQL full text search and trigrams provide

## Facets
- artifact type: library
- maturity: active
- function: search-engine, orm, database
- domain: databases, backend, web-development
- platform: ruby
- tags: postgresql, full-text-search, activerecord, rails, trigram, tsearch, metaphone, multisearch, ruby-gem, search

## Member repositories
- Casecommons/pg_search (main) score 76

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:05.948073+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:57:34.470810+00:00, confidence not recorded.
  - readme: https://github.com/Casecommons/pg_search (fetched 2026-08-28T04:05:05.948073+00:00, sha 57d64cbecb2b)
  - homepage: http://www.casebook.net (fetched 2026-08-29T11:27:36.745832+00:00, sha 3bf4fcfd963d)
  - site_page: https://www.casebook.net/about-us (fetched 2026-08-29T11:27:36.748627+00:00, sha 28e6e5f4f402)
  - site_page: https://www.casebook.net/pricing (fetched 2026-08-29T11:27:36.750512+00:00, sha c486fe8fd7ca)
  - site_page: https://gohub.casebook.net/subscription-tiers (fetched 2026-08-29T11:27:36.752548+00:00, sha c486fe8fd7ca)
- Data as of 2026-08-30T08:39:29.467469+00:00.
