Re: [PATCH v4 01/16] add util/search-path.{c, h} to test for executables in $PATH
[notmuch-archives.git] / ee / fe8a7c9b428ab17077850b92955afbea3172b8
1 Return-Path: <MarkR.Andersom@amd.com>\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 4844E431FBC\r
6         for <notmuch@notmuchmail.org>; Wed, 23 Dec 2009 10:19:40 -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 67vad1gYrklh for <notmuch@notmuchmail.org>;\r
11         Wed, 23 Dec 2009 10:19:38 -0800 (PST)\r
12 Received: from VA3EHSOBE006.bigfish.com (va3ehsobe005.messaging.microsoft.com\r
13         [216.32.180.15])\r
14         by olra.theworths.org (Postfix) with ESMTP id 1F53D431FAE\r
15         for <notmuch@notmuchmail.org>; Wed, 23 Dec 2009 10:19:38 -0800 (PST)\r
16 Received: from mail164-va3-R.bigfish.com (10.7.14.239) by\r
17         VA3EHSOBE006.bigfish.com (10.7.40.26) with Microsoft SMTP Server id\r
18         8.1.240.5; Wed, 23 Dec 2009 18:19:37 +0000\r
19 Received: from mail164-va3 (localhost.localdomain [127.0.0.1])  by\r
20         mail164-va3-R.bigfish.com (Postfix) with ESMTP id 0C7981990649;\r
21         Wed, 23 Dec 2009 18:19:37 +0000 (UTC)\r
22 X-SpamScore: -20\r
23 X-BigFish: VPS-20(zz1418M1432R98dNzz1202hzzz32i6bh61h)\r
24 X-Spam-TCS-SCL: 0:0\r
25 Received: from mail164-va3 (localhost.localdomain [127.0.0.1]) by mail164-va3\r
26         (MessageSwitch) id 1261592374181609_14289;\r
27         Wed, 23 Dec 2009 18:19:34 +0000 (UTC)\r
28 Received: from VA3EHSMHS025.bigfish.com (unknown [10.7.14.249]) by\r
29         mail164-va3.bigfish.com (Postfix) with ESMTP id 217D9174807C;\r
30         Wed, 23 Dec 2009 18:18:57 +0000 (UTC)\r
31 Received: from ausb3extmailp02.amd.com (163.181.251.22) by\r
32         VA3EHSMHS025.bigfish.com (10.7.99.35) with Microsoft SMTP Server (TLS)\r
33         id 14.0.482.32; Wed, 23 Dec 2009 18:18:54 +0000\r
34 Received: from ausb3twp02.amd.com ([163.181.250.38])    by\r
35         ausb3extmailp02.amd.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id\r
36         nBNIIoEn030592; Wed, 23 Dec 2009 12:18:54 -0600\r
37 X-WSS-ID: 0KV4AV8-02-CLS-02\r
38 X-M-MSG: \r
39 Received: from sausexbh2.amd.com (SAUSEXBH2.amd.com [163.181.22.102])   by\r
40         ausb3twp02.amd.com (Tumbleweed MailGate 3.7.2) with ESMTP id\r
41         2FF36FCC3B2; Wed, 23 Dec 2009 12:18:44 -0600 (CST)\r
42 Received: from sausexmb4.amd.com ([163.181.3.15]) by sausexbh2.amd.com with\r
43         Microsoft SMTPSVC(6.0.3790.3959);        Wed, 23 Dec 2009 12:18:49 -0600\r
44 Received: from optimon.amd.com ([163.181.34.104]) by sausexmb4.amd.com with\r
45         Microsoft SMTPSVC(6.0.3790.3959);        Wed, 23 Dec 2009 12:18:48 -0600\r
46 Received: from mhdc-ns01.amd.com (mhdc-ns01.amd.com [165.204.35.147])   by\r
47         optimon.amd.com (8.12.10/8.12.10) with ESMTP id nBNIImCG032389;\r
48         Wed, 23 Dec 2009 12:18:48 -0600\r
49 Received: from testarossa.amd.com (testarossa.amd.com [165.204.147.44]) by\r
50         mhdc-ns01.amd.com (8.13.8+Sun/8.13.8) with ESMTP id nBNIImru028811;\r
51         Wed, 23 Dec 2009 11:18:48 -0700 (MST)\r
52 Received: (from manderso@localhost)     by testarossa.amd.com\r
53         (8.13.1/8.13.1/Submit) id nBNIIjrK026982;\r
54         Wed, 23 Dec 2009 11:18:45 -0700\r
55 X-Authentication-Warning: testarossa.amd.com: manderso set sender to\r
56         MarkR.Andersom@amd.com using -f\r
57 From: Mark Anderson <MarkR.Anderson@amd.com>\r
58 To: Olly Betts <olly@survex.com>, notmuch@notmuchmail.org\r
59 In-Reply-To: <loom.20091223T043223-941@post.gmane.org>\r
60 References: <3wdskb8oh77.fsf@testarossa.amd.com>\r
61         <87hbroyyf6.fsf@yoom.home.cworth.org>\r
62         <loom.20091223T043223-941@post.gmane.org>\r
63 Date: Wed, 23 Dec 2009 11:18:45 -0700\r
64 Message-ID: <3wd637xo8oq.fsf@testarossa.amd.com>\r
65 MIME-Version: 1.0\r
66 Content-Type: text/plain; charset="us-ascii"\r
67 X-OriginalArrivalTime: 23 Dec 2009 18:18:48.0730 (UTC)\r
68         FILETIME=[5F4C17A0:01CA83FC]\r
69 X-Reverse-DNS: ausb3extmailp02.amd.com\r
70 Subject: Re: [notmuch] Rather simple optimization for notmuch tag\r
71 X-BeenThere: notmuch@notmuchmail.org\r
72 X-Mailman-Version: 2.1.12\r
73 Precedence: list\r
74 List-Id: "Use and development of the notmuch mail system."\r
75         <notmuch.notmuchmail.org>\r
76 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
77         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
78 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
79 List-Post: <mailto:notmuch@notmuchmail.org>\r
80 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
81 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
82         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
83 X-List-Received-Date: Wed, 23 Dec 2009 18:19:40 -0000\r
84 \r
85 On Wed, 23 Dec 2009 03:45:14 +0000, Olly Betts <olly@survex.com> wrote:\r
86 > Carl Worth writes:\r
87 > > On Fri, 18 Dec 2009 00:49:00 -0700, Mark Anderson wrote:\r
88 > > > I was updating my poll script that tags messages, and a common idiom is\r
89 > > > to put\r
90 > > >  tag +mytag <search_terms> and not tag:mytag\r
91 > > > \r
92 > > > I don't know anything about efficiency, but for the simple single-tag\r
93 > > > case, couldn't we imply the "and not tag:mytag" from the +mytag action\r
94 > > > list for the tag command?\r
95 > > \r
96 > > On one level, it really shouldn't be a performance issue to tag messages\r
97 > > that already have a particular tag. (And in fact, the recently proposed\r
98 > > patches to fix Xapian defect 250 even address this I think.)\r
99\r
100 > Applying a filter up-front like this is likely to still help I think as it\r
101 > avoids Xapian having to reverse-engineer this information internally.\r
102 \r
103 That's good to hear.\r
104 \r
105 > Actually, you could do this with multiple tags - you just need to build\r
106 > a filter for documents which might be affected.\r
107\r
108 > So if you're adding tags a1 and a2, you want: <query> AND_NOT (a1 AND a2)\r
109 > since documents which already have tags a1 and a2 can be ignored.\r
110\r
111 > If you're removing d1 and d2, then the filter is: <query> AND (d1 OR d2)\r
112 > since documents have to be tagged d1 or d2 in order for the removal to\r
113 > do anything.\r
114\r
115 > Handling a combination of removals and additions is trickier, but probably\r
116 > possible, although the more tags you are dealing with, the less profitable\r
117 > the filtering is likely to be (as the filter is likely to cull fewer\r
118 > documents yet be more expensive to evaluate).\r
119 \r
120 But the transform is pretty simple, I think that any combination of\r
121 additions and removals could be transformed according to the following\r
122 formula.\r
123 \r
124 notmuch tag +a1 +a2 +a3 -d1 -d2 -d3 <search-terms>\r
125 \r
126 would transform to something like:\r
127 \r
128 <search-terms> and ( not(a1) or not(a2) or not(a3) or d1 or d2 or d3) \r
129 \r
130 There are certainly may be much more optimal ways to do it depending on\r
131 the specific corpus of the database, considering if the tags a1 and a2\r
132 and a3 are usually added as one tag, or if the addition is done\r
133 individually, because if I know that a3 implies a1 and a2, the first 3\r
134 terms could be combined to not(a1 and a2 and a3), or I could just\r
135 exclude a3 tagged messages for nearly the same effect, with expected\r
136 performance improvements.\r
137 \r
138 Unfortunately this requires that I know more about how the tags are used\r
139 than I ever want notmuch to deal with.  Perhaps a follow-on or parallel\r
140 project with less emphasis on minimalism.\r
141 \r
142 \r
143 This looks pretty good to me.  Easy to implement and not likely to break\r
144 things.  I've been wondering about whether there should be a repository\r
145 of mail added to the notmuch git so that we can start testing these\r
146 kinds of features on a consistent body of mail.\r
147  \r
148 I doubt that I'll be the one to write this, since I don't have any time\r
149 set aside for real coding, but if it takes long enough, I'll probably\r
150 pick this one up eventually.\r
151 \r
152 -Mark\r
153 \r