From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png

Release status: beta

Implementation Special page
Description Allows MediaWiki integration with Google Custom Search or Google Site Search.
Author(s) Ike Hecht (tosfostalk)
Latest version 0.1 (December 2012)
MediaWiki 1.19+ (probably earlier too)
PHP 5.3+
Database changes no
License GPL
  • $gcwsReplaceSearch
  • $gcwsID
  • $gcwsCustomSearchOptions
  • $gcwsTheme
Hooks used

Translate the GoogleCustomWikiSearch extension if possible

Check usage and version matrix; code metrics

What can this extension do?[edit | edit source]

The Google Custom Wiki Search extension allows MediaWiki integration with Google Custom Search or Google Site Search.

This extension was sponsored by The Plant Encyclopedia and was developed by WikiWorks.

Usage[edit | edit source]

Defines a special page (Special:GoogleCustomWikiSearch) that performs a Google search on the wiki. Optionally, replaces the built-in search functionality with a Google search.

Download instructions[edit | edit source]

You can download the code, in .tgz format, here.

You can also download the code directly via Git from the MediaWiki source code repository. From a command line, you can call the following:

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/GoogleCustomWikiSearch.git

To view the code online, including version history for each file, go here.

Installation[edit | edit source]

To install this extension, add the following to LocalSettings.php:

require_once( "$IP/extensions/GoogleCustomWikiSearch/GoogleCustomWikiSearch.php" );

Configuration parameters[edit | edit source]

Basic[edit | edit source]

  • $gcwsID - Google Custom Search ID - requires account with Google. The ID can be found in your GCS control panel under "basic information". Note that if this is left blank (not set in LocalSettings), the result will be a Google site search.
  • $gcwsReplaceSearch - Set to true to completely replace the MediaWiki search engine with a Google search. Defaults to false.
  • $gcwsTheme - Possible values are: 'BUBBLEGUM', 'ESPRESSO', 'GREENSKY', 'MINIMALIST', 'SHINY'. Defaults to 'V2_DEFAULT'.

Advanced[edit | edit source]

  • $gcwsCustomSearchOptions - For those who want additional customization, set this instead of $gcwsID (which will be ignored if this is set). Set this variable to equal the insertion code provided by Google. Support for this feature is somewhat experimental.

It should be set similar to this example:

$gcsCustomSearchOptions = <<<END
    var customSearchOptions = {};
    var orderByOptions = {};
/* lots of other Google code here */

Note: The custom search options variable may leave out customSearchControl.draw, though options will only display then if the variable is named "options".

See also[edit | edit source]

Google Custom Search extensions[edit | edit source]

Google Site Search extensions[edit | edit source]

  • Extension:GoogleSiteSearch - Compatible with MW1.21+. Allows displaying results from both Google and the built-in search on the same page.