Add search to Rails with SQLite FTS5

14-Apr-2026 248
Implement full-text search in Rails using SQLite FTS5: prefix matching, BM25 ranking, polymorphic indexing. All without external services.Rails 8 leans hard into SQLite as a first-class production database. One of the nicest payoffs is that you can build a fast, typo-tolerant, relevance-ranked search engine without adding Elasticsearch, Meilisearch, or even the pg_search gem. SQLite ships with FTS5, and Rails 8.1 finally exposes a clean migration DSL for it. While building Kamado.app, a social platform for Kamado enthusiasts, we wanted to add search quickly without introducing complex dependencies. No search cluster, no additional service to babysit, just the existing SQLite file. This post walks through the implementation we ended up with: a single search endpoint that indexes heterogeneous records, ranks them by relevance, supports prefix matching, and stays in sync automatically with minimal ceremony.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle