rails-search

Configure PostgreSQL tsvector and trigram search for Rails applications.

21|2|Updated May 24, 2026
One-click install
npx skills add https://github.com/sandeepmvl/rails-skills --skill rails-search
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rails-search
Source: https://github.com/sandeepmvl/rails-skills/tree/main/skills/37-rails-search
Command: npx skills add https://github.com/sandeepmvl/rails-skills --skill rails-search

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the pervasive issue of AI coding agents defaulting to overkill search solutions like Elasticsearch for Rails applications, even when simpler, more maintainable options like PostgreSQL full-text search are sufficient, leading to unnecessary operational overhead, non-idiomatic code, and wasted engineering time.

Core Features & Use Cases

  • 3-Tier Search Guidance: Teaches the correct Rails search stack, defaulting to pg_search with PostgreSQL tsvector and trigram, stepping up to Meilisearch for typo tolerance and autocomplete, and only using Elasticsearch/OpenSearch for billion-row clustered scale.
  • Production-Ready Implementation Patterns: Provides copy-paste ready examples for per-model search, multi-model search, precomputed tsvector columns for large tables, async background indexing, and index reconciliation to prevent drift between the database and search index.
  • Anti-Pattern Guardrails: Explicitly blocks common mistakes like inline indexing in the request cycle, over-engineering with Elasticsearch for small datasets, and indexing unfiltered user input as the sole ranking source.
  • Use Case: If you need to add search to a 100k-post Rails blog, this Skill will guide you to use pg_search with a GIN index instead of provisioning a full Elasticsearch cluster, eliminating unnecessary operational overhead.

Quick Start

Use the rails-search skill to add optimized full-text search to your Rails application, selecting the appropriate search tool tier based on your dataset size and feature requirements.

Frequently Asked Questions about rails-search

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add full-text search to a Rails application without using Elasticsearch?

To add full-text search to Rails without Elasticsearch, use PostgreSQL tsvector and trigram configurations via the pg_search gem, which prevents unnecessary operational overhead for small to medium datasets while maintaining idiomatic code.

What is the best way to configure typo-tolerant search and autocomplete in Rails?

For typo-tolerant search and autocomplete in Rails, the best approach is stepping up from PostgreSQL full-text search to Meilisearch, reserving Elasticsearch or OpenSearch strictly for billion-row clustered scale requirements.

How do I handle async background indexing and index reconciliation for Rails search?

Handle async background indexing in Rails by moving index updates out of the request cycle into background jobs, and apply index reconciliation patterns to prevent drift between the database and the search index.

When do I need Elasticsearch for a Rails search setup?

You need Elasticsearch for a Rails search setup only when dealing with billion-row clustered scale, as smaller datasets like a 100k-post blog are better served by PostgreSQL GIN indexes to eliminate unnecessary operational overhead.

What are common Rails search anti-patterns to avoid when implementing full-text search?

Common Rails search anti-patterns to avoid include inline indexing in the request cycle, over-engineering with Elasticsearch for small datasets, and indexing unfiltered user input as the sole ranking source for search results.

Can I use pg_search with precomputed tsvector columns for large Rails database tables?

Yes, you can use pg_search with precomputed tsvector columns for large Rails database tables to optimize query performance, ensuring correct PostgreSQL configuration without needing a separate external search engine cluster.