For a variety of technical reasons, most of the full-text search engines available for Ruby on Rails do off-line indexing. (Changes to the indexed tables are added to a queue that is processed in a cronjob, i.e., changes do not show up immediately in indexes). Examples of off-line indexing search engines are Xapian, Sphinx, and Hyper-Estraier. I think all three retrieve records for indexing directly from the database. This causes problems in testing.
To speed up testing, Rails does not commit any changes to the database made from individual tests. The lot is discarded in a rollback of a transaction started at the beginning of each test. Fast, but programs outside the Rails stack do not see the changes. Even after I jumped through hoops to run the index update program within a test.
Loading the fixtures, indexing them, and then running the tests works if fixtures are all the tests search for. In MySQL, the statement “SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED” will work around the limitation, but it’s non-portable and I’d have to maintain some hacked third-party code. No thanks.