Plugin

Developer
Supported

EE 1
EE 2
Google Search Results

Back to this add-on's main page
View Other Add-ons From Derek Hogue

     

You must be logged in to post.

Support for extra parameters

General

Chad Crowell
Chad Crowell

I have a G site search with these parameters:

<input name=“cx” type=“hidden” value=“017180522165740084141:v1wbqwoih_k” />
<input name=“as_q” type=“hidden” value=“more:tuck” />
<input name=“cof” type=“hidden” value=“FORID:11” />
<input name=“ie” type=“hidden” value=“UTF-8” />
<input id=“btnask” value=“Go” name=“submit” type=“submit” />

I just setup your plugin on the site and am passing the cse to it (cx value above) and also need to pass the as_q value to it to limit the results to a specific part of the collection.  Can this be done?

Derek Hogue
# 1
Developer
Derek Hogue

Hey Chad—the Google AJAX Search API doesn’t accept the advanced query parameters as far as I can tell, so using this method you’d have to add any results tweaks via the CSE control panel directly.

Matt Bower
# 2
Matt Bower

Hi Derek,

I’m Chad’s code monkey. I hacked your plugin to just add a few additional tag parameters and it worked great. I added the following just below the check for the “cse” param:


if($TMPL->fetch_param(‘as_q’) != FALSE) $args[‘as_q’] = $TMPL->fetch_param(‘as_q’);
if($TMPL->fetch_param(‘cof’) != FALSE) $args[‘cof’] = $TMPL->fetch_param(‘cof’);
if($TMPL->fetch_param(‘ie’) != FALSE) $args[‘ie’] = $TMPL->fetch_param(‘ie’);

I tried to find docs on some of these params. I couldn’t find them in Google’s docs (go figure) but came up with this page that mentions some other GSS params to consider adding support for. It looks like they can all just get rolled into the AJAX URL call.

http://itservices.stanford.edu/service/websearch/google/asq_documentation

Derek Hogue
# 3
Developer
Derek Hogue

Hey Matt—interesting to know, must be an undocumented part of the API. WIll add those parameter into an update. Thanks!

Matt Bower
# 4
Matt Bower

Hey Derek. Got passed this URL for GSS param docs. Not sure if you’ve seen this before or not. Seems pretty comprehensive.

http://www.google.com/cse/docs/resultsxml.html

Derek Hogue
# 5
Developer
Derek Hogue

Thanks Matt ... I’m not entirely sure that the AJAX Search API follows the same specs as the GSS, but when I get time I’ll experiment with that theory.