A Ruby gem that exposes PostgreSQL's full-text search capabilities to ActiveRecord with simple search scopes.
Textacular is a Ruby gem that extends ActiveRecord with PostgreSQL full-text search capabilities. It provides simple search scopes that allow developers to perform basic, advanced, fuzzy, and web searches directly from their ActiveRecord models without writing complex SQL. The gem solves the problem of implementing efficient and feature-rich text search in Ruby on Rails applications using PostgreSQL's built-in search functions.
Ruby on Rails developers who use PostgreSQL as their database and need to implement full-text search functionality in their applications. It's particularly useful for developers who want to leverage PostgreSQL's advanced search features without dealing with raw SQL queries.
Developers choose Textacular because it provides a clean, Ruby-friendly interface to PostgreSQL's powerful full-text search capabilities. Unlike generic search solutions, it's specifically designed for the ActiveRecord/PostgreSQL stack, offering chainable search methods, support for multiple search types (basic, advanced, fuzzy, web), and performance optimization through proper indexing.
Textacular exposes full text search capabilities from PostgreSQL, and allows you to declare full text indexes. Textacular will extend ActiveRecord with named_scope methods making searching easy and fun!
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports basic, advanced, fuzzy, and web searches using PostgreSQL's functions like websearch_to_tsquery, allowing for natural language parsing and boolean operators without raw SQL.
All search methods are chainable, enabling complex query building by combining filters, as shown in examples like Game.fuzzy_search(title: 'tree').basic_search(system: 'SNES').
Provides guidance on creating GIN and GiST indexes for performance optimization, with migration examples for both basic_search and fuzzy_search to speed up queries.
Extends ActiveRecord with simple scopes, making it straightforward to add search functionality to models via gem installation and minimal configuration, as per the Quick Start section.
Only works with PostgreSQL, limiting database flexibility and making migration to other databases like MySQL or SQLite difficult without rewriting search logic.
The README warns that methods like pluck can cause problems by interfering with SELECT statements, potentially breaking queries in unexpected ways.
Requires installing the pg_trgm module via a separate migration (rake textacular:create_trigram_migration), adding extra steps and dependencies beyond standard gem installation.
For optimal performance, developers must manually create and maintain indexes for each searchable column, which can be tedious and error-prone, as highlighted in the indexing section.