扩展:GoogleCustomWikiSearch

From mediawiki.org
This page is a translated version of the page Extension:GoogleCustomWikiSearch and the translation is 100% complete.
This extension is professionally maintained by the WikiTeq team.
WikiTeq provides official support for MediaWiki LTS releases only. It may work with other MediaWiki releases.
MediaWiki扩展手册
GoogleCustomWikiSearch
发行状态: 稳定版
实现 特殊页面
描述 允许MediaWiki与Google自定义搜索或与Google站点搜索集成。
作者 Ike Hecht (tosfos留言)
维护者 WikiTeq team
最新版本 0.6.0 (2021年7月)
兼容性政策 对于每个有长期支持的MediaWiki发行版本,扩展内都有对应的分支。
MediaWiki 1.31-1.35, 1.39
数据库更改
Composer mediawiki/googlecustomwikisearch
许可协议 GNU通用公眾授權條款2.0
下載

  • $wgGoogleCustomWikiSearchId
  • $wgGoogleCustomWikiSearchReplaceSearch
  • $wgGoogleCustomWikiSearchAppendToSearch
  • $wgGoogleCustomWikiSearchTheme
  • $wgGoogleCustomWikiSearchCodeVersion
  • $wgGoogleCustomWikiSearchOptions
季度下載量 15 (Ranked 130th)
前往translatewiki.net翻譯GoogleCustomWikiSearch扩展
問題 开启的任务 · 报告错误

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

用法

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.

下載

此扩展可直接从Git检索到 [?]:

  • 浏览代码
  • 部分扩展有稳定版本标签。
  • 每个分支与过去的MediaWiki发布版本相关联。 这里也有一个“主线”分支,包含最新alpha版本(可能需要MediaWiki的alpha版本)。

提取快照,并将它放置在您的MediaWiki安装副本的extensions/GoogleCustomWikiSearch/目录中。

如果您对git熟悉,并且拥有您服务器的shell访问权,您也可以通过以下方法获得扩展:

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

安裝

  • 下载文件,并将其放置在您extensions/文件夹中的GoogleCustomWikiSearch目录内。
    开发者和代码贡献人员应从Git安装扩展,输入:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/GoogleCustomWikiSearch
  • 将下列代码放置在您的LocalSettings.php 的底部:
    wfLoadExtension( 'GoogleCustomWikiSearch' );
    
  • Configure as required
  • Yes 完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。

致使用MediaWiki 1.35或更早版本的用户:

上面的说明介绍的是安装此扩展的新方法,它使用wfLoadExtension()。 如果您需要在早期版本(MediaWiki 1.35和更早版本)中安装此扩展,而不是wfLoadExtension( 'GoogleCustomWikiSearch' );,您需要使用:

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

配置

Important: The global names were changed in version 0.3!

基础

  • $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.

高级

  • $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".

参见