[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pushing AND, OR search to IMAP



Hi,

Attached is a rewrite of elmo-imap4-search functionality to simplify
the code somewhat and, more importantly, to move the ANDing and ORing
of search conditions to the IMAP server. Currently elmo performs each
subquery of an ANDed or ORed search, then either performs a union or
intersection of the retrieved message IDs within Emacs to get the
results.  elmo-imap4-search2-* rewrites this to do as much as possible
on the IMAP server, which should reduce back and forth responses and
unnecessarily long result lists being transferred over the wire.

For instance, if I want to find messages written by me that contain
“foo” in the body:

  /from:hetzner&body:foo

previously elmo would retrieve all msgids matching from:hetzner (a
large number when searching my archives, of course), then all msgids
matching body:foo, the calculate the union of the two lists. With this
rewrite, elmo will instead combine the searches into a single IMAP
command (if possible) and send the single command to the IMAP server,
where the union will be performed on the server. This means 1 command
instead of 2, and a large reduction in network traffic.

I have tested this, but I am looking for others to test if they are
able. If others are interested I will look into merging this into WL
proper. Thanks!

best, Erik

Attachment: elmo-imap4-search2.el
Description: Binary data

Attachment: pgp9mjskM_Jwd.pgp
Description: PGP signature