Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Substring Search in Dovecot #7292

Open
stephdl opened this issue Jan 29, 2025 · 6 comments
Open

Enable Substring Search in Dovecot #7292

stephdl opened this issue Jan 29, 2025 · 6 comments
Assignees
Labels
verified All test cases were verified successfully

Comments

@stephdl
Copy link

stephdl commented Jan 29, 2025

Issue Description
Currently, when using Dovecot with the Flatcurve plugin, we rely on the prefix-based search to find emails in clients like Roundcube. This follows a "Google-like" behavior.

However, we would prefer to also allow substring-based search to improve flexibility.

Expected Behavior
Searching for first should find first.user (prefix-based, current behavior).
Searching for user should also find first.user (substring-based, desired behavior).
Proposed Solution
Enable the substring search feature of the Flatcurve plugin by introducing an environment variable:

📖 Dovecot Flatcurve Substring Search

Alternative Solutions
Educate users to write full search terms for accurate results.

See Also
NethServer ns8-mail v1.5.2


Thanks @lucagasparini for the suggestion! 🚀

@stephdl
Copy link
Author

stephdl commented Jan 29, 2025

QA

target is ghcr.io/nethserver/mail:1.5.3-dev.1

the plugin is disabled by default, to enable it, add to environment file: DOVECOT_FLATCURVE_SUBSTRING_SEARCH=yes and restart dovecot container

use roundcubemail to make some search in your email

@stephdl stephdl moved this from ToDo to Testing in NethServer Jan 29, 2025
@stephdl stephdl added the testing Packages are available from testing repositories label Jan 29, 2025
@lucagasparini lucagasparini self-assigned this Jan 29, 2025
@lucagasparini
Copy link

The result obtained is not the desired one.

I recommend checking using this type of sender:
From: firstuser <firstuser@lg.nethserver.net> (not first.user)
In this case the search with the key user does not find anything with or without fts_flatcurve_substring_search.

If you disable the fts_flatcurve plugin completely:

~]# runagent -m mail1 podman exec -ti dovecot diff -u /etc/dovecot/local.conf.ori /etc/dovecot/local.conf
--- /etc/dovecot/local.conf.ori
+++ /etc/dovecot/local.conf
@@ -4,7 +4,7 @@

 login_trusted_networks = 10.5.4.0/24
 protocols = $protocols sieve
-mail_plugins = acl listescape notify mail_log fts fts_flatcurve quota
+mail_plugins = acl listescape notify mail_log fts quota
 mail_shared_explicit_inbox = yes

then

runagent -m mail1 podman exec -ti dovecot dovecot reload

the same search provides the expected result !

@github-project-automation github-project-automation bot moved this from Testing to Done in NethServer Jan 30, 2025
@lucagasparini lucagasparini reopened this Jan 30, 2025
@github-project-automation github-project-automation bot moved this from Done to In Progress in NethServer Jan 30, 2025
@DavidePrincipi DavidePrincipi removed the testing Packages are available from testing repositories label Feb 4, 2025
@DavidePrincipi DavidePrincipi added this to the NethServer 8.4 milestone Feb 4, 2025
@DavidePrincipi
Copy link
Member

I tested in a production server and it seems to return the correct results.

  • Update to 1.5.3-dev.1
  • Set DOVECOT_FLATCURVE_SUBSTRING_SEARCH=yes in environment
  • Reload with systemctl --user reload dovecot

Searches in From now match by substring.

  • Set DOVECOT_FLATCURVE_SUBSTRING_SEARCH=no in environment
  • Reload with systemctl --user reload dovecot

Searches in From do not match by substring.

Note: After reload it may take a while to become effective if there is an open IMAP session. Within Webtop I did a logout/login.

VERIFIED

@DavidePrincipi DavidePrincipi added the verified All test cases were verified successfully label Feb 5, 2025
@nethbot nethbot moved this from In Progress to Verified in NethServer Feb 5, 2025
@DavidePrincipi DavidePrincipi moved this from Verified to In Progress in NethServer Feb 6, 2025
@DavidePrincipi DavidePrincipi changed the title Mail: Enable Substring Search in Dovecot Flatcurve Plugin Enable Substring Search in Dovecot Feb 6, 2025
@DavidePrincipi
Copy link
Member

Flatcurve substring search works for new installations, however on upgraded installations the indexes must be rebuilt.

The resulting index require much more disk space, because each substring needs to be indexed.

Please provide an alternative to Flatcurve substring search: let's add an environment variable that can disable FTS+Flatcurve plugin completely, to rely on the vanilla RFC-compliant search of Dovecot.

@DavidePrincipi DavidePrincipi removed the verified All test cases were verified successfully label Feb 6, 2025
DavidePrincipi added a commit to NethServer/ns8-mail that referenced this issue Feb 6, 2025
@stephdl
Copy link
Author

stephdl commented Feb 7, 2025

QA

test with the mail:1.5.3-dev.2

  • verify the flatcurve is still enabled in configuration and verify the dovecot container is still working as expected
  • then disable fts flatcurve and verify the dovecot container is still working as expected

@stephdl stephdl assigned DavidePrincipi and unassigned stephdl Feb 7, 2025
@stephdl stephdl added the testing Packages are available from testing repositories label Feb 7, 2025
@stephdl stephdl moved this from In Progress to Testing in NethServer Feb 7, 2025
@lucagasparini
Copy link

VERIFIED

Tested with both new installation and update

@lucagasparini lucagasparini added the verified All test cases were verified successfully label Feb 7, 2025
@github-actions github-actions bot removed the testing Packages are available from testing repositories label Feb 7, 2025
@nethbot nethbot moved this from Testing to Verified in NethServer Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
verified All test cases were verified successfully
Projects
Status: Verified
Development

No branches or pull requests

3 participants