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
- Seems like digging through code.google 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.
- 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.
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
- Seems like digging through code.google. 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.
- 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.
Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked May 20, 2010 at 23:15 RileyRiley 4013 silver badges12 bronze badges 5- I'm not certain but you may have better luck with this on ServerFault – Josh Commented May 20, 2010 at 23:19
- Please, state clearly what is your question. Is the question "What XSLT applications are available for converting XM to JSON"? – Dimitre Novatchev Commented May 21, 2010 at 0:55
- @Dimitre Novatchev: Looking for viable solutions for providing JSON/JSONP data to a AJAX call; whether, it's directly from the Appliance Server or through middle-ware (PHP?) that can convert XML to JSON/P. – Riley Commented May 21, 2010 at 1:11
- I recently needed to make our Google Mini output JSON and JSONP format results and rolled my own XSLT template to produce JSON formatted results. I've put the code on github github./icerunner/google-mini – user2065383 Commented Feb 12, 2013 at 16:00
- 1 Philip, you can check out github./steveathon/GSJSON as another XSLT template to product JSON/JSONP formatted results. The Google Mini does deliver the results in the incorrect mime-type; therefore, some browsers produce an error message. – Riley Commented Feb 25, 2013 at 16:29
2 Answers
Reset to default 8I had the same problem trying to get JSON and JSONP. The solution worked in general on all other browsers, but IE. I could not change the mime-type to something other than text/html since that was global in GSA. Created an XSLT to solve that problem for browsers like IE which will not allow content to be returned due to a security feature ( IE – SEC7112 )
https://github./kjonnala/gsa_template
Hope that helps.
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./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 ining 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./group/Google-Search-Appliance-Help/browse_thread/thread/72406a271a6d9917/
http://www.mcplusa./blog/2009/07/adding-google-search-appliance-suggest-search-to-your-existing-page/
http://sites.google./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./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 ining 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 autoplete, so having the quick response (as they type) is important.