If you need a full text search engine, Thinking Sphinx is a great solution. See why in this episode.
script/plugin install git://github.com/freelancing-god/thinking-sphinx.git
rake thinking_sphinx:index
rake thinking_sphinx:start
# models/author.rb
define_index do
indexes content
indexes :name, :sortable => true
indexes comments.content, :as => :comment_content
indexes [author.first_name, author.last_name], :as => :author_name
has author_id, created_at
end
# articles_controller.rb
@articles = Article.search params[:search]
# :include => :author
# :conditions => { :created_at => 1.week.ago.to_i..Time.now.to_i }
# :order => :name
# :field_weights => { :name => 20, :content => 10, :author_name => 5 }
# :match_mode => :boolean
# :page => 1, :per_page => 20