hoodwink.d enhanced
RSS
2.0
XHTML
1.0

RedHanded

Google Search For Rails #

by why in bits

Buncha great stuff comin out at Technoblog. Add a search box to your Rails site, simply by piping to Google’s SOAP endpoint.

 def search
   require 'soap/wsdlDriver'

   $KCODE = "UTF8" # in order to parse some of the odd characters
   key = 'yourGoogleKey'
   yoursite = 'yoursite.com'

   driver = SOAP::WSDLDriverFactory.new
    ("http://api.google.com/GoogleSearch.wsdl").createDriver
   @results = driver.doGoogleSearch(key,
    @params['q']+" site:#{yoursite}", 0, 10, true, " ", false, " ", " ", " ")
 end

Get your Google key here. (via del.icio.us)

Comments are closed for this entry.