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

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.






2 responses to “Adding Full Text Search (FTS) to Dovecot on Ubuntu 20.04”

  1. Patrick

    fts_lucene is deprecated:

    > Warning

    > This plugin is no longer maintained in Dovecot (as of 2.3+) and will be removed in the future.

    > It is using CLucene library, which is very old and has some bugs.

    > If looking for a full-featured FTS backend, you should use Solr FTS Engine instead which has more features, is more stable, is actively developed, and has an FTS driver supported by Dovecot.

    1. Russell Phillips

      I’m currently trying out the “dovecot-fts-xapian” plugin, which appears to be actively maintained. The setup process is almost identical to lucene.

      There’s also the “FTS flatcurve” plugin which I haven’t tried yet. The Dovecot team are considering adopting it as part of the core product.

Leave a Reply

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