google_custom_search_api icon indicating copy to clipboard operation
google_custom_search_api copied to clipboard

Choosing from multiple engines

Open drKreso opened this issue 11 years ago • 0 comments

Hi nice library you have.

I had a need to use multiple search engines and single constant was not working for me.

This would be alternative syntax: GOOGLE_ENGINES = { :japanese => { "GOOGLE_API_KEY" => "zz", "GOOGLE_SEARCH_CX" => "yy" }, :chinese => { "GOOGLE_API_KEY" => "bb", "GOOGLE_SEARCH_CX" => "ee" } }

and then on search:

GoogleCustomSearchApi.search(title, :engine_keys => GOOGLE_ENGINES[:japanese])

Sorry about my editor being a whitespace nazzi, the changes are only in url method.

drKreso avatar Jun 17 '13 18:06 drKreso