lib/ratebeer/search.rb
def strip_generic_terms(query)
      generic_words = ["Brew",
                       "Brewers", 
                       "Brewery",
                       "Brewing",
                       "Brewhouse",
                       "Company",
                       "Co\.?",
                       "Inc\.?",
                       "Ltd\.?",
                       "Limited"]
      generic_words.map! { |w| /(^| )#{w}( |$)/i }
      generic_words.each { |w| query.gsub!(w, " ") }
      query.strip
    end
# Strip defined generic terms from query.
#
# This method removes all generic terms which may refer to a brewery, but
# which may not appear in the brewery's proper name, e.g. brewers.
#
# @param [String] query Raw query parameter
# @return [String] Query parameter with generics stripped out
#
Strip defined generic terms from query.
This method removes all generic terms which may refer to a brewery, but
which may not appear in the brewery's proper name, e.g. brewers.
Strip defined generic terms from query . This method removes all generic terms which may refer to a brewery but which may not appear in the brewery ' s proper name e . g . brewers .
def strip_generic_terms(query)
      generic_words = ["Brew",
                       "Brewers", 
                       "Brewery",
                       "Brewing",
                       "Brewhouse",
                       "Company",
                       "Co\.?",
                       "Inc\.?",
                       "Ltd\.?",
                       "Limited"]
      generic_words.map! { |w| /(^| )#{w}( |$)/i }
      generic_words.each { |w| query.gsub!(w, " ") }
      query.strip
    end
def strip_generic_terms ( query ) generic_words = [ "Brew" , "Brewers" , "Brewery" , "Brewing" , "Brewhouse" , "Company" , "Co\.?" , "Inc\.?" , "Ltd\.?" , "Limited" ] generic_words . map! { | w | / (^| ) #{ w } ( |$) /i } generic_words . each { | w | query . gsub! ( w , " " ) } query . strip end
Strip defined generic terms from query.
Strip defined generic terms from query .
Query parameter with generics stripped out
Query parameter with generics stripped out
String
query
query Raw query parameter
query Raw query parameter