lib/ratebeer/search.rb
# Amend search query string for better results
#
# RateBeer is a little finicky about finding search results. It does not
# provide results on abbreviations, and a passed query including special
# characters will return no hits. Often searching using a generic term such
# as Co, Brewers, Brewery, etc. will not return any results. This method
# strips out such generic terms from a query.
#
# This method attempts to deal with these issues.
#
# @param [String] query Raw query parameter
# @return [String] Query parameter amended to improve results
#
Amend search query string for better results
RateBeer is a little finicky about finding search results. It does not
provide results on abbreviations, and a passed query including special
characters will return no hits. Often searching using a generic term such
as Co, Brewers, Brewery, etc. will not return any results. This method
strips out such generic terms from a query.

This method attempts to deal with these issues.
Amend search query string for better results RateBeer is a little finicky about finding search results . It does not provide results on abbreviations and a passed query including special characters will return no hits . Often searching using a generic term such as Co Brewers Brewery etc . will not return any results . This method strips out such generic terms from a query . This method attempts to deal with these issues .
def fix_query_param(query)
      query = strip_generic_terms(query)
      query = substitute_known_terms(query)
      I18n.transliterate(query)
    end
def fix_query_param ( query ) query = strip_generic_terms ( query ) query = substitute_known_terms ( query ) I18n . transliterate ( query ) end
Amend search query string for better results
RateBeer is a little finicky about finding search results.
Amend search query string for better results RateBeer is a little finicky about finding search results .
Query parameter amended to improve results
Query parameter amended to improve results
String
query
query Raw query parameter
query Raw query parameter