MediaWiki:SearchEngine: Difference between revisions
Jump to navigation
Jump to search
m Hdridder moved page MediaWiki:SearchEngine to SearchEngine without leaving a redirect |
m Hdridder moved page SearchEngine to MediaWiki:SearchEngine without leaving a redirect |
(No difference)
| |
Latest revision as of 21:28, 3 February 2025
CirrusSearch is a search extension that supports more complex search phrases. It uses ElasticSearch to store data.
ElasticSearch Install
For installation on mediawiki 1.35:
- Install java8 and elasticsearch 6.8.23
apt-get install openjdk-8-jre-headlessecho "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.listsudo apt-get update && sudo apt-get install elasticsearch
- Install the Elastica and CirrusSearch (use the same version as your MediaWiki version) extensions [1]
- Follow instructions in ./extentions/CirrusSearch/README
MediaWiki LocalSettings
- Add this to LocalSettings.php
wfLoadExtension( 'Elastica' ); wfLoadExtension( 'CirrusSearch' ); $wgDisableSearchUpdate = true;
php7.4 ./extensions/CirrusSearch/maintenance/UpdateSearchIndexConfig.php- Remove
$wgDisableSearchUpdate = truefrom LocalSettings.php php7.4 ./extensions/CirrusSearch/maintenance/ForceSearchIndex.php --skipLinks --indexOnSkipphp7.4 ./extensions/CirrusSearch/maintenance/ForceSearchIndex.php --skipParse- Edit LocalSettings.php to have
$wgSearchType = 'CirrusSearch';
Check Special:Version to see if all is installed
To verify CirrusSearch is used add '&cirrusDumpQuery' to a search URL. A json-string will be shown.
ElastichSearch Tips
Remote ElasticSearch server
If ElasticSearch is on another server as the webserver you have to edit /etc/elasticsearch/elasticsearch.yml to listen to the outside address
network.host: <outside IP address>
Start/Stop script
For automatic start/stop I created /etc/init.d/elasticsearch like
#!/bin/sh
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides: elasticsearch
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start ElastichSearch deamon
# Description: Start ElastichSearch deamon
# This script starts a
# single forking daemon capable of writing a pid
# file.
### END INIT INFO
# Author: Hans de Ridder <hans@deridder.it>
#
if [ `id -nu` != 'elasticsearch' ]
then
su elasticsearch $0 $*
exit
fi
DESC="ElasticSearch engine"
DAEMON="/opt/elasticsearch/bin/elasticsearch"
DAEMON_ARGS="-d"
Now you can start by service elasticsearch start. Stopping is not implemented in this script.
In /etc/rc5.d do ln -s ../init.d/elasticsearch S02elasticsearch
Troubleshooting
- curl http://localhost:9200/_aliases?pretty=true
- List the indexes in elasticsearch
- curl -XDELETE http://localhost:9200/<indexname>*/
- Remove all indexes where name starts with <indexname>