rails search method for full string match and not substring when tagging used in blog -
i want full text search multiple words matches tags in blog in text field , not use "like" keyword in blog.rb matches substring(matching of substrings should not there). text entered should match tag. example: 'foo bar' tag should match search 'foo bar' , not 'foo' or 'bar'. changes need done following code in blog.rb?
class blog < activerecord::base extend friendlyid friendly_id :slugurl, use: :slugged, slug_column: :slugurl def self.search(search) words = search.to_s.downcase.strip.split.uniq words.map! { |word| "tag '%#{search}%'" } psql = words.join(" , ") self.where(psql) end end
can me exact search method multiple tags?
Comments
Post a Comment