Full-Text Searching Made Easy!
Published: December 28th, 2007If you’ve ever looked for a simple solution to full-text searching in your models, I found the perfect plugin: Acts_As_Indexed to the rescue!
The Search
I found something that is absolutely perfect for a quick full-text-search-system to be set up: “Acts_As_Indexed”1 by Douglas F Shearer2. It’s a pure ruby implementation for searching behavior. It’s as easy as script/install, putting in “acts_as_indexed” in your model, and bam, you have search capabilities with find_with_index.
1, 2, 3, done
The beauty of this plugin that I found is that it’s an easy drop-in to your application. You don’t have to worry about what database you’re using, or the stupid configuration files most require you to set up.
Now in terms of performance, I don’t know if it’s going to bottleneck, but there’s always a way to scale, right?
It’s recent
One important thing in my search for an indexing solution; was to find a library that was recently modified. Luckily, Acts_As_Indexed was released on September 2007. It’s definitely a recent plugin in regards to time.
Getting it set up
To play around with it, check out the libraries’ page over here
- http://douglasfshearer.com/blog/rails-plugin-acts_as_indexed [↩]
- http://douglasfshearer.com/about [↩]

Hm, sounds like a nice plugin but I really would worry about performance. Defining an index on the database columns would still be my #1 hint when you wanna do fulltext search.
Is there a particular reason you like this over ferret?
Ferret is unstable and I’ve had experiences where it’s indexes get corrupted on production.
And how good is this one in production?
Well, since it’s an experimental release, I’d say it’s pretty horrible on production.
Hi Daniel,
I had the same problems with Ferret, however, they were resolved. The problem is that Ferret does not play nice with multiple Mongrel instances, especially if one instance tries to update the index as another instance tries to pull from it. That’s what causes the index corruption.
There are two solutions: run Ferret as a Drb service, or disable automatic indexing:
http://boonedocks.net/mike/archives/151-Rails-acts_as_ferret-without-DRb.html
After I implemented this, Ferret became incredibly stable.
First up, thanks Daniel for featuring my plugin on your site, it’s nice to see people using my code.
Secondly, I appologise to all the people who have been unable to download my plugin over the last two days. I’m in the middle of a server move, and it wasn’t until I got some emails that I provided a tarball. Then of course I just noticed this article as a referrer in my logs.
To answer questions about stability in production; it works fine for most sites served from a single server. Several months of bug fixes have taken place now, so it’s looking pretty good.
Going multi-server or really big (More than 40k wikipedia sized articles), then hook up Ferret as a service as suggested by Ikai above.
Ready. Set. Go.
In terms of the formatting, you're allowed to use markdown, textile, or basic html; it's truly up to you -- what strikes your fancy?
You don't have to worry about your e-mail address being sold to a russian-spam-mafia. I'm only going to use it for my own weird needs; like asking you out for a date on a lonely night of coding.