Complex search

Couple of alternatives for you... Put it in an index ala Lucene or its
Ruby sibling Ferret. Or... if you want to keep it pure SQL then...
EZWhere.

http://ferret.davebalmain.com/trac/

http://rubyforge.org/projects/ez-where/