views:

150

answers:

1

Using Google Mini for a website that needs output from the Google Mini in a JSON/JSONP format for front-end querying purposes. Google Mini does publish an XML feed that could potentially be used by a middle process to convert to JSON/JSONP.

Can Google Search Appliance / Mini output to JSON/JSONP using a plug-in, modification to an XSLT template, or other unknown method?

Solutions discovered

  1. Seems like digging through code.google.com reveals that GSA/Mini does not have a method to output in the JSON/JSONP format without using XSLT to create the feed. It is a matter of creating this XSLT to do the conversion.
  2. Other option is to create a server-side script using available technology (PHP?) to retrieve the XML from GSA/Mini and convert the feed to JSONP upon request from the Front-end (AJAX). Downside is the increased overhead in this call.

Update 10/8/2010

Created a Google Mini frontend that generates a JSONP response.

+1  A: 

I'm working on approach #2 above. We have version 6.4 of the appliance and it provides JSON for the suggestion service (probably new since Riley's question). For example:

http://code.google.com/apis/searchappliance/documentation/64/xml_reference.html#RichOutputFormat

What I ran into was that cross-domain limitations prevented using the appliance JSON service on non-appliance website search forms, including those in subdomains of our shared high level domain.

I'm testing a simple Java servlet now that makes the suggest call. It takes incoming requests, gets the response from the appliance, outputs in JSONP and sends back to the calling page.

There are a couple references I've found related to proxying the suggest service:

http://groups.google.com/group/Google-Search-Appliance-Help/browse_thread/thread/72406a271a6d9917/

http://www.mcplusa.com/blog/2009/07/adding-google-search-appliance-suggest-search-to-your-existing-page/

http://sites.google.com/site/lightbends/gsa_qs_6_2

and some related to JSONP with jQuery:

http://devlog.info/2010/03/10/cross-domain-ajax/

http://www.ibm.com/developerworks/library/wa-aj-jsonp1/

JSON to JSONP in the servlet is quick and probably dirty in the approach I'm taking :)

It's not in production yet, so I can't speak to what we'll find in terms of performance and other challenges. I like that the service is exposed from a secondary server rather than directly from the appliance (allowing for throttling of incoming requests if needed, etc.) if the performance can keep up.

October 1, 2010 Update

Sorry - my post above applies only to the suggest service and not to the general search results. You could still take the XML response, process and wrap that in JSON/JSONP, but that would take longer I suspect. I was using the JSONP in the context of suggesting search queries with jQuery autocomplete, so having the quick response (as they type) is important.

gcbound