How to enable full-text search (FTS) with Xapian in Dovecot on myVesta (Debian 12)

Post Reply
User avatar
isscbta
Team Member
Posts: 153
Joined: Mon Jul 19, 2021 1:41 am
Has thanked: 18 times
Been thanked: 3 times

If your Roundcube search is slow or not working properly on a myVesta mail server running Debian 12, enabling full-text search with Xapian (fts_xapian) for Dovecot can drastically improve performance.

In this post, I’ll walk you through how to install, configure, and index emails using fts_xapian, so you get instant results in Roundcube’s search box.



Requirements:
  • myVesta server (Debian 12)
  • Dovecot 2.3.19.1 or newer
  • Roundcube Webmail


Step 1: Install the fts_xapian plugin for Dovecot

Run this command:

Code: Select all

apt update
apt install dovecot-fts-xapian -y


Step 2: Configure Dovecot to use fts_xapian

1. Edit the file:

Code: Select all

nano /etc/dovecot/conf.d/90-plugin.conf
Add or replace with:

Code: Select all

plugin {
fts = xapian
fts_autoindex = yes
}
2. Add the plugin to mail_plugins. Open this file:

Code: Select all

nano /etc/dovecot/conf.d/10-mail.conf
Make sure this line is added or modified accordingly:

Code: Select all

mail_plugins = $mail_plugins fts fts_xapian


Step 3: Restart Dovecot

Code: Select all

systemctl restart dovecot


Step 4: Manually index existing emails

FTS auto-indexing works for new messages, but for existing inboxes you need to index manually.

To index only INBOX:

Code: Select all

doveadm index -u [email protected] INBOX
To index all folders:

Code: Select all

doveadm mailbox list -u [email protected] | while read box; do
doveadm index -u [email protected] “$box”
done
Replace [email protected] with the real email address.

You can monitor index creation via:

Code: Select all

watch -n 1 ‘du -sh /home/user/mail/domain/office(or some other email adress)/xapian-indexes’


Step 5: Test Roundcube search

Now go to Roundcube and test searching for any word that exists in old emails. The results should be instant (under 1 second), even with thousands of messages.



Notes:
  • If your Dovecot version is older than 2.3.11, this setup may not be needed - search is faster by default.
  • FTS is especially useful if your users have large mailboxes or use IMAP search frequently.
Post Reply