Extension:GoogleCustomWikiSearch

From Linux Web Expert

Revision as of 03:54, 9 April 2024 by imported>MathXplore (Reverted edits by 169.197.142.134 (talk) to last version by Tosfos: reverting vandalism)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<translate> This extension is professionally maintained by the WikiTeq team.</translate>
<translate> WikiTeq provides official support for [[<tvar name=1>Special:MyLanguage/Version lifecycle</tvar>|MediaWiki LTS releases only]].</translate> <translate> It may work with other MediaWiki releases.</translate>
MediaWiki extensions manual
GoogleCustomWikiSearch
Release status: stable
Implementation Special page
Description Allows MediaWiki integration with Google Custom Search or Google Site Search.
Author(s) Ike Hecht (tosfostalk)
Maintainer(s) WikiTeq team
Latest version 0.6.0 (July 2021)
Compatibility policy For every MediaWiki release that is a Long Term Support release there is a corresponding branch in the extension.
MediaWiki 1.31-1.35, 1.39
Database changes No
Composer mediawiki/googlecustomwikisearch
License GNU General Public License 2.0
Download

  • $wgGoogleCustomWikiSearchId
  • $wgGoogleCustomWikiSearchReplaceSearch
  • $wgGoogleCustomWikiSearchAppendToSearch
  • $wgGoogleCustomWikiSearchTheme
  • $wgGoogleCustomWikiSearchCodeVersion
  • $wgGoogleCustomWikiSearchOptions
Quarterly downloads Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Public wikis using Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Translate the GoogleCustomWikiSearch extension if it is available at translatewiki.net
Issues Open tasks · Report a bug

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

Usage

Defines a special page (Special:GoogleCustomWikiSearch) that performs a Google search on the wiki. These results can also optionally be appended to the standard wiki search or can replace the built-in search functionality.

Download

<translate> The extension can be retrieved directly from Git</translate> [?]:

  • <translate> Browse code</translate>
  • <translate> Some extensions have tags for stable releases.</translate>
  • <translate> Each branch is associated with a past MediaWiki release.</translate> <translate> There is also a "master" branch containing the latest alpha version (might require an alpha version of MediaWiki).</translate>

<translate> Extract the snapshot and place it in the <tvar name=name>extensions/GoogleCustomWikiSearch/</tvar> directory of your MediaWiki installation.

If you are familiar with Git and have shell access to your server, you can also obtain the extension as follows: </translate>

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

Installation

  • <translate> [[<tvar name=2>Special:ExtensionDistributor/GoogleCustomWikiSearch</tvar>|Download]] and move the extracted <tvar name=name>GoogleCustomWikiSearch</tvar> folder to your <tvar name=ext>extensions/</tvar> directory.</translate>
    <translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/GoogleCustomWikiSearch
  • <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
    wfLoadExtension( 'GoogleCustomWikiSearch' );
    
  • Configure as required
  • File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>

<translate> To users running MediaWiki <tvar name=1>1.35</tvar> or earlier: </translate>

<translate> The instructions above describe the new way of installing this extension using <tvar name=LoadExtension>wfLoadExtension()</tvar>.</translate> <translate> If you need to install this extension on these earlier versions (MediaWiki <tvar name=1>1.35</tvar> and earlier), instead of <tvar name=code>wfLoadExtension( 'GoogleCustomWikiSearch' );</tvar>, you need to use:</translate>

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

Configuration

Important: The global names were changed in version 0.3!

Basic

  • $wgGoogleCustomWikiSearchId - 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. (Note: There is a bug in the current version. If this parameter is left blank, you must set $wgGoogleCustomWikiSearchCodeVersion = 1;.)
  • $wgGoogleCustomWikiSearchReplaceSearch - Set to true to completely replace the MediaWiki search engine with a Google search. Defaults to false.
  • $wgGoogleCustomWikiSearchAppendToSearch - Append to standard search results? Only makes sense if $wgGoogleCustomWikiSearchReplaceSearch is false.

Advanced

  • $wgGoogleCustomWikiSearchTheme - This may be overwitten by Control Panel settings in Google script Version 2. Possible values are: 'DEFAULT', 'BUBBLEGUM', 'ESPRESSO', 'GREENSKY', 'MINIMALIST', 'SHINY'
  • $wgGoogleCustomWikiSearchCodeVersion - What version of Google's script we should use. This defaults to Version 2, which allows customization in your GCS Control Panel. Can also be set to 1, which was the default in version < 0.3.
  • $wgGoogleCustomWikiSearchOptions - 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:
$wgGoogleCustomWikiSearchOptions = <<<END
    var customSearchOptions = {};
    var orderByOptions = {};
/* lots of other Google code here */
END;
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