Search code now uses ActiveRecord instead of SQL.