From 7314e8d4badf52ce86a78b0a83362a56c42b63a3 Mon Sep 17 00:00:00 2001 From: Karl Fleischmann Date: Tue, 27 Aug 2024 14:57:08 +0200 Subject: [PATCH] data: settings - Split fts_enforced setting --- data/settings.js | 55 ++++++++++++++++++---------------------- docs/core/plugins/fts.md | 4 +-- 2 files changed, 27 insertions(+), 32 deletions(-) diff --git a/data/settings.js b/data/settings.js index f8f8984d4..cec794f6a 100644 --- a/data/settings.js +++ b/data/settings.js @@ -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: { @@ -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.` }, diff --git a/docs/core/plugins/fts.md b/docs/core/plugins/fts.md index 695e439fe..c76224cee 100644 --- a/docs/core/plugins/fts.md +++ b/docs/core/plugins/fts.md @@ -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. @@ -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