Media Wiki CirrusSearch: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 86: Line 86:
</syntaxhighlight>
</syntaxhighlight>
<font color=darkgray>Did not work</font>
<font color=darkgray>Did not work</font>
Add the following query parameters to dump: <code>&cirrusDumpQuery=true</code>, <code>&cirrusDumpResult=true</code>.

Revision as of 02:45, 22 November 2021

External

Internal

Installation

Install elasticsearch. Use the latest recommended major version elasticsearch. Do not use 7.x if they recommend 6.x.

Elasticsearch Installation

Install Elastica extension:

Elastica Extension Installation

Download the correct CirrusSearch version from https://www.mediawiki.org/wiki/Special:ExtensionDistributor/CirrusSearch

Unzip it in the extensions directory:

tar -xzf CirrusSearch-REL1_35-95b958b.tar.gz -C /var/www/mediawiki-x.y.z/extensions

Add the following statement to LocalSettings.php:

wfLoadExtension( 'CirrusSearch' );

Smoke test: go to Special:Version and verify that the extension is successfully installed.

Follow the installation instructions delivered with /var/www/mediawiki-1.35.0/extensions/CirrusSearch/README.

In LocalSettings.php:

wfLoadExtension( 'Elastica' );
wfLoadExtension( 'CirrusSearch' );
$wgDisableSearchUpdate = true;

SELinux Setup

If SELinux is enabled on the host, the httpd process may not be able to invoke into the elasticsearch server, with the following symptoms:

[CirrusSearch] Search backend error during near_match search for 'test' after 5: unknown: Couldn't connect to host, Elasticsearch down?

/var/log/audit/audit.log will contain something similar to:

type=AVC msg=audit(1637546254.160:75): avc:  denied  { name_connect } for  pid=1216 comm="httpd" dest=9200 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:wap_wsp_port_t:s0 tclass=tcp_socket permissive=0

Use audit2allow to generate the SELinux policy to allow the denied operation. Follow:

Troubleshooting, Diagnosing and Fixing SELinux Problems

The summary is there:

  • Try a search operation that will fail.
  • grep httpd /var/log/audit/audit.log | audit2allow -M mysepolicy
  • semodule -i mysepolicy.pp

Initialization

As root:

php /var/www/mediawiki-.../extensions/CirrusSearch/maintenance/UpdateSearchIndexConfig.php

Remove

$wgDisableSearchUpdate = true;

from LocalSettings.php.

php /var/www/mediawiki-.../extensions/CirrusSearch/maintenance/maintenance/ForceSearchIndex.php --skipLinks --indexOnSkip
php /var/www/mediawiki-.../extensions/CirrusSearch/maintenance/maintenance/ForceSearchIndex.php --skipParse

In LocalSettings.php:

$wgSearchType = 'CirrusSearch';

Troubleshooting

Enable debugging as shown in:

MediaWiki Troubleshooting
[CirrusSearchRequests] near_match search for 'test' against {index} took 5 millis. Requested via web for 5b7883dcb7cd761f62397caa67819012 by executor 2078481799
[CirrusSearch] Search backend error during near_match search for 'test' after 5: unknown: Couldn't connect to host, Elasticsearch down?

Direct CirrusSearch error logs to a specific file. In LocalSettings.php:

$wgDebugLogGroups['CirrusSearch'] = "/tmp/cirrus-errors.log";

Did not work


Add the following query parameters to dump: &cirrusDumpQuery=true, &cirrusDumpResult=true.