Skip to content

Instantly share code, notes, and snippets.

@jmschneider
jmschneider / sqlite_full_text_search.rb
Last active July 31, 2025 04:39 — forked from gabriel-curtino/sqlite_full_text_search.rb
Rails SQLite Full Text Search (per table, at db level)
## SqliteFullTextSearch Concern
#
# The `SqliteFullTextSearch` concern provides a set of methods and triggers to enable full-text search capabilities for ActiveRecord models using SQLite's FTS5 extension.
#
# ### Key Features
# - **Full-Text Search Scope**: Adds a `search` scope to the model for performing full-text searches.
# - **Index Creation and Management**: Automatically creates and manages FTS5 tables and triggers for the model.
# - **Attribute Configuration**: Allows specifying attributes to include in the full-text search index.
# - **Trigger Management**: Sets up triggers to keep the search index up-to-date with model changes.
#