Tags:
ajax1Add my vote for this tag search1Add my vote for this tag create new tag
, view all tags

Google AJAX Search Plugin

Wrapper plugin for a dynamic search service provided by Google.

About 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.

NOTE: the Google key must be valid for the directory/directories you will be searching in. If you are going to search all webs, pass http://yourdomain/twiki/bin/view/ as url.

Set GOOGLEKEY below in Settings.

Restricting search to a site or Web

To obtain results from a particular website, set variable GOOGLESEARCHSITE.

To get results from one TWiki Web only, set variable GOOGLESEARCHWEB in combination with GOOGLESEARCHSITE.

For example:

   * Set GOOGLESEARCHWEB = TWiki
   * Set GOOGLESEARCHSITE = http://twiki.org/cgi-bin/view/
Set the variables below in Settings.

Putting a search box

Start a search box with %GOOGLEAJAXSEARCH%.

The JavaScript code written by the plugin assumes a html container element exists with id googleAjaxSearchControl. The results will be written to this element.

The input field should have the id googleAjaxSearchInputElement.

Current limitation: there may only be one search box on a page.

Example:

%GOOGLEAJAXSEARCH%
<div class="googleAjaxSearch">
<strong>Search %GOOGLESEARCHWEB% </strong><input class="twikiInputField" size="55" id="googleAjaxSearchInputElement" value=""/>
<span class="twikiGrayText twikiSmallish">(results by Google !AJAX - Beta)</span>
<div id="googleAjaxSearchControl"></div>
</div><!--//googleAjaxSearch-->

An input field with id 'googleAjaxSearchWeb' may override GOOGLESEARCHWEB. For example:

<input type="hidden" id="googleAjaxSearchWeb" value="Main" />

An input field with id 'googleAjaxSearchLabel' may override GOOGLESEARCHLABEL. For example:

<input type="hidden" id="googleAjaxSearchlabel" value="twiki.org TWiki Web" />

Re-use

To show the search box in another topic, write this:

%INCLUDE{"%TWIKIWEB%.GoogleAjaxSearchPlugin" section="default" query="" web="%BASEWEB%" label="%BASEWEB% Web (results by Google)"}%

This will include the following section (leave as is, no need to copy this):

%STARTSECTION{"default"}%%GOOGLEAJAXSEARCH%<div class="googleAjaxSearch"><strong>Search %BASEWEB% </strong><input class="twikiInputField" size="50" id="googleAjaxSearchInputElement" value="%query%" /><input type="hidden" id="googleAjaxSearchWeb" value="%BASEWEB%" /><input type="hidden" id="googleAjaxSearchlabel" value="%label%" />
<div id="googleAjaxSearchControl"></div></div><!--//googleAjaxSearch-->%ENDSECTION{"default"}%

Start search automatically

To start off with a search, pass a default search string to the input field.

Start search automatically by URL parameter

Pass parameter googleAjaxQuery to the url to start off a default search. For example: http://www.twiki.org/cgi-bin/view/Plugins/GoogleAjaxSearchPlugin?googleAjaxQuery=htaccess

Test this: http://www.twiki.org/cgi-bin/view/Plugins/GoogleAjaxSearchPlugin?googleAjaxQuery=htaccess

A URL parameter will override a locally set search input value.

Customizing

Setting a custom label

You can set the label of the search results to a custom string by defining GOOGLESEARCHLABEL in Settings.

Settings

For an explanation of the following variables read above. These are example variable values:
  • Set GOOGLEKEY = XXXXXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-XXXXXXX
  • Set GOOGLESEARCHWEB =
  • Set GOOGLESEARCHSITE = http://twiki.org/cgi-bin/view/
  • Set GOOGLESEARCHLABEL = twiki.org
  • Set SHORTDESCRIPTION = Dynamic Google AJAX search service for public TWiki sites

You can set these values in this topic, or in any other topic where %GOOGLEAJAXSEARCH% is written. Note that you will need to use the syntax GOOGLEAJAXSEARCHPLUGIN_MYVARIABLE if you set the variable in a different web.

Example

To see it work (if installed and the right Google key is set):

Warning: Can't find topic TWiki06x00.GoogleAjaxSearchPlugin

Plugin Installation Instructions

  • Download the ZIP file from the Plugin web (see below)
  • Unzip GoogleAjaxSearchPlugin.zip in your root ($TWIKI_ROOT) directory. Content:
    File: Description:
    data/TWiki/GoogleAjaxSearchPlugin.txt  
    lib/TWiki/Plugins/GoogleAjaxSearchPlugin/build.pl  
    lib/TWiki/Plugins/GoogleAjaxSearchPlugin.pm  
    pub/TWiki/GoogleAjaxSearchPlugin/googleAjaxSearch.css  
    pub/TWiki/GoogleAjaxSearchPlugin/googleAjaxSearch.js  

  • Optionally, if it exists, run GoogleAjaxSearchPlugin_installer to automatically check and install other TWiki modules that this module depends on. You can also do this step manually.
  • Alternatively, manually make sure the dependencies listed in the table below are resolved. None
  • (Dakar) Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.

Contrib Info

Authors: TWiki:Main.ArthurClemens
Copyright ©: 2006, 2007 Arthur Clemens
License: GPL
Dependencies: None
25 Jan 2007 1.0.4 Doc fixes
22 Nov 2006 1.0.3 Settings can now be written in any topic
22 Jul 2006 1.0.2 Added Lazy loading
22 Jul 2006 1.0.1 Added GOOGLESEARCHLABEL; various bug fixes
20 Jul 2006 1.0.0 First Version
Home: http://TWiki.org/cgi-bin/view/Plugins/GoogleAjaxSearchPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/GoogleAjaxSearchPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/GoogleAjaxSearchPluginAppraisal

Related Topics: TWikiPreferences

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatmd5 GoogleAjaxSearchPlugin.md5 r10 r9 r8 r7 r6 manage 0.2 K 2008-12-12 - 11:31 SopanShewale checksum file , Uploaded as a part of Release Process
Compressed Zip archivetgz GoogleAjaxSearchPlugin.tgz r10 r9 r8 r7 r6 manage 6.2 K 2008-12-12 - 11:31 SopanShewale See GoogleAjaxSearchPlugin for details. Untar and run the installer script, Uploaded as a part of Release Process
Compressed Zip archivezip GoogleAjaxSearchPlugin.zip r10 r9 r8 r7 r6 manage 8.8 K 2008-12-12 - 11:31 SopanShewale See GoogleAjaxSearchPlugin for details. Unzip and run the installer script , Uploaded as a part of Release Process
Unknown file formatEXT GoogleAjaxSearchPlugin_installer r4 r3 r2 r1 manage 3.6 K 2008-12-12 - 11:31 SopanShewale Installer Script, Uploaded as a part of Release Process
Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r9 - 2008-12-12 - SopanShewale
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2016 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.