Jump to content

MediaWiki-Docker/Extension/CirrusSearch

From mediawiki.org

This page instructs you to install Extension:CirrusSearch inside MediaWiki-Docker.

Follow the Quickstart instructions at MediaWiki-Docker page. Once MediaWiki is running and available at http://localhost:8080, then follow MediaWiki-Docker/Configuration_recipes/ElasticSearch to install elasticsearch and then continue with the instructions on this page.

All commands should be run in the directory where you installed MediaWiki. All mentioned files are also located there.

Clone the repository and its dependencies

[edit]
git clone "https://gerrit.wikimedia.org/r/mediawiki/skins/Vector" skins/Vector
git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/CirrusSearch" extensions/CirrusSearch
git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/Elastica" extensions/Elastica

Modify LocalSettings.php

[edit]

If not already there, add this to the end of LocalSettings.php.

wfLoadSkin( 'Vector' );
require_once "$IP/extensions/CirrusSearch/tests/jenkins/FullyFeaturedConfig.php";
if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
        $wgCirrusSearchServers = [
                [
                        'transport' => CirrusSearch\Elastica\DeprecationLoggedHttp::class,
                        "host" => "elasticsearch"
                ]
        ];
}
wfLoadExtension( 'CirrusSearch' );

Run maintenance scripts

[edit]

Prerequisite: Make sure composer.local.json exists in the mediawiki installation folder (if not, copy composer.local.json-example). This file instructs the composer-merge-plugin to consider nested composer.json files.

# Install dependencies for Elastica and CirrusSearch 
docker compose exec mediawiki composer install
# Update the mysql db (if not already done)
docker compose exec mediawiki php maintenance/run.php update.php
# Configure the search index and populate it with content
docker compose exec mediawiki php extensions/CirrusSearch/maintenance/UpdateSearchIndexConfig.php
docker compose exec mediawiki php extensions/CirrusSearch/maintenance/ForceSearchIndex.php --skipLinks --indexOnSkip
docker compose exec mediawiki php extensions/CirrusSearch/maintenance/ForceSearchIndex.php --skipParse
# Process the job queue. You need to do this any time you add/update content and want it updated in ElasticSearch
docker compose exec mediawiki php maintenance/runJobs.php
# Create the suggester index (autocomplete). It needs to be refreshed manually after adding/deleting new pages.
docker compose exec mediawiki php extensions/CirrusSearch/maintenance/UpdateSuggesterIndex.php