1 Return-Path: <sebastien.binet@cern.ch>
\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 44EBD431FC0
\r
6 for <notmuch@notmuchmail.org>; Thu, 19 Jul 2012 01:13:52 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-5 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_HI=-5] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id BeLaeLKVqzwI for <notmuch@notmuchmail.org>;
\r
16 Thu, 19 Jul 2012 01:13:51 -0700 (PDT)
\r
17 Received: from CERNMX32.cern.ch (cernmx32.cern.ch [137.138.144.178])
\r
18 (using TLSv1 with cipher AES128-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 3F728431FAE
\r
21 for <notmuch@notmuchmail.org>; Thu, 19 Jul 2012 01:13:51 -0700 (PDT)
\r
22 Received: from CERNFE22.cern.ch (137.138.144.151) by cernmxgwlb2.cern.ch
\r
23 (137.138.144.178) with Microsoft SMTP Server (TLS) id 14.2.283.3;
\r
24 Thu, 19 Jul 2012 10:13:46 +0200
\r
25 Received: from localhost (134.158.88.68) by smtp.cern.ch (137.138.144.172)
\r
26 with Microsoft SMTP Server (TLS) id 14.2.298.4;
\r
27 Thu, 19 Jul 2012 10:13:46 +0200
\r
28 From: Sebastien Binet <binet@cern.ch>
\r
29 To: Austin Clements <amdragon@MIT.EDU>
\r
30 Subject: Re: query on a subset of messages ?
\r
31 In-Reply-To: <87obno3luq.fsf@cern.ch>
\r
32 References: <871ukl5oj7.fsf@cern.ch> <20120709163000.GG18195@mit.edu>
\r
33 <87obno3luq.fsf@cern.ch>
\r
34 User-Agent: Notmuch/0.13.2+77~g39beeb2 (http://notmuchmail.org) Emacs/24.1.1
\r
35 (x86_64-unknown-linux-gnu)
\r
36 Date: Thu, 19 Jul 2012 10:13:25 +0200
\r
37 Message-ID: <87sjcoi2xm.fsf@cern.ch>
\r
39 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1;
\r
40 protocol="application/pgp-signature"
\r
41 X-Originating-IP: [134.158.88.68]
\r
42 Keywords: CERN SpamKiller Note: -50
\r
43 Cc: Notmuch developer list <notmuch@notmuchmail.org>
\r
44 X-BeenThere: notmuch@notmuchmail.org
\r
45 X-Mailman-Version: 2.1.13
\r
47 List-Id: "Use and development of the notmuch mail system."
\r
48 <notmuch.notmuchmail.org>
\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
52 List-Post: <mailto:notmuch@notmuchmail.org>
\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
56 X-List-Received-Date: Thu, 19 Jul 2012 08:13:52 -0000
\r
59 Content-Type: text/plain
\r
60 Content-Transfer-Encoding: quoted-printable
\r
62 Sebastien Binet <binet@cern.ch> writes:
\r
64 > Austin Clements <amdragon@MIT.EDU> writes:
\r
66 >> Quoth Sebastien Binet on Jul 09 at 10:25 am:
\r
70 >>> I was trying to reduce the I/O stress during my usual email
\r
71 >>> fetching+tagging by writing a little program using the go bindings to
\r
75 >>> db, status :=3D notmuch.OpenDatabase(db_path,
\r
76 >>> notmuch.DATABASE_MODE_READ_WRITE)
\r
77 >>> query :=3D db.CreateQuery("(tag:new AND tag:inbox)")
\r
78 >>> msgs :=3D query.SearchMessages()
\r
79 >>> for _,msg :=3D range msgs {
\r
80 >>> tag_msg(msg, tagqueries)
\r
84 >>> where tagqueries is a subquery of the form:
\r
87 >>> "Cmd": "+to-me",
\r
88 >>> "Query": "(to:sebastien.binet@cern.ch and not tag:to-me)"
\r
91 >>> "Cmd": "+sci-notmuch",
\r
92 >>> "Query": "from:notmuch@notmuchmail.org or to:notmuch@notmuchmai=
\r
93 l.org or subject:notmuch"
\r
98 >>> the idea being that I only need to crawl through the db only once and
\r
99 >>> then iteratively apply tags on those messages (instead of repeatedly
\r
100 >>> running "notmuch tag ..." for each and every of those many
\r
103 >>> I couldn't find any C-API to do such a thing using the notmuch library.
\r
104 >>> did I overlook something ?
\r
106 >>> Is it something useful to add ?
\r
110 >> Have you tried a more direct translation of the multiple notmuch tag
\r
111 >> commands into Go, where you don't worry about subsetting the queries?
\r
112 >> Unless you're tagging a huge number of messages, the cost of notmuch
\r
113 >> tag is almost certainly the fsync that it does when it closes the
\r
114 >> database (which every call to notmuch tag must do). However, in Go,
\r
115 >> you can keep the database open across all of the tagging operations
\r
116 >> and then close and fsync it just once.
\r
118 > nope, I haven't tried that, but will do.
\r
121 >> Note that there is an important optimization in notmuch tag that you
\r
122 >> might have to replicate. It manipulates the original query to exclude
\r
123 >> messages that already have the desired tags, so that they get skipped
\r
124 >> very efficiently at the earliest stage possible.
\r
125 > I already have this in my original shell script.
\r
126 > (wouldn't be too hard to automatically do, though.)
\r
128 FYI, I've put this into a new notmuch-mtag go-based binary over here:
\r
129 https://github.com/sbinet/notmuch/blob/dev/go-bindings/bindings/go/src/notm=
\r
136 Content-Type: application/pgp-signature
\r
138 -----BEGIN PGP SIGNATURE-----
\r
139 Version: GnuPG v2.0.19 (GNU/Linux)
\r
141 iEYEARECAAYFAlAHwawACgkQPj4AVbsZCCaJrwCglm3LMNwaYJuCCCWGmGHt9WGv
\r
142 KB4An3LxEhxb//8thxBUNoOHQq5kluqn
\r
144 -----END PGP SIGNATURE-----
\r