Extension:GoogleSiteSearch

This extension replaces the built-in MediaWiki search functionality with Google Site Search results for your site. Results are nearly seamless; go/search logic works as expected. ("Go" goes directly to an article if it exists, searches otherwise. "Search" always searches.)  Warning: This extension requires a small modification of core MediaWiki files (2-line addition).

For an example, please see http://www.finnix.org/Special:Search?search=Debian&go=Go

Installation
1. Download the zip file and extract so files are in extensions/GoogleSiteSearch.

2. Add the following to LocalSettings.php: require_once("extensions/GoogleSiteSearch/GoogleSiteSearch.php");

3. Edit includes/SpecialSearch.php and look for the following code block: function showResults( $term ) { $fname = 'SpecialSearch::showResults'; wfProfileIn( $fname ); ...

Unfortunately there's never a good hook around when you need it, so a code call must be inserted: wfshowResultsGoogle( $term ); return;

You should be left with something like this: function showResults( $term ) { wfshowResultsGoogle( $term ); return;

$fname = 'SpecialSearch::showResults'; wfProfileIn( $fname ); ...

4. Go to your MediaWiki installation, type something into the Search box. You should now see results from your site via Google Site Search.

Configuration
All configuration for GoogleSiteSearch is optional, and is performed in the LocalSettings.php file. All Google-specific variables can be configured via the $wgGoogleSiteSearchVars array. At the moment, there are no extension-specific variables.

$wgGoogleSiteSearchVars
The following example lists all defaults. $wgGoogleSiteSearchVars = array;

# Unless you have an odd MediaWiki setup, the same host as the search # should be fine. $wgGoogleSiteSearchVars['domains'] = $_SERVER['HTTP_HOST'];

# Ditto. $wgGoogleSiteSearchVars['sitesearch'] = $_SERVER['HTTP_HOST'];

# A valid Google AdSense or CoOp account. If this is not set, it defaults # to the author's AdSense account, so hey, no rush. $wgGoogleSiteSearchVars['client'] = 'pub-9372650377977516';

# If a Google AdSense account is specified, this can be set to a specific # channel. $wgGoogleSiteSearchVars['channel'] = '';

# Can probably be changed to UTF-8, but hasn't been tested yet. $wgGoogleSiteSearchVars['ie'] = 'ISO-8859-1';

# Can probably be changed to UTF-8, but hasn't been tested yet. $wgGoogleSiteSearchVars['oe'] = 'ISO-8859-1';

# The language to be displayed. $wgGoogleSiteSearchVars['hl'] = 'en';

# The default color scheme compliments MediaWiki well, but can be # customized here. $wgGoogleSiteSearchVars['cof'] = 'GALT:#008000;GL:1;DIV:#336699;VLC:663399;' . 'AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;' . 'GFNT:0000FF;GIMP:0000FF;FORID:9';

# Do not change. $wgGoogleSiteSearchVars['sa'] = 'Google Search';

# Do not change. $wgGoogleSiteSearchVars['forid'] = '1';