Implementing Full Text search for your Rails application

Posted on May 31, 2007. Filed under: Ferret, Payscroll, Rails, Ruby on Rails, Solr, Sphinx |

Sorry, if you have been hoping to see something interesting about Rails and Ruby over here at BloggingRails. I am just so tied up with PayScroll development that I totally neglected this blog. But, good news is, I am going to somehow bring this back into my daily work schedule and start writing about Rails, particularly, gotchas and tutorials on Rails that I’ve encountered while working on PayScroll development.

So to start this off, I’m going to talk about something lighter for a start…

Say you’ve got this great Rails app done, and now you need to the ability to allow your users to search through your app. What are the options that are available? What so great about any open source framework is the support you get from the community, and that is precisely why Rails is so *extra awesome. The Rails community has been very active in providing great solutions to everyday problems that you will come across when doing web development and that is what make Rails the best framework out there for web development now.

When trying to implement Full-Text search on Rails, three solutions or options immediately came to mind:

1) Ferret and acts_as_ferret (AAF)
Ferret is a port of Apache Lucene, a popular java-based index and search engine and the port is provided as a gem, which means setting is as easy as a command line. AAF is the rails plugin for mixing in the index and search capability from Ferret to your models. There are plenty of tutorials out there for AAF, but I think the one from the Railsenvy guys are definitely worth your time to check it out.

http://railsenvy.com/2007/2/19/acts-as-ferret-tutorial

2) Solr and acts_as_solr (AASLR)
Apache‘s Solr is an open source enterprise search server based on the Lucene Java search library, with XML/HTTP and JSON APIs, hit highlighting, faceted search, caching, replication, and a web administration interface. It runs in a Java servlet container such as Tomcat. AASLR is a plugin that adds full text search capabilities and many other nifty features from Apache‘s Solr to any Rails model.

If you are interested, there is a 5 minute video tutorial to get you up and running with AASLR in less than 5 minutes.

This short video tutorial demonstrates how easy it is to integrate Solr and the acts_as_solr plugin to any Rails application. To watch the streamed version, click here, or to download the quicktime movie (5.5MB) to your computer, click here.

3) Sphinx and acts_as_sphinx (AASPX)
Sphinx and acts_as_sphinx is the new kid on the block that looks pretty promising in terms of speed and scalability. From datanoise blog –

Sphinx is being developed by a Russian programmer Andrew Aksyonoff. It’s a general purpose IR library. What makes it so special is the incredible, jaw-dropping speed of searching and indexing.”.

And as always, the ease of integrating this piece of excellent software is made very easy through the acts_as_sphinx plugin.

Kent Sibiler, the creator of the acts_as_sphinx plugin, has a great kick-off post on how to start using sphinx and AASPX.

So plenty of choices and plenty of options, but each offers it own unique features. It really depends on what sort of requirements and needs you have in order to really determine which one of them is a better choice.

For PayScroll, the backend index is ran using Ferret and AAF. And the reason for choosing Ferret and AAF is simple. We are using a RDig – to index information around the web for PayScroll. So naturally, AAF seem like a straight-forward decision for us. But I am keen on trying out AASLR and AASPX, so hopefully, I will get some time to play with them when PayScroll launches….. ( probably in a matter of weeks)…

Advertisements

Make a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

2 Responses to “Implementing Full Text search for your Rails application”

RSS Feed for Blogging Rails Comments RSS Feed

That was a nice collective info.

What are your best memories of grade school/high school/college/graduate school? Worst memories?


Where's The Comment Form?

Liked it here?
Why not try sites on the blogroll...

%d bloggers like this: