How to Enable Dovecot FTS with Xapian?

How to install / enable / integrate xapian precisely? Is the below method correct? I’m on Ubuntu 24.04 with the latest HCP.

Install dovecot-fts-xapian and xapian-tools.
sudo apt install dovecot-fts-xapian xapian-tools

In /etc/dovecot/conf.d/90-plugin.conf add:

plugin {
  fts = xapian
  fts_autoindex = yes
  fts_enforced = yes
}

In /etc/dovecot/conf.d/20-imap.conf add fts and fts_xapian to mail_plugins:

mail_plugins = quota imap_quota imap_sieve fts fts_xapian

Restart dovecot:

sudo systemctl restart dovecot

Anything else needed or needs to change? Thanks in advance!

1 Like

Your method is correct and nearly complete. Only optional improvements could be added:

  • Manually trigger initial indexing (doveadm fts rescan)
  • Confirm with doveconf
  • Optionally fine-tune fts_xapian_* settings

Thanks for you insights @briceka! Could you perhaps share your exact installation / configuration setup? I’ve adjusted some values but the search speeds haven’t improved that much..

In /etc/dovecot/conf.d/90-plugin.conf i now have:

plugin {
  fts = xapian
  fts_autoindex = yes
  fts_enforced = yes
  fts_index_timeout = 60s
  fts_xapian_verbose = 2
  fts_xapian_language = nl
  fts_xapian_partial = yes
  fts_xapian_memory_limit = 512M
  fts_xapian_compact = yes
  fts_xapian_clean_shutdown = yes
}

In /etc/dovecot/conf.d/10-master.conf i now have:

service imap-login {
  inet_listener imap {
  }
  inet_listener imaps {
  }
}

service pop3-login {
  inet_listener pop3 {
  }
  inet_listener pop3s {
  }
}


service imap {
}

service pop3 {
}

service auth {
  extra_groups = mail

  unix_listener auth-client {
    group = mail
    mode = 0660
    user = dovecot
  }
  unix_listener auth-master {
    group = mail
    mode = 0660
    user = dovecot
  }
  user = dovecot
}

service doveadm {
  unix_listener doveadm-server {
    mode = 0600
    user = dovecot
    group = dovecot
  }
  user = dovecot
}

protocol doveadm {
  mail_plugins = fts fts_xapian
}

In /etc/dovecot/conf.d/20-imap.conf i still have:

mail_plugins = quota imap_quota imap_sieve fts fts_xapian