Skip to content

Commit

Permalink
data: settings - Split fts_enforced setting
Browse files Browse the repository at this point in the history
  • Loading branch information
fleischie committed Sep 6, 2024
1 parent fe9d239 commit 7314e8d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 32 deletions.
55 changes: 25 additions & 30 deletions data/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1859,41 +1859,37 @@ Configures the used fts driver to perform [[plugin,fts]] indexing. The
[[setting,fts]] filter name refers to this setting.`
},

fts_enforced: {
default: 'no',
fts_search_add_missing: {
plugin: 'fts',
values: setting_types.ENUM,
values_enum: [ 'yes', 'no', 'body' ],
values_enum: [ 'body-search-only', 'yes' ],
default: 'body-search-only',
text: `
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).
Should missing mails be added to FTS indexes before search?
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.
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\`
: Searching from message headers updates FTS indexes, the same way as
searching from body does. If FTS lookup or indexing fails, the search
fails.
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.
\`body\`
: Searching from message headers won't update FTS indexes (the same
behavior as with \`no\`). If FTS lookup or indexing fails, the search fails.
::: info
Only the \`yes\` option 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.
:::`
},

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.`
fts_search_read_fallback: {
plugin: 'fts',
values: setting_types.BOOLEAN,
default: 'yes',
text: `
If FTS lookup or indexing fails, fall back to searching without FTS (i.e.
possibly opening all emails). This may timeout for large mailboxes and/or slow
storage.`
},

fts_header_excludes: {
Expand Down Expand Up @@ -1973,8 +1969,7 @@ When the full text search backend detects that the index isn't up-to-date,
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
[[setting,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
4 changes: 2 additions & 2 deletions docs/core/plugins/fts.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,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
([[setting,fts_enforced]]).
([[setting,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 @@ -121,7 +121,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 [[setting,fts_enforced]].
To disable this functionality, enable [[setting,fts_search_add_missing]].

## Indexing Attachments

Expand Down

0 comments on commit 7314e8d

Please sign in to comment.