Extension:CirrusSearch/zh

CirrusSearch扩展使用Elasticsearch实现搜索MediaWiki.

这个页面的内容与插件的安装有关. 安装成功后，参看以了解用法

项目目标
提供为用户提供的所有查询选项等
 * 去除使该扩展难以安装的复杂依赖关系
 * 唯一的依赖项应该是纯PHP MediaWiki扩展和Elasticsearch本身
 * 为其他MediaWiki扩展可扩展的Wiki页面提供近实时搜索索引

依赖性

 * PHP 和 cURL
 * In addition to the standard MediaWiki requirements for PHP, CirrusSearch requires PHP to be compiled with cURL support.
 * Elasticsearch
 * 你需要安装Elasticsearch.

Take note that a Java installation like OpenJDK is needed in addition.


 * Elastica is a PHP library to talk to Elasticsearch. Install Elastica per the instructions below.
 * Elastica is a PHP library to talk to Elasticsearch. Install Elastica per the instructions below.


 * 其他
 * Due to the actual handling of jobs by the CirrusSearch extension, it is advisable to set up jobs in Redis to prevent messages like Notice: unserialize: Error at offset 64870 of 65535 bytes in JobQueueDB.php and subsequent errors like Unsupported operand types. 参见

Even though the instructions below tell you to only run Composer when installing from git, it may be necessary to issue it anyway in order to install all PHP dependencies.

升级
请遵循在CirrusSearch 中的升级指南.

配置
The configuration parameters of CirrusSearch are documented at the file, and also in the  file. See also documentation on CirrusSearch configuration profiles.

钩子
CirrusSearch extension defines a number of hooks that other extensions can make use of to extend the core schema and modify documents. 以下钩子可用：


 * - allows to hook into the configuration for analysis
 * - allows configuration of the mapping of fields
 * - allows extensions to modify ElasticSearch document produced from a page
 * - allows extensions to process incoming and outgoing links for the document
 * - called when a batch of pages has been indexed
 * - allows extensions to add query parser features
 * - allows extensions to define rescore builder functions

API
CirrusSearch features can be used in API queries. Searching happens via the normal search API, ; you can use CirrusSearch-specific features, such as the   special prefix to find pages related to Marie Curie and radium: api.php?action=query&list=search&srsearch=morelike:Marie_Curie%7Cradium&srlimit=10&srprop=size&formatversion=2 Custom APIs and parameters are provided for querying CirrusSearch configuration and debug information:


 * module: 2014?action=cirrusdump
 * parameter to Special:Search or search API queries: https://en.wikipedia.org/wiki/Special:Search/cat%20dog%20chicken?cirrusDumpQuery
 * parameter to Special:Search or search API queries: https://en.wikipedia.org/wiki/Special:Search/cat%20dog%20chicken?cirrusDumpResult
 * An additional parameter,, can be passed with   to have the Lucene explanation of the score included with the result dump: https://en.wikipedia.org/wiki/Special:Search/cat%20dog%20chicken?cirrusDumpResult&cirrusExplain It can also be used to get the explanation in a human-readable format, by giving it one of the values  ,   or  , such as: https://en.wikipedia.org/wiki/Special:Search/cat%20dog%20chicken?cirrusDumpResult&cirrusExplain=pretty
 * , ,   modules to obtain dump from the CirrusSearch setup: api.php?action=cirrus-config-dump&formatversion=2

参见

 * - CirrusSearch usage documentation (needed after the install)
 * - the historical extension that provided MediaWiki search with Lucene on Wikimedia projects for many years
 * Info about Wikimedia Cirrus/Elastic setup
 * - sets of tunable parameters that influence various aspect of the indexing
 * - sets of tunable parameters that influence various aspect of the indexing

Local development
Elastic Search service can be run with the Vagrant role and MediaWiki Vagrant.

For Docker, you can use a command like. Then follow the installation and configuration directions. If your web host is in a container you'll want to make sure the above container is on the same network, and in LocalSettings.php you will want to reference  as the host name. This will not have the WMF plugins but can be sufficient for basic testing.