Adding Google Search Appliance Suggest Search To Your Existing Page
July 28th, 2009
“Suggest” is a new beta feature on the Google Search Appliance 6.0. Out of the box, it is designed to work with the default style sheet. However, many of our clients have chosen to use a scripted page (asp/aspx/php/jsp). In order to get this functionality working, additional coding is required. This article describes wiring up the search box via a proxy and asp.
The Service
There is a new service located at /suggest. When you type the queries are sent to it. The response comes back as a simple JSON package. It is not encoded in JSONP so if you develop a separate page and want to use it, you’re faced with a cross site scripting issue.
The Solution
- Copy suggest_js.js to the site which you want to utilize the service.
- Create a proxy in your server (code below)
- suggest_js.js is obfuscated. But you just need to replace “/suggest” with the location of your new service (has to be at the same domain
- Add the .ac-renderer, .ac-row, .ac-highlighted and .ac-active styles to your page
- reference the new suggest_js.js file is reference in your html
- call the function sgst(‘q’);
- Start typing!
Proxy Example:
dim srcFile srcFile = "http://gsa.mcplusa.com/suggest?" srcFile = srcFile & "token=" & Request("token") & "&max_matches=10"</div> 'Get the JSON Response.Buffer = True Dim objXMLHTTP, xml 'Create an xmlhttp object Set xml = Server.CreateObject("Microsoft.XMLHTTP") xml.Open "GET", srcFile, False xml.Send Response.Write xml.responseText set xml= Nothing
Update!
Mahesh T published a java servlet here.




