Extension:CirrusSearch
The CirrusSearch extension implements searching for MediaWiki using Elasticsearch.
See Help:CirrusSearch for documentation.
Contents
Project goals
- No weird dependencies that make this difficult to install
- The only dependencies should be pure-PHP MediaWiki extensions and Elasticsearch itself
- Provide a near-real-time search index for wiki pages that's extendable by other MediaWiki extensions
- Provide all of the query options MWSearch has given users, and more
Dependencies
- PHP and cURL
- In addition to the standard MediaWiki requirements for PHP, CirrusSearch requires PHP to be compiled with cURL support.
- Elasticsearch
- You will need to install Elasticsearch.
- MediaWiki 1.28.x requires ElasticSearch 2.x.
- MediaWiki 1.29.x and 1.30.x require ElasticSearch 5.3.x or 5.4.x.
- MediaWiki 1.31.x requires ElasticSearch 5.5.x or 5.6.x.
- Elastica is a PHP library to talk to Elasticsearch. Install Elastica per the instructions below.
Installation
Elastica
- Download and place the file(s) in a directory called
Elasticain yourextensions/folder.
- Add the following code at the bottom of your LocalSettings.php:
wfLoadExtension( 'Elastica' );
- In the downloaded files, open a command line and change to the subdirectory of the "Elastica" extension
- Run
composer install --no-dev- If you do not have Composer yet, you can download it from https://getcomposer.org (see also Composer)
Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
To users running MediaWiki 1.24 or earlier:
The instructions above describe the new way of installing this extension using wfLoadExtension() If you need to install this extension on these earlier versions (MediaWiki 1.24 and earlier), instead of wfLoadExtension( 'Elastica' );, you need to use:
require_once "$IP/extensions/Elastica/Elastica.php";
CirrusSearch
- Download and place the file(s) in a directory called
CirrusSearchin yourextensions/folder.
- Add the following code at the bottom of your LocalSettings.php:
require_once "$IP/extensions/CirrusSearch/CirrusSearch.php";
- Now follow the setup instructions in the CirrusSearch README delivered with your extension i.e.
$IP/extensions/CirrusSearch/README. Note that all info in it might not apply to your version of the extension, especially the version of Elasticsearch supported. - Configure as required.
Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Upgrading
Please follow the upgrade instructions in the CirrusSearch UPGRADE file.
Configuration
The configuration options of CirrusSearch are documented at the docs/settings.txt file, and also in the CirrusSearch.php file.
See also documentation on CirrusSearch configuration profiles.
Hooks
CirrusSearch extension defines a number of hooks that other extensions can make use of to extend the core schema and modify documents. The following hooks are available:
- CirrusSearchAnalysisConfig - allows to hook into the configuration for analysis
- CirrusSearchMappingConfig - allows configuration of the mapping of fields
- CirrusSearchBuildDocumentParse - allows extensions to modify ElasticSearch document produced from a page
- CirrusSearchBuildDocumentLinks - allows extensions to process incoming and outgoing links for the document
- CirrusSearchBuildDocumentFinishBatch - called when a batch of pages has been indexed
- CirrusSearchAddQueryFeatures - allows extensions to add query parser features
- CirrusSearchScoreBuilder - allows extensions to define rescore builder functions
API
CirrusSearch features can be used in API queries. A few examples and queries:
- Use the
morelike: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
?action=cirrusdumpparameter: 2014?action=cirrusdump?action=cirrusDumpQueryparameter to Special:Search queries: https://en.wikipedia.org/wiki/Special:Search/cat%20dog%20chicken?cirrusDumpQuery?action=cirrusDumpResultparameter to Special:Search queries: https://en.wikipedia.org/wiki/Special:Search/cat%20dog%20chicken?cirrusDumpResult- An additional parameter,
cirrusExplain, can be passed withcirrusDumpResultto have the lucene explanation of the the score included with the result dump: https://en.wikipedia.org/wiki/Special:Search/cat%20dog%20chicken?cirrusDumpResult&cirrusExplain cirrus-config-dump,cirrus-settings-dump,cirrus-mapping-dumpmodules to obtain dump from the CirrusSearch setup: api.php?action=cirrus-config-dump&formatversion=2
See also
- Help:CirrusSearch: documentation of what's specific to CirrusSearch
- MWSearch: the extension that provided MediaWiki search with Lucene on Wikimedia projects for many years
- Project page
- Info about Wikimedia Cirrus/Elastic setup
- Extension:CirrusSearch/Profiles - sets of tunable parameters that influence various aspect of the indexing
| This extension is being used on one or more Wikimedia projects. This probably means that the extension is stable and works well enough to be used by such high-traffic websites. Look for this extension's name in Wikimedia's CommonSettings.php and InitialiseSettings.php configuration files to see where it's installed. A full list of the extensions installed on a particular wiki can be seen on the wiki's Special:Version page. |
- GPL licensed extensions
- Stable extensions
- Extensions without an image
- Search extensions
- API extensions
- Hook extensions
- Extensions without a compatibility policy
- Extensions in Wikimedia version control
- AfterImportPage extensions
- APIAfterExecute extensions
- ApiBeforeMain extensions
- ArticleDelete extensions
- ArticleDeleteComplete extensions
- ArticleRevisionVisibilitySet extensions
- BeforeInitialize extensions
- GetBetaFeaturePreferences extensions
- GetPreferences extensions
- LinksUpdateComplete extensions
- MediaWikiServices extensions
- ResourceLoaderGetConfigVars extensions
- ShowSearchHitTitle extensions
- SoftwareInfo extensions
- SpecialSearchResults extensions
- SpecialSearchResultsAppend extensions
- TitleMove extensions
- TitleMoveComplete extensions
- UnitTestsList extensions
- UserGetDefaultOptions extensions
- CirrusSearchBuildDocumentFinishBatch extensions
- CirrusSearchBuildDocumentLinks extensions
- All extensions
- Extensions used on Wikimedia
- Discovery
- Search