1

We run mail server of 30k e-mail accounts (Maildir) with Dovecot imap server. We suffer from high IO load, especially when a user starts to search large IMAP folders. Is any way of preventing search by BODY? I need to allow search by HEADERS (subject, from/to).

I couldn't find anything on that in config/documentation.

masegaloeh
  • 18,236
  • 10
  • 57
  • 106

2 Answers2

2

That's not doable. Search is not optional im IMAP, and no compliant server can avoid searching. I know that people have modified the source to do that, but that often causes even worse load as clients fall back to to bulk downloading.

Dovecot has ways to speed up searching. Look at that, if you can.

arnt
  • 121
  • 4
1

An old thread but faced the same problem and wanted to share my solution.

I did it for dovecot 2.2.21 and seems to be working fine for me. In lib-storage/mail-search.c I commented out the two *have_body = true assignments. So far no side effects apart from the obvious no search in message bodies. Still search text will search in headers. If search bodies is required (i.e. results are expected) but one does not want for actually searching in the bodies but headers only then the have_body = true may be replaced by a have_text = true.

Assuming you are rebuilding the same version as the one currently installed, the library that is to be replaced is libdovecot-storage.

As a side note: I always advise my users to have proper e-mail subjects for adequate searches. A subject with a single word "problem" doesn't help a lot when it comes to a search even within the body.