Skip to content

Commit

Permalink
global: Split fts_enforced setting
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen authored and cmouse committed Mar 25, 2024
1 parent bcd8eac commit 4187e13
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 40 deletions.
4 changes: 2 additions & 2 deletions source/configuration_manual/fts/dovecot.rst
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ Example configuration using OBOX::
fts_dovecot = yes
}

# Fall back to built in search.
#fts_enforced = no
# Don't fall back to built-in search.
fts_search_read_fallback = no

# Local filesystem example:
# Use local filesystem storing FTS indexes
Expand Down
4 changes: 2 additions & 2 deletions source/configuration_manual/fts/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ On the other hand, searching through message headers benefits from Dovecot's
standard index and cache files (dovecot.index and dovecot.index.cache), which
often contain the necessary information. It is possible to redirect header
searches to FTS indexes via a configuration option
(:dovecot_plugin:ref:`fts_enforced`).
(:dovecot_plugin:ref:`fts_search_add_missing`).

Triggers for FTS indexing are configurable. It can be started on demand when
searching, or automatically when new messages arrive or as a batch job.
Expand Down Expand Up @@ -165,7 +165,7 @@ which does not have indexes for mail bodies.
This could end up opening all the mails in the mailbox, which often isn't
wanted.

To disable this functionality, enable :dovecot_plugin:ref:`fts_enforced`.
To disable this functionality, disable :dovecot_plugin:ref:`fts_search_read_fallback`.


Indexing Attachments
Expand Down
57 changes: 21 additions & 36 deletions source/settings/plugin/fts-plugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,47 +124,33 @@ Settings
The :dovecot_plugin:ref:`fts` filter name refers to this setting.


.. dovecot_plugin:setting:: fts_enforced
:added: 2.2.19
:default: no
.. dovecot_plugin:setting:: fts_search_add_missing
:plugin: fts
:values: yes, no, body

Require FTS indexes to perform a search? This controls what to do when
searching headers and what to do on error situations.

When searching from message body, the FTS index is always (attempted to be)
updated to contain any missing mails before the search is performed.

``no``

Searching from message headers won't update FTS indexes. For header
searches, the FTS indexes are used for searching the mails that are
already in it, but the unindexed mails are searched via
dovecot.index.cache (or by opening the emails if the headers aren't in
cache).
:default: body-search-only
:values: body-search-only, yes

If FTS lookup or indexing fails, both header and body searches fallback
to searching without FTS (i.e. possibly opening all emails). This may
timeout for large mailboxes and/or slow storage.
Should missing mails be added to FTS indexes before search? With
``body-search-only`` this is done only when the search query requests
searching message bodies, i.e. header searches are not updating the FTS
index.

``yes``
The unindexed mails are searched without FTS, i.e. either getting the
headers from ``dovecot.index.cache`` or by opening the emails if the headers
aren't in cache. This may be a useful optimization if the user's client only
uses header searches.

Searching from message headers updates FTS indexes, the same way as
searching from body does. If FTS lookup or indexing fails, the search
fails.

``body``
Note that only the ``yes`` value guarantees consistent search results.
Otherwise it's possible that the search results will be different
depending on whether the search was performed via FTS index or not.

Searching from message headers won't update FTS indexes (the same
behavior as with ``no``). If FTS lookup or indexing fails, the search
fails.

.. dovecotadded:: 2.3.7
.. dovecot_plugin:setting:: fts_search_read_fallback
:default: yes
:plugin: fts

Note that only the ``yes`` value guarantees consistent search results. In
other cases it's possible that the search results will be different
depending on whether the search was performed via FTS index or not.
If FTS lookup or indexing fails, the fall back to searching without FTS
(i.e. possibly opening all emails). This may timeout for large mailboxes
and/or slow storage.


.. dovecot_plugin:setting:: fts_header_excludes
Expand Down Expand Up @@ -241,8 +227,7 @@ Settings
the indexer is told to index the messages and is given this much time to do
so. If this time limit is reached, an error is returned, indicating that
the search timed out during waiting for the indexing to complete:
``NO [INUSE] Timeout while waiting for indexing to finish``. Note the
:dovecot_plugin:ref:`fts_enforced` setting does not change this behavior.
``NO [INUSE] Timeout while waiting for indexing to finish``.

A value of ``0`` means no timeout.

Expand Down

0 comments on commit 4187e13

Please sign in to comment.