close
Mailspect Documentation
Rebuilding Sphinx Index

Contents

How to rebuild your email archive index

This article describes how to re-index your email archive full-text search index.

Warning!!!  Re-indexing can take many hours for a large database.  Full text search will not be available during 
this period but other services will not be  affected.  This process is CPU intensive.

Stop Sphinx Daemon

killall searchd

Remove Existing Index Files

rm -f /usr/local/sphinx/var/data/mpp*

drop data from content_index and content_counter tables of MPP Archive DB

mysql -uroot -p use mppdb; truncate content_counter; truncate content_index;

Temporarily disable cronjobs

Use: crontab -e and comment out the following
#5 * * * * /usr/local/MPP/scripts/fetchdata.pl >/dev/null 2>&1 </dev/null
#45 * * * * /usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/sphinx.conf mppdeltaindex --rotate >/dev/null 2>&1 </dev/null

Download and install latest fetchdata.pl

ftp://ftp.messagepartners.com/pub/mpp4/scripts/fetchdata.pl in /usr/local/MPP/scripts/fetchdata.pl
cd /usr/local/MPP/scripts/
mv fetchdata.pl fetchdata.pl.old
wget -c ftp://ftp.messagepartners.com/pub/mpp4/scripts/fetchdata.pl
chmod 755 fetchdata.pl

Note: Edit MySQL credentials and set $metadata = 1 if you are using MySQL only for metadata.

=Edit MySQL credentials in fetchdata.pl to meet your DB requirements and also set $metadata variable to 0 or 1 depending on your setup

Run fetchdata.pl parser

This can take some time if there are many messages in DB

perl /usr/local/MPP/scripts/fetchdata.pl

Index parsed data

/usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/sphinx.conf --all

Start Sphinx searchd Daemon

/usr/local/sphinx/bin/searchd --config /usr/local/sphinx/etc/sphinx.conf

Enable Cronjobs

Use: crontab -e and uncomment the following
5 * * * * /usr/local/MPP/scripts/fetchdata.pl >/dev/null 2>&1 </dev/null
45 * * * * /usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/sphinx.conf mppdeltaindex --rotate >/dev/null 2>&1 </dev/null