mirror of
https://gitlab.com/simple-nixos-mailserver/nixos-mailserver.git
synced 2025-04-01 21:34:32 +05:00

This switches the full-text search plugin from fts-xapian to fts-flatcurve, the now preferred indexer still powered by Xapian, which will be integrated into Dovecot core 2.4. This sets a sane minimal configuration for the plugin with international language support. The plugin options marked as "advanced" in Dovecot's documentation aren't re-exposed for simplicity. They can nevertheless be overridden by module consumers by directly setting keys with `services.dovecot2.pluginSettings.fts_*`. The `fullTextSearch.{memoryLimit,maintenance}` options are removed as they are no longer needed for this plugin, which tops at 256MB of RAM usage by default and incrementally optimises its index. GitLab: closes https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/issues/239
66 lines
2.1 KiB
ReStructuredText
66 lines
2.1 KiB
ReStructuredText
Full text search
|
|
==========================
|
|
|
|
By default, when your IMAP client searches for an email containing some
|
|
text in its *body*, dovecot will read all your email sequentially. This
|
|
is very slow and IO intensive. To speed body searches up, it is possible to
|
|
*index* emails with a plugin to dovecot, ``fts_flatcurve``.
|
|
|
|
Enabling full text search
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
To enable indexing for full text search here is an example configuration.
|
|
|
|
.. code:: nix
|
|
|
|
{
|
|
mailserver = {
|
|
# ...
|
|
fullTextSearch = {
|
|
enable = true;
|
|
# index new email as they arrive
|
|
autoIndex = true;
|
|
enforced = "body";
|
|
};
|
|
};
|
|
}
|
|
|
|
|
|
The ``enforced`` parameter tells dovecot to fail any body search query that cannot
|
|
use an index. This prevents dovecot to fall back to the IO-intensive brute
|
|
force search.
|
|
|
|
If you set ``autoIndex`` to ``false``, indices will be created when the IMAP client
|
|
issues a search query, so latency will be high.
|
|
|
|
Resource requirements
|
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Indices created by the full text search feature can take more disk
|
|
space than the emails themselves. By default, they are kept in the
|
|
emails location. When enabling the full text search feature, it is
|
|
recommended to move indices in a different location, such as
|
|
(``/var/lib/dovecot/indices``) by using the option
|
|
``mailserver.indexDir``.
|
|
|
|
.. warning::
|
|
|
|
When the value of the ``indexDir`` option is changed, all dovecot
|
|
indices needs to be recreated: clients would need to resynchronize.
|
|
|
|
Indexation itself is rather resouces intensive, in CPU, and for emails with
|
|
large headers, in memory as well. Initial indexation of existing emails can take
|
|
hours.
|
|
|
|
Mitigating resources requirements
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
You can:
|
|
|
|
* exclude some headers from indexation with ``mailserver.fullTextSearch.headerExcludes``
|
|
* disable expensive token normalisation in ``mailserver.fullTextSearch.filters``
|
|
* disable automatic indexation for some folders with
|
|
``mailserver.fullTextSearch.autoIndexExclude``. Folders can be specified by
|
|
name (``"Trash"``), by special use (``"\\Junk"``) or with a wildcard.
|
|
|