[Dovecot] Disable/patch iOS7 Full Body Search

Mike Abbott michael.abbott at apple.com
Wed Mar 12 19:23:35 UTC 2014


In traversing this thread I see a few different issues being reported.  In no particular order I see:

[Nicholas Riley]
> iOS Mail still opens lots of simultaneous IMAP connections, eventually complains about not being able to contact the server, and doesn't seem to do anything that uses Dovecot's search indexes.

This seems to have nothing to do with searching per se but it's hard to tell anything without thorough steps to reproduce the issue and/or detailed activity logs.  Packet traces capturing all traffic between the client and the server during such an episode would be helpful.  (Limited to the issue at hand though.  A huge dump of hours of traffic would not be useful.  Beware revealing private information.)  And if you suspect that your clients are hitting your mail_max_userip_connections setting why not just increase it?

[http://blog.fastmail.fm/2013/09/17/ios-7-mail-app-uses-multi-folder-body-searches-by-default/]
> Depending on your IMAP server, your message bodies may or may not be indexed in a way that allows sub-string searching.

RFC 3501 section 6.4.4 unequivocally requires substring matches:
	In all search keys that use strings, a message matches the key if the string is a substring of the field.
I would suggest that an IMAP server whose search indexes don't support efficient substring matches is misconfigured.  Imagine a server which indexes only occurrences of the word "potato."  Would you be surprised when it performs poorly when searching for other foods?

[https://discussions.apple.com/thread/5323188]
> Apple turned all server-side email searching into a slow and inefficient entire msgs substring search

Personally I consider searching message bodies a feature.  Anecdotally it works great for me with my iOS device and personal mail accounts.  But again, server-side searching is only "slow and inefficient" in the absence of a properly configured search subsystem.  Note these (dated, but still relevant) documents:

[http://wiki2.dovecot.org/Plugins/FTS/Solr]
    * break-imap-search : Use Solr also for indexing TEXT and BODY searches. This makes your server non-IMAP-compliant. (This is always enabled in v2.1+)
[http://wiki2.dovecot.org/Plugins/FTS/Squat]
    By strictly reading the IMAP RFC it requires substring matching, so to optimize regular TEXT and BODY searches you must use Squat with Dovecot v2.0.


More information about the dovecot mailing list