[GH-ISSUE #2336] Webmail does not list mails when FTS-Solr is enabled #1573

Closed
opened 2026-02-27 11:17:53 +03:00 by kerem · 5 comments
Owner

Originally created by @zsoltbarat on GitHub (Jul 31, 2021).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/2336

Originally assigned to: @kryskool on GitHub.

Impacted versions

  • OS Type: Debian
  • OS Version: 9 (stretch)
  • Database Type: MySQL
  • Database version: 10.1.48-MariaDB-0+deb9u2
  • Modoboa: 1.17.0
  • installer used: Yes
  • Webserver: Nginx / Uwsgi

Steps to reproduce

  1. Configure Solr as FTS engine for Dovecot like:
    plugin {
    fts = solr
    fts_autoindex = yes
    fts_solr = break-imap-search url=http://xxxx:8080/solr/
    }

  2. Launch webmail client in Modoboa

Current behavior

  1. Mails are not listed in overview but are searchable
  2. Also quarantine lists mails

Due to how default IMAP search is implemented no mails are found

Expected behavior

List mails in overview

Video/Screenshot link (optional)

grafik
Originally created by @zsoltbarat on GitHub (Jul 31, 2021). Original GitHub issue: https://github.com/modoboa/modoboa/issues/2336 Originally assigned to: @kryskool on GitHub. # Impacted versions * OS Type: Debian * OS Version: 9 (stretch) * Database Type: MySQL * Database version: 10.1.48-MariaDB-0+deb9u2 * Modoboa: 1.17.0 * installer used: Yes * Webserver: Nginx / Uwsgi # Steps to reproduce 1. Configure Solr as FTS engine for Dovecot like: plugin { fts = solr fts_autoindex = yes fts_solr = break-imap-search url=http://xxxx:8080/solr/ } 2. Launch webmail client in Modoboa # Current behavior 1. Mails are not listed in overview but are searchable 2. Also quarantine lists mails Due to how default IMAP search is implemented no mails are found # Expected behavior List mails in overview # Video/Screenshot link (optional) <img width="1236" alt="grafik" src="https://user-images.githubusercontent.com/15322546/127743140-5afd3717-d139-4209-ab33-f91b65cc1993.png">
kerem 2026-02-27 11:17:53 +03:00
  • closed this issue
  • added the
    bug
    pr
    labels
Author
Owner

@zsoltbarat commented on GitHub (Jul 31, 2021):

dovecot version: 2.2.27

<!-- gh-comment-id:890357792 --> @zsoltbarat commented on GitHub (Jul 31, 2021): dovecot version: 2.2.27
Author
Owner

@zsoltbarat commented on GitHub (Jul 31, 2021):

A quick fix would be:

def parse_search_parameters(self, criterion, pattern):
        """Parse search information and apply them."""

        def or_criterion(old, c):
            if old == "":
                return c
            return "OR (%s) (%s)" % (old, c)

        if criterion == u"both":
            criterion = u"from_addr, subject"
        criterions = ""
        for c in criterion.split(','):
            if c == "from_addr":
                key = "FROM"
            elif c == "subject":
                key = "SUBJECT"
            else:
                continue
            criterions = or_criterion(
                criterions, '(%s "%s")' % (key, pattern))

-->        if pattern == "":
-->            criterions = "ALL"

        if six.PY3:
            criterions = bytearray(criterions, "utf-8")
        elif isinstance(criterions, six.text_type):
            criterions = criterions.encode("utf-8")
        self.criterions = [criterions]

In imaputils.py

Searching for "" does not looks so right anyway.
There is IMAP search ALL for this.

<!-- gh-comment-id:890374233 --> @zsoltbarat commented on GitHub (Jul 31, 2021): A quick fix would be: ``` def parse_search_parameters(self, criterion, pattern): """Parse search information and apply them.""" def or_criterion(old, c): if old == "": return c return "OR (%s) (%s)" % (old, c) if criterion == u"both": criterion = u"from_addr, subject" criterions = "" for c in criterion.split(','): if c == "from_addr": key = "FROM" elif c == "subject": key = "SUBJECT" else: continue criterions = or_criterion( criterions, '(%s "%s")' % (key, pattern)) --> if pattern == "": --> criterions = "ALL" if six.PY3: criterions = bytearray(criterions, "utf-8") elif isinstance(criterions, six.text_type): criterions = criterions.encode("utf-8") self.criterions = [criterions] ``` In imaputils.py Searching for "" does not looks so right anyway. There is IMAP search ALL for this.
Author
Owner

@zsoltbarat commented on GitHub (Jul 31, 2021):

I can provide a proper patch if needed.

<!-- gh-comment-id:890374480 --> @zsoltbarat commented on GitHub (Jul 31, 2021): I can provide a proper patch if needed.
Author
Owner

@tonioo commented on GitHub (Aug 9, 2021):

@zsoltbarat It would be great :)

<!-- gh-comment-id:895065272 --> @tonioo commented on GitHub (Aug 9, 2021): @zsoltbarat It would be great :)
Author
Owner

@stale[bot] commented on GitHub (Oct 9, 2021):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

<!-- gh-comment-id:939194756 --> @stale[bot] commented on GitHub (Oct 9, 2021): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1573
No description provided.