Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps - Status | Demo | Docs | Install
  1. Cloudron Forum
  2. Feature Requests
  3. Possible to make "exact phrase" email searches work?

Possible to make "exact phrase" email searches work?

Scheduled Pinned Locked Moved Feature Requests
1 Posts 1 Posters 39 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • jdaviescoatesJ Offline
    jdaviescoatesJ Offline
    jdaviescoates
    wrote last edited by
    #1

    At present searching for an exact phrase (e.g. wrapping words in quotes in Roundcube or SnappyMail) doesn't actually return only messages where those words appear together and in order. Instead it seems to return any message containing all the individual words, regardless of order or adjacency.

    Digging into this with Claude, it seems this comes down to how fts_solr builds its query. IMAP's base SEARCH command requires strict substring matching for TEXT/BODY searches, i.e. word order and adjacency should matter - this is specified in RFC 9051.

    There's a separate FUZZY extension (RFC 6203) specifically for inexact, stemmed, token-based matching, meant to be opt-in. RFC 7377 makes the same point explicitly:

    The base IMAP SEARCH command (Section 6.4.4. of [RFC3501]) requires strict substring matching in text searches. Many servers, however, use search engines that match strings in different ways... This is covered by the "Fuzzy Search" extension to IMAP [RFC6203]...

    It looks like Dovecot's fts_solr currently searches the same way regardless of whether FUZZY was requested, essentially always doing the fuzzy/token-AND behaviour. There's an old Dovecot mailing list thread from a few years back where this exact same point was raised, with a proposed fts_fuzzy_default setting so non-fuzzy search would actually behave as the default, non-fuzzy per the spec, with FUZZY being needed to get the current AND-of-tokens behaviour.

    I appreciate this isn't a trivial one-line fix, especially since Cloudron's Solr schema uses edge n-grams for partial-word matching (which came up in the previous thread), and phrase queries don't play nicely with n-gram-tokenized fields. It'd probably need a second, position-aware field for exact/phrase queries alongside the existing n-gram field. But given @girish is one of Dovecot's top contributors, I wondered whether this might be something worth raising upstream, since it'd presumably benefit every fts_solr user, not just Cloudron's setup.

    Happy to help test if you want to try anything.

    Thanks, Josef

    I use Cloudron with Gandi & Hetzner

    1 Reply Last reply
    1

    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

    With your input, this post could be even better 💗

    Register Login
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Bookmarks
    • Search