© Copyright 2009 Sidu Ponnappa. All Rights Reserved.
Warren is a MySQL only ActiveRecord extension that enables full-text search on a MySQL database. MySQL supports full-text searches only on MyISAM tables; unfortunately MyISAM tables don’t support transactions, which is why you rarely see them in Rails applications. The more commonly used InnoDB tables on the other hand don’t support full-text searches.
Warren (moderately) transparently bridges the gap by enabling the creation, mirroring (via triggers) and full-text search of MyISAM tables for any existing transactional InnoDB table. This is a lightweight alternative to full-fledged search tools like Sphinx or Lucene, but is limited to the MySQL database.
MySQL fulltext search (which uses a MATCH query) has its own quirks which make it behave slightly differently from a normal find which filters with a WHERE or LIKE. Most notably:
* No rows are returned unless the MATCH clause filters out at least 50% of the rows in the table in two of the three fulltext search modes * The only search mode where the 50% rule doesn't apply is Warren::Modes::Boolean, but here the search pattern cannot have any wildcards on the left side. In SQL terms, a boolean mode fulltext search only allows 'pattern%' and not '%pattern%'
For more information, look up dev.mysql.com/doc/refman/5.1/en/fulltext-search.html