Installing MediaWiki Lucene-search

From Fyzix
Jump to: navigation, search

Reference: https://www.mediawiki.org/wiki/Extension:Lucene-search

This search plugin engine will offer enhanced full text searching.

Prerequisites

apt-get install openjdk-7-jre-headless

Fetch the binary

Browse to: http://sourceforge.net/project/showfiles.php?group_id=215674

Place files in /usr/local/lucene

cd /source
tar xvf lucene-search-bin-2.1.3.tar.gz
mv lucene-search-2.1.3 /usr/local/lucene

Build

cd /usr/local/lucene

./configure /var/www/wiki
./build
./update

Start script

/usr/sbin/runlsearchd

#!/bin/bash
export PATH
PATH=$PATH:/usr/local/java/bin
cd /usr/local/lucene && ./lsearchd &

Make script executable

chmod u+x runlsearchd

Add this to rc.local

runlsearchd

Fetch MWSearch

Browse to: https://www.mediawiki.org/wiki/Special:ExtensionDistributor/MWSearch

Untar

tar -xzf wikimedia-mediawiki-extensions-MWSearch-bdc9ea0.tar.gz -C /var/www/wiki/extensions
cd /var/www/wiki/extensions
mv wikimedia-mediawiki-extensions-MWSearch-bdc9ea0 MWSearch

Add the following code at the bottom of your LocalSettings.php. Be sure to set the LueceneHost properly.

require_once "$IP/extensions/MWSearch/MWSearch.php";
$wgSearchType = 'LuceneSearch';
$wgLuceneHost = '10.9.9.20'; // IP address of the server
$wgLucenePort = 8123;
$wgLuceneSearchVersion = 2.1; // comment this out if you are using the old version 2.0

Create Build Index script

/usr/sbin/runrebuildindex

#!/bin/bash
cd /usr/local/lucene
./build
./update

Make script executable

chmod u+x runrebuildindex

Create crontab to rebuild index

0 0     * * *   root    runrebuildindex &> /dev/null

Fire-up the daemon

runlsearchd