Skip to topic | Skip to bottom
TWiki
TWiki.GoogleAjaxSearchPluginr1.1 - 16 Nov 2006 - 21:52 - Main.guesttopic end

Start of topic | Skip to actions

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.

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, put in an INCLUDE as follows:
%INCLUDE{"%TWIKIWEB%.GoogleAjaxSearchPlugin" section="default" query="" web="TWiki"}%
The included section is:
%STARTSECTION{"default"}%%GOOGLEAJAXSEARCH%<div class="googleAjaxSearch"><strong>Search %web% </strong><input class="twikiInputField" size="55" id="googleAjaxSearchInputElement" value="%query%" /><input type="hidden" id="googleAjaxSearchWeb" value="%web%" /><input type="hidden" id="googleAjaxSearchlabel" value="%label%" /> <span class="twikiGrayText twikiSmallish">(results by Google !AJAX - Beta)</span><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: %SCRIPTURL{view}%/TWiki/GoogleAjaxSearchPlugin?googleAjaxQuery=htaccess (%SCRIPTURL{view}%/TWiki/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

Example

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

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.

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, put in an INCLUDE as follows:
%INCLUDE{"%TWIKIWEB%.GoogleAjaxSearchPlugin" section="default" query="" web="TWiki"}%
The included section is:
%STARTSECTION{"default"}%%GOOGLEAJAXSEARCH%<div class="googleAjaxSearch"><strong>Search %web% </strong><input class="twikiInputField" size="55" id="googleAjaxSearchInputElement" value="%query%" /><input type="hidden" id="googleAjaxSearchWeb" value="%web%" /><input type="hidden" id="googleAjaxSearchlabel" value="%label%" /> <span class="twikiGrayText twikiSmallish">(results by Google !AJAX - Beta)</span><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: %SCRIPTURL{view}%/TWiki/GoogleAjaxSearchPlugin?googleAjaxQuery=htaccess (%SCRIPTURL{view}%/TWiki/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

Example

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

Warning: Can't INCLUDE TWiki.GoogleAjaxSearchPlugin twice, topic is already included

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 Arthur Clemens
License: GPL
Dependencies: None
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

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 Arthur Clemens
License: GPL
Dependencies: None
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


to top


You are here: TWiki > GoogleAjaxSearchPlugin

to top

Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback