[PATCH 5/8] lib: iterator API for message properties
[notmuch-archives.git] / 3d / 718a0058f1245f3d5a1039b985c564b7b4605e
1 Return-Path: <gmn-notmuch@m.gmane.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 94257431FBC\r
6         for <notmuch@notmuchmail.org>; Tue, 22 Dec 2009 19:45:45 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id gW75KLRAELZG for <notmuch@notmuchmail.org>;\r
11         Tue, 22 Dec 2009 19:45:44 -0800 (PST)\r
12 Received: from lo.gmane.org (lo.gmane.org [80.91.229.12])\r
13         by olra.theworths.org (Postfix) with ESMTP id 5D3BC431FAE\r
14         for <notmuch@notmuchmail.org>; Tue, 22 Dec 2009 19:45:44 -0800 (PST)\r
15 Received: from list by lo.gmane.org with local (Exim 4.50) id 1NNIAQ-0000KN-4t\r
16         for notmuch@notmuchmail.org; Wed, 23 Dec 2009 04:45:42 +0100\r
17 Received: from ip-118-90-130-94.xdsl.xnet.co.nz ([118.90.130.94])\r
18         by main.gmane.org with esmtp (Gmexim 0.1 (Debian))\r
19         id 1AlnuQ-0007hv-00\r
20         for <notmuch@notmuchmail.org>; Wed, 23 Dec 2009 04:45:37 +0100\r
21 Received: from olly by ip-118-90-130-94.xdsl.xnet.co.nz with local (Gmexim 0.1\r
22         (Debian)) id 1AlnuQ-0007hv-00\r
23         for <notmuch@notmuchmail.org>; Wed, 23 Dec 2009 04:45:37 +0100\r
24 X-Injected-Via-Gmane: http://gmane.org/\r
25 To: notmuch@notmuchmail.org\r
26 From: Olly Betts <olly@survex.com>\r
27 Date: Wed, 23 Dec 2009 03:45:14 +0000 (UTC)\r
28 Lines: 39\r
29 Message-ID: <loom.20091223T043223-941@post.gmane.org>\r
30 References: <3wdskb8oh77.fsf@testarossa.amd.com>\r
31         <87hbroyyf6.fsf@yoom.home.cworth.org>\r
32 Mime-Version: 1.0\r
33 Content-Type: text/plain; charset=us-ascii\r
34 Content-Transfer-Encoding: 7bit\r
35 X-Complaints-To: usenet@ger.gmane.org\r
36 X-Gmane-NNTP-Posting-Host: sea.gmane.org\r
37 User-Agent: Loom/3.14 (http://gmane.org/)\r
38 X-Loom-IP: 118.90.130.94 (Mozilla/5.0 (X11; U; Linux x86_64; en-GB;\r
39         rv:1.9.1.6) Gecko/20091215 Ubuntu/9.10 (karmic) Firefox/3.5.6)\r
40 Sender: news <news@ger.gmane.org>\r
41 Subject: Re: [notmuch] Rather simple optimization for notmuch tag\r
42 X-BeenThere: notmuch@notmuchmail.org\r
43 X-Mailman-Version: 2.1.12\r
44 Precedence: list\r
45 List-Id: "Use and development of the notmuch mail system."\r
46         <notmuch.notmuchmail.org>\r
47 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
49 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
50 List-Post: <mailto:notmuch@notmuchmail.org>\r
51 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
52 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
54 X-List-Received-Date: Wed, 23 Dec 2009 03:45:45 -0000\r
55 \r
56 Carl Worth writes:\r
57 > On Fri, 18 Dec 2009 00:49:00 -0700, Mark Anderson wrote:\r
58 > > I was updating my poll script that tags messages, and a common idiom is\r
59 > > to put\r
60 > >  tag +mytag <search_terms> and not tag:mytag\r
61 > > \r
62 > > I don't know anything about efficiency, but for the simple single-tag\r
63 > > case, couldn't we imply the "and not tag:mytag" from the +mytag action\r
64 > > list for the tag command?\r
65\r
66 > On one level, it really shouldn't be a performance issue to tag messages\r
67 > that already have a particular tag. (And in fact, the recently proposed\r
68 > patches to fix Xapian defect 250 even address this I think.)\r
69 \r
70 Applying a filter up-front like this is likely to still help I think as it\r
71 avoids Xapian having to reverse-engineer this information internally.\r
72 \r
73 > One potential snag with both ideas is that the "notmuch tag"\r
74 > command-line as currently implemented allows for multiple tag additions\r
75 > and removals with a single search. So the optimization here couldn't be\r
76 > used unless there was just a single tag action.\r
77 \r
78 Actually, you could do this with multiple tags - you just need to build\r
79 a filter for documents which might be affected.\r
80 \r
81 So if you're adding tags a1 and a2, you want: <query> AND_NOT (a1 AND a2)\r
82 since documents which already have tags a1 and a2 can be ignored.\r
83 \r
84 If you're removing d1 and d2, then the filter is: <query> AND (d1 OR d2)\r
85 since documents have to be tagged d1 or d2 in order for the removal to\r
86 do anything.\r
87 \r
88 Handling a combination of removals and additions is trickier, but probably\r
89 possible, although the more tags you are dealing with, the less profitable\r
90 the filtering is likely to be (as the filter is likely to cull fewer\r
91 documents yet be more expensive to evaluate).\r
92 \r
93 Cheers,\r
94     Olly\r
95 \r