temporarily using old search for debates

This commit is contained in:
rgarcia
2015-10-30 21:54:15 +01:00
parent 9132406569
commit ebf44c8777

View File

@@ -119,7 +119,12 @@ class Debate < ActiveRecord::Base
end
def self.search(terms)
self.pg_search(terms)
return none unless terms.present?
debate_ids = where("debates.title ILIKE ? OR debates.description ILIKE ?",
"%#{terms}%", "%#{terms}%").pluck(:id)
tag_ids = tagged_with(terms, wild: true, any: true).pluck(:id)
where(id: [debate_ids, tag_ids].flatten.compact)
end
def after_hide