Using Searchlogic with acts_as_taggable_on

Posted by dpirotte on October 07, 2009

Ben Johnson’s excellent Searchlogic gem makes searching your ActiveRecord models trivial.  But, what if you want to include tags in your search?  If you are using acts_as_taggable_on, this is pretty straightforward.

There is a catch, though… you can only search one tag context at a time due to the way acts_as_taggable_on handles its joins. Patching this would be straightforward, but you would end up joining tags into your query once per context, which could get nasty fast depending on the size of your data set. If you have a medium-sized data set or larger, strongly consider offloading the tag search to Sphinx or your search engine of choice.

Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

Comments