Skip to content

mw dev opensearch

Releasev0.35.0 · cfeceb67

Using this will automatically configure an opensearch server for MediaWiki via the CirrusSearch extension. In order for this to do anything you will need to CirrusSearch extension installed and enabled.

$wgCirrusSearchServers = [ 'opensearch' ];

In order to configure a search index for a wiki, you’ll need to run some maintenance scripts:

Terminal window
# Configure the search index and populate it with content
php extensions/CirrusSearch/maintenance/UpdateSearchIndexConfig.php
php extensions/CirrusSearch/maintenance/ForceSearchIndex.php --skipLinks --indexOnSkip
php extensions/CirrusSearch/maintenance/ForceSearchIndex.php --skipParse

And you’ll need to process the job queue any time you add/update content and want it updated in OpenSearch

Terminal window
php maintenance/runJobs.php

To expose the OpenSearch service locally, you can set the OPENSEARCH_PORT_9200 and OPENSEARCH_PORT_9300 environment variables to a port on your host machine.

For example, to expose the internal port 9200 to port 9200 on your host machine:

Terminal window
mw dev env set OPENSEARCH_PORT_9200 9200
mw dev opensearch create
-c, --context <string>
Development context to use (overrides CONTEXT) Default: default.
--help
Help for this command
--no-interaction
Do not ask any interactive questions
-v, --verbose <count>
Increase output verbosity. Example: --verbose=2 or -vv
Report an issue with this page

Report a documentation issue

The report includes this page’s link, section and documentation version.

Review and submit on Phabricator, or run the command using your saved CLI profile. The command asks before creating the task.