igul222
igul222

Reputation: 8637

MySQL full-text search in Rails?

When I added search functionality to my first Rails app, I used Sphinx, after reading that using MySQL's built-in fulltext search was a bad idea. While Sphinx works well, it's a bit complicated to set up, and I feel there's too much overload for the simple searching functionality I require in my app.

Searches aren't performed very often on my site (at most one search every 3-4 seconds), so I'm not too worried about load.

My question: Why exactly is using MySQL's full text search a bad idea, compared to Sphinx/Ferret/Solr/etc..?

Upvotes: 3

Views: 1675

Answers (1)

Wil Moore III
Wil Moore III

Reputation: 7194

MySQL is a relational database and not a search server so right off, we are talking about using something that wasn't built specifically for the task. That being said, MySQL's full text search works pretty well; however, it isn't good if you need to scale.

  1. You don't want your DB server doing more than it has to as it is usually the bottleneck of the application even without something like full-text search running.
  2. The MySQL full-text search requires that you use the MyISAM engine which is a problem if you care about the consistency of your data.
  3. MyISAM doesn't support many of the enhanced data validation facilities supported by engines like InnoDB so you are generally at a disadvantage by starting with MyISAM.

But, YMMV and if your application can survive being subjected to MyISAM's shortcomings, by all means, use it. Just know that it is not a great production engine for MOST tasks (not ALL, but most).

Upvotes: 4

Related Questions