lib/ratebeer/search.rb
# Substitute known problematic terms in query.
#
# This method will replace terms which are known to cause problems in the
# search with different terms which do not cause the same problem.
#
# @param [String] query Raw query parameter
# @return [String] Query parameter with terms substituted
#
Substitute known problematic terms in query.
This method will replace terms which are known to cause problems in the
search with different terms which do not cause the same problem.
Substitute known problematic terms in query . This method will replace terms which are known to cause problems in the search with different terms which do not cause the same problem .
def substitute_known_terms(query)
      problem_terms = { "six°north" => "Six Degrees North",
                        /[\/:]/     => " " }
      problem_terms.each { |term, substitute| query.gsub!(term, substitute) }
      query.strip
    end
def substitute_known_terms ( query ) problem_terms = { "six°north"  >  Six Degrees North", / [ \/ :] / => " " } problem_terms . each { | term , substitute | query . gsub! ( term , substitute ) } query . strip end
Substitute known problematic terms in query.
Substitute known problematic terms in query .
# List of problem terms - key can be a string or regexp
Query parameter with terms substituted
Query parameter with terms substituted
String
query
query Raw query parameter
query Raw query parameter