Our own implementation code

 takes a normalized #search arguments hash from SearchEngine
 turns it into a URL for Google API. Factored out to make testing
 possible.
494802
def args_to_search_url(arguments)
      query = if arguments[:query].kind_of? Hash
        #multi-field
        arguments[:query].collect {|field, query_value| fielded_query(query_value, field)}.join(" ")
      elsif arguments[:search_field]
        fielded_query(arguments[:query], arguments[:search_field])
      else
        arguments[:query]
      end

      query_url = base_url + "volumes?q=#{CGI.escape  query}"
      if configuration.api_key
        query_url += "&key=#{configuration.api_key}"
      end

      if arguments[:per_page]
        query_url += "&maxResults=#{arguments[:per_page]}"
      end
      if arguments[:start]
        query_url += "&startIndex=#{arguments[:start]}"
      end

      if arguments[:sort] &&
          (defn = sort_definitions[arguments[:sort]]) &&
          (value = defn[:implementation])
        query_url += "&orderBy=#{CGI.escape(value)}"
      end


      return query_url
    end
1189530
function _normalizeArguments(obj) {
    var args = arguments;

    if (!obj || Utils.isFunction(obj)) {
      args = Array.prototype.slice.call(arguments, 0);
      args.unshift({});
    }

    // Split full path (/actions/_custom) - we get three parts:
    // 1) empty, 2) root path and 3) encoded action type name
    var url = this.path.split('/');

    args[0].url = '/' + url[1];
    args[0].params = Utils.extend(args[0].params, {
      filter: {
        name: decodeURIComponent(url[2])
      }
    });

    return args;
  }
1164811
def urlparams(url_, hash=None, **query):
    
    url = urlparse.urlparse(url_)
    fragment = hash if hash is not None else url.fragment

    # Use dict(parse_qsl) so we don't get lists of values.
    q = url.query
    query_dict = dict(urlparse.parse_qsl(smart_str(q))) if q else {}
    query_dict.update((k, v) for k, v in query.items())

    query_string = _urlencode([(k, v) for k, v in query_dict.items()
                               if v is not None])
    new = urlparse.ParseResult(url.scheme, url.netloc, url.path, url.params,
                               query_string, fragment)
    return new.geturl()
710168
function(href) {
		var url = extract(href)
		var queryObj = omit(url.qs, this.config.excludeRequestParams)

		var desiredUrlParams = Object.keys(queryObj).map(function(paramName) {
			return paramName + '=' + encodeURIComponent(queryObj[paramName])
		}).join('&')

		return desiredUrlParams ? url.url + '?' + desiredUrlParams : url.url
	}
327526
function mapUrlToProps(url, props) {
  return {
    foo: decode(UrlQueryParamTypes.number, url.fooInUrl),
    bar: url.bar,
  };
}
458658
def encode_uri_query_params(params)
      query = []

      params.each do |key, value|
        case value
        when Integer
          query << "#{key}=#{value}"
        when String, Symbol
          query << "#{key}=#{URI::Generic::DEFAULT_PARSER.escape(value.to_s)}"
        when TrueClass
          query << "#{key}"
        when FalseClass, NilClass
        else
          raise TypeError, "unexpected type: #{value.class}"
        end
      end

      "#{query.join('&'.freeze)}" if query.any?
    end
112962
function QueryString(search) {
        "use strict";
    
        if (search.substr(0, 1) === '?') {
            search = search.substr(1);
        }
    
        search = search.split('&')
    
        if (search == "") return {};
    
        for (var i = 0; i < search.length; ++i) {
    
            var param = search[i].split('=', 2);
            if (param.length != 2) {
                continue;
            }
    
            this[param[0]] = decodeURIComponent(param[1].replace(/\+/g, " "));
    
        }
    
    }
1261783
function buildUrlSearch(query) {

  function buildParam(key) {
    let value = query[key];
    if (value === null || value === undefined) value = '';
    else value = encodeURIComponent(value);
    return `${key}=${value}`;
  }

  return keys(query) . map(buildParam) . join('&');
}
253607
function (baseURL, params) {

            var encodedArgs = [];

            if (params){

                var key, urlarg;
                var urlize = encodeURIComponent;

                for (key in params){
                    if (params.hasOwnProperty(key)) {
                        urlarg = urlize(key)+'='+urlize(params[key]);
                        encodedArgs.push(urlarg);
                    }
                }
            }

            if (encodedArgs.length > 0){

                if (baseURL.indexOf('?') == -1)
                    return baseURL + '?' + encodedArgs.join('&');
                return baseURL + '&' + encodedArgs.join('&');
            }
            return baseURL;
        }
1330434
def process_url_params url, headers
      url_params = {}
      headers.delete_if do |key, value|
        if 'params' == key.to_s.downcase && value.is_a?(Hash)
          url_params.merge! value
          true
        else
          false
        end
      end
      unless url_params.empty?
        query_string = url_params.collect { |k, v| "#{k.to_s}=#{CGI::escape(v.to_s)}" }.join('&')
        url + "?#{query_string}"
      else
        url
      end
    end
616278
def connection_url_to_hash(url)
      url ||= ''
      uri = URI.parse url
      spec = {
        host:     uri.host,
        port:     uri.port,
        adapter:  uri.scheme,
        username: uri.user,
        password: uri.password,
        database: uri.path.sub(%r{^/}, '')
      }
      spec.reject! {|_, value| !value}
      {adapter: 'redis'}.merge spec
    end
54103
function queryUrlParam(key, url) {
  var value = url.match(new RegExp("[\?\&]" + key + "=([^\&]*)(\&?)", "i"));
  return value ? value[1] : ""
}
102218
function (url, key, value) {
                var regex = new RegExp("([?|&])" + key + "=.*?(&|#|$)(.*)", "gi"),
                    separator,
                    hash;

                if (regex.test(url)) {
                    url = url.replace(regex, '$1' + key + "=" + value + '$2$3');
                } else {
                    separator = url.indexOf('?') !== -1 ? '&' : '?';
                    hash = url.split('#');
                    url = hash[0] + separator + key + '=' + value;
                }
                return url;
            }
383076
function URLHelper(baseUrl) {
    var _this3 = this;

    _classCallCheck(this, URLHelper);

    _defineProperty(this, "baseUrl", '');

    _defineProperty(this, "search", {});

    var t = decodeURI(baseUrl).split('?');
    this.baseUrl = t[0];

    if (t[1]) {
      t[1].split('&').forEach(function (v) {
        var t2 = v.split('=');
        _this3.search[t2[0]] = t2[1] == null ? '' : decodeURIComponent(t2[1]);
      });
    }
  }
888290
def build_query_string(args,profile)
      query_params  = args.clone
      ga_start_date = query_params.delete(:start_date)
      ga_end_date   = query_params.delete(:end_date)
      ga_dimensions = query_params.delete(:dimensions)
      ga_metrics    = query_params.delete(:metrics)
      ga_sort       = query_params.delete(:sort)
      ga_filters    = query_params.delete(:filters)
      
      output = "ids=ga:#{profile}&start-date=#{ga_start_date}&end-date=#{ga_end_date}"
      unless ga_dimensions.nil? || ga_dimensions.empty?
        output += '&dimensions=' + ga_dimensions.collect do |dimension|
          "ga:#{dimension}"
        end.join(',')
      end
      unless ga_metrics.nil? || ga_metrics.empty?
        output += '&metrics=' + ga_metrics.collect do |metric|
          "ga:#{metric}"
        end.join(',')
      end
      unless ga_sort.nil? || ga_sort.empty?
        output += '&sort=' + Array(ga_sort).collect do |sort|
          sort[0..0] == '-' ? "-ga:#{sort[1..-1]}" : "ga:#{sort}"  # if the first character is a dash, move it before the ga:
        end.join(',')
      end
      
      # TODO: update so that in regular expression filters (=~ and !~), any initial special characters in the regular expression aren't also picked up as part of the operator (doesn't cause a problem, but just feels dirty)
      unless args[:filters].empty?    # filters are a little more complicated because they can have all kinds of modifiers
        output += '&filters=' + args[:filters].collect do |filter|
          match, name, operator, expression = *filter.match(/^(\w*)\s*([=!<>~@]*)\s*(.*)$/)           # splat the resulting Match object to pull out the parts automatically
          unless name.empty? || operator.empty? || expression.empty?                      # make sure they all contain something
            "ga:#{name}#{CGI::escape(operator.gsub(/ /,''))}#{CGI::escape(expression)}"   # remove any whitespace from the operator before output
          else
            raise GatticaError::InvalidFilter, "The filter '#{filter}' is invalid. Filters should look like 'browser == Firefox' or 'browser==Firefox'"
          end
        end.join(';')
      end
 
      query_params.inject(output) {|m,(key,value)| m << "&#{key}=#{value}"}
 
      return output
    end
568296
function searchToObject(urlSearch) {
	  //var urlSearch= window.location.search;
	  var pairs = urlSearch.substring(1).split("&"),
	    obj = {},
	    pair,
	    i;

	  for ( i in pairs ) {
	    if ( pairs[i] === "" ) continue;

	    pair = pairs[i].split("=");
	    obj[ decodeURIComponent( pair[0] ) ] = decodeURIComponent( pair[1] );
	  }

	  return obj;
	}
872623
function querystring(query) {
      var parser = /([^=?&]+)=([^&]*)/g
        , result = {}
        , part;

      //
      // Little nifty parsing hack, leverage the fact that RegExp.exec increments
      // the lastIndex property so we can continue executing this loop until we've
      // parsed all results.
      //
      for (;
        part = parser.exec(query);
        result[decodeURIComponent(part[1])] = decodeURIComponent(part[2])
      );

      return result;
    }