David improved the notmuch-address.el glue today, and I improved my addrlookup tool also. It is much more intelligent now:
We parse the notmuch db in up to 3 passes now where each find from the previous pass is sorted with heigher weight, ie we will first output addresses in our "address book" then addresses we have mailed to previously and only than at mails we have received. 1st pass: Find all 'from' addresses that are in messages tagged as 'addressbook' (this tag is configurable in .notmuch-config under [user] addrbook_tag=foo but uses addressbook by default) 2nd pass: Find all 'to','cc','bcc' addresses that match our criteria and that we ever sent a mail from our primary mail address 3rd pass: If pass1 + 2 lead to less than 10 message hits, perform a pass 3. Look at all email 'from' headers that match our criteria and use those. We limit this, because notmuch opens all mail files that might match, to read the header out of them, potentially hurting performance a lot. So don't do pass 3 if pass 1 & 2 lead to likely results already. Using the address book feature, you can implement simple 'blacklisting' of emails. If you have friends at Sun for example, you might want to 'notmuch tag +addressbook from:"oracle.com"' to give those addresses priority over the sun.com addresses you have previously used. Performance is still good enough. Doing a "addrlookup" which returns everyone in my "addressbook" and all mail addresses I ever sent mail to (just 165), takes real 0m0.095s with a warm file cache. If the file cache is cold, a search for e.g. "he" can take real 0m2.385s. The reason is that notmuch opens all possibly matching mail files in order to retrieve the headers. Compile directly from vala or the attached c source. Compiling the c source works with glib2.0-dev installed: cc -o addrlookup addrlookup.c `pkg-config --cflags --libs gobject-2.0` -lnotmuch -------------- next part -------------- A non-text attachment was scrubbed... Name: addrlookup.c Type: text/x-csrc Size: 35640 bytes Desc: c source file URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20100421/ed25caf3/attachment-0001.c> -------------- next part -------------- Sebastian