r14 - 04 Nov 2007 - 09:02:06 - PeterThoenyYou are here: TWiki >  TWiki Web > SupplementalDocument > SearchSupplement > GoogleAjaxSearch
Tags:
, create new tag
Search TWiki Web: (results by Google AJAX - Beta)

ALERT! NOTE: This is a SupplementalDocument topic which is not included with the official TWiki distribution. Please help maintain high quality documentation by fixing any errors or incomplete content. Put questions and suggestions concerning the documentation of this topic in the comments section below! Use the Support web for problems you are having using TWiki.

Google AJAX Search

The Google AJAX Search API is an experimental API that lets you integrate a dynamic Google search module into your web pages so your users can mash up Google search results with other content on your site or add search results clippings to their own content.

Note that this service (as stated by Google themselves):

  • Is in BETA
  • Will likely change in the future, so the current implementation may break
  • Future versions may contain ads

If you want to put this service on your own site you need to obtain a (free) unique key from Google.

Search box example

On this site:
%INCLUDE{"%TWIKIWEB%.GoogleAjaxSearch" type="section" section="googleajaxsearch" searchweb="%INCLUDINGWEB%" searchquery="%AQSEARCH%"}%

The provided example code (see raw text) will retrieve results from domain http://twiki.org/cgi-bin/view/ plus the passed web in searchweb.

Start search by default

Pass parameter aq to the url to start off a default search. For example: http://twiki.org/cgi-bin/view/Support/WebHome?aq=htaccess (Support on htaccess). Note: this code uses JavaScript function TWiki.PageQuery that is available in SVN from revision 11031.

Or set the variable AQSEARCH in any topic. For example:

   * #Set AQSEARCH = search
(remove dash to make this work)

Re-use

To show the search box site-wide, you can put it in a BROADCASTMESSAGE (in each WebPreferences). Put:
   * Set BROADCASTMESSAGE = %INCLUDE{"TWiki.GoogleAjaxSearch" type="section" section="googleajaxsearch_broadcastmessage" searchquery="%AQSEARCH%"}%

Again, see the raw topic source for details.

-- ArthurClemens - 16 Jul 2006



Comments & Questions about this Supplemental Document Topic

Thank you very much Arthur for bringing a very usable search to twiki.org!

I externalized the AJAX part from the SearchSupplement topic to this GoogleAjaxSearch topic. The SearchSupplement topic should just be an index for supplemental search topics.

I also added leading space to the "googleajaxsearch" section so that the BROADCASTMESSAGE bullets in the WebPreferences topics close properly.

-- PeterThoeny - 17 Jul 2006

Moved development discussion to Codev.GoogleAjaxSearchDevelopment

-- ArthurClemens - 17 Jul 2006

I had to disable the Google search for now since we get an error on each page view: "Google AJAX Search API Load Failure: invalid api key supplied"

This is most likely due to the number of page views on TWiki.org. We have around 20K page views per day, and Google has this at http://www.google.com/apis/: "Your Google Account and license key entitle you to 1,000 automated queries per day."

Is it possible to suppress the Google call on the page view, and issue a call only when something is typed into the search box?

-- PeterThoeny - 17 Jul 2006

The '1000 automated queries' limit is for SOAP queries as far as I can see. I don't see such a limit in the Google AJAX Search API Terms of Use.

It may have been a coincidence that you saw a page when I was trying to lift out the key in a variable, which didn't work out.

I don't think a Google query is made when the box is empty.

Let's try it on one more time...

-- ArthurClemens - 18 Jul 2006

Yes, lets see if it works now.

I have seen the error message on each page load, that is, Google is accessed on page load as well.

-- PeterThoeny - 18 Jul 2006

I was seeing this earlier today, but not now. So it's still an issue, although intermitent.

I'm also not keen on the current placement. Is it possible to get it into the header so when it's used it expands downwards overlapping the content?

-- SamHasler - 28 Aug 2006

My browser now crashes, totally, after accessing several Twiki.org pages. No other site does this! This occurs even if I set the skin=plain for pages. So I can only assume this is GoogleAjaxSearch related as with the plain skin that's pretty much the only javascript left. Turning off Java-Script was the only way I could get to this page, for example. Here are my browser details...

Mozilla 1.7.12 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20051007 Debian/1.7.12-1 Linux snorky 2.6.12-1-686 #1 Tue Sep 27 12:52:50 JST 2005 i686 GNU/Linux

  • Could you try Sandbox web to see if you're problem is indeed Google Ajax Search related? On that web we don't have the search installed. -- ArthurClemens - 01 Sep 2006
  • My apologies. I can't repeat the crash now, even though I haven't updated anything. Must have been caused by something else. -- LyleWinton - 19 Sep 2006

-- LyleWinton - 01 Sep 2006

I can't find a working demo of this plugin.

http://twiki.org/cgi-bin/view/Plugins/GoogleAjaxSearchPlugin#Example

Doesn't work.

-- JasonMurdoch - 03 Nov 2007

We disabled this plugin on twiki.org.

-- PeterThoeny - 04 Nov 2007

 
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r14 < r13 < r12 < r11 < r10 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo