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.





March 30th, 2011 at 8:52 am
Does this still work for the latest GSA version (6.8)? Also, how do I create the Proxy?
April 4th, 2011 at 5:54 pm
In principle yes, however Google has updated the JavaScript and the stylesheets. For one, the code is not obfuscated any longer (nor does the css reference corp.google.com
).
There is more information here: http://code.google.com/apis/searchappliance/docum…
But you still need to get the request from the browser to the GSA some how. You can also create a proxy with an apache configuration or some simple code in C#. java, php, etc. Good luck!
July 27th, 2011 at 10:59 pm
Yes and no. The suggest service has been redesigned (it no longer references css/images in corp.google.com
) You can get the updated scripts from the gsa directly.