Extension:GoogleSiteSearch/cs

Category:GPL licensed extensions/cs
Příručka k rozšířením MediaWiki
GoogleSiteSearch
Stav rozšíření: stabilníCategory:Stable extensions/cs
Implementace HledáníCategory:Search extensions/cs
Popis Přidá před výsledky vyhledávání Special:Search výsledky vyhledávače Google CSE nebo je nahradí.
Autoři Ryan Finnie (Fo0bardiskuse)
Správci Sophivorus
Nejnovější verze 3.1 (2022-09-23)
MediaWiki 1.32+Category:Extensions with manual MediaWiki version
PHP 7.0+
Licence GNU General Public License 2.0 nebo novější
Stáhnout Category:Extensions in Wikimedia version control/cs
Příklad appropedia.org search result
  • $wgGoogleSiteSearchAppend
  • $wgGoogleSiteSearchOnly
  • $wgGoogleSiteSearchCSEID
  • $wgGoogleSiteSearchAttributes
Čtvrtletní stahování 7 (Ranked 94th)
Přeložte rozšíření GoogleSiteSearch, používá-li lokalizaci z translatewiki.net
Category:All extensions/cs

The GoogleSiteSearch extension allows you to prepend Google Custom Search Engine (CSE) results to "Special:Search" additionally to MediaWiki search results, or optionally, replace them altogether.

Instalace

  • Go to the Google CSE management page and add a custom search engine. Note down the "Search engine unique ID". It should be in the format numbers:letters.
  • Stáhněte soubor/y a vložte je do adresáře pojmenovaného GoogleSiteSearch ve vaší složce extensions/.
    Vývojáři a přispěvatelé kódu by si místo toho měli nainstalovat rozšíření from Git pomocí:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/GoogleSiteSearch
  • Na konec vašeho souboru LocalSettings.php přidejte následující kód:
    wfLoadExtension( 'GoogleSiteSearch' );
    $wgGoogleSiteSearchCSEID = 'YOUR_CSE_ID';
    
  • Configure as required.
  • Yes Dokončeno – Přejděte na stránku Special:Version vaší wiki a zkontrolujte, zda bylo rozšíření úspěšně nainstalováno.

Konfigurace

K dispozici jsou následující konfigurační parametry:

$wgGoogleSiteSearchCSEID
The ID of the created Google custom search engine. Required.
$wgGoogleSiteSearchOnly
Whether to replace the the MediaWiki search results. If true, only the CSE search results are shown. If false, the CSE results are shown above the MediaWiki results. Optional, defaults to false.
$wgGoogleSiteSearchAppend
Whether to prepend (not append) rather than replace the Google search results. Defaults to false. Note that under some circumstances, for example when they're too many or no search results, the relevant hook may not fire and Google search results will not be appended.
$wgGoogleSiteSearchAttributes
An array of optional Custom Search element attributes. For example, to make links open in a new window/tab:
$wgGoogleSiteSearchAttributes = [
	'linkTarget' => '_blank'
];

In addition, the HTML built by the extension is customizable via the "GoogleSiteSearchHTML" hook. For example:

$wgHooks['GoogleSiteSearchHTML'][] = function ( $specialSearch, $term, &$html ) {
	$html .= '<p>Example append</p>';
};

Související odkazy

  • Extension:GoogleCustomWikiSearch - Offers similar functionality but appends search after, rather than before MediaWiki search if set to add to, rather than replace, search.
Category:Google extensions/cs Category:Search extensions/cs
Category:All extensions/cs Category:Extensions in Wikimedia version control/cs Category:Extensions with manual MediaWiki version Category:GPL licensed extensions/cs Category:Google extensions/cs Category:Search extensions/cs Category:SpecialSearchResultsAppend extensions/cs Category:SpecialSearchResultsPrepend extensions/cs Category:Stable extensions/cs