Adding Full Text Search (FTS) to Dovecot on Ubuntu 20.04

A full text search (FTS) will greatly improve the speed IMAP search commands. In particular, the Android GMail client will be able to search your inbox with lightning speed. This solution is lightweight and easy enough to set up. I’m assuming you have a working dovecot install at this point.

First, install the dovecot-lucene plugin. Unlike Solr, this won’t install any bloat such as tomcat or java.

$ sudo apt install dovecot-lucene

Then enable the plugin by adding it to /etc/dovecot/conf.d/10-mail.conf. Uncomment the mail_plugins line, and change it to:

mail_plugins = fts fts_lucene

Then modify /etc/dovecot/conf.d/90-plugin.conf to configure the plugin:

plugin {
#setting_name = value
fts = lucene
fts_lucene = whitespace_chars=@. normalize no_snowball
fts_autoindex=yes
fts_autoindex_max_recent_msgs=80
fts_index_timeout=90
}

Restart the dovecot service to apply all of the changes:

$ sudo service dovecot restart

To start indexing mail, run the following command as root:

# doveadm -v index -u '*' '*'

The base guide I used is here, but I’ve adapted it for Ubuntu.

Leave a comment

Your email address will not be published. Required fields are marked *