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 9B2C8431FD7
\r
6 for <notmuch@notmuchmail.org>; Mon, 9 Jul 2012 10:06:40 -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 jJi0iYyGX5Um for <notmuch@notmuchmail.org>;
\r
16 Mon, 9 Jul 2012 10:06:40 -0700 (PDT)
\r
17 Received: from CERNMX30.cern.ch (cernmx30.cern.ch [137.138.144.177])
\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 BAC3F431FBF
\r
21 for <notmuch@notmuchmail.org>; Mon, 9 Jul 2012 10:06:39 -0700 (PDT)
\r
22 Received: from CERNFE22.cern.ch (137.138.144.151) by cernmxgwlb2.cern.ch
\r
23 (137.138.144.177) with Microsoft SMTP Server (TLS) id 14.2.283.3;
\r
24 Mon, 9 Jul 2012 19:06:37 +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; Mon, 9 Jul 2012 19:06:37
\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: <20120709163000.GG18195@mit.edu>
\r
32 References: <871ukl5oj7.fsf@cern.ch> <20120709163000.GG18195@mit.edu>
\r
33 User-Agent: Notmuch/0.13.2+60~g7ecf77d (http://notmuchmail.org) Emacs/24.1.1
\r
34 (x86_64-unknown-linux-gnu)
\r
35 Date: Mon, 9 Jul 2012 19:06:37 +0200
\r
36 Message-ID: <87obno3luq.fsf@cern.ch>
\r
38 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1;
\r
39 protocol="application/pgp-signature"
\r
40 X-Originating-IP: [134.158.88.68]
\r
41 Keywords: CERN SpamKiller Note: -50
\r
42 Cc: Notmuch developer list <notmuch@notmuchmail.org>
\r
43 X-BeenThere: notmuch@notmuchmail.org
\r
44 X-Mailman-Version: 2.1.13
\r
46 List-Id: "Use and development of the notmuch mail system."
\r
47 <notmuch.notmuchmail.org>
\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
51 List-Post: <mailto:notmuch@notmuchmail.org>
\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
54 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
55 X-List-Received-Date: Mon, 09 Jul 2012 17:06:40 -0000
\r
58 Content-Type: text/plain
\r
59 Content-Transfer-Encoding: quoted-printable
\r
61 Austin Clements <amdragon@MIT.EDU> writes:
\r
63 > Quoth Sebastien Binet on Jul 09 at 10:25 am:
\r
67 >> I was trying to reduce the I/O stress during my usual email
\r
68 >> fetching+tagging by writing a little program using the go bindings to
\r
72 >> db, status :=3D notmuch.OpenDatabase(db_path,
\r
73 >> notmuch.DATABASE_MODE_READ_WRITE)
\r
74 >> query :=3D db.CreateQuery("(tag:new AND tag:inbox)")
\r
75 >> msgs :=3D query.SearchMessages()
\r
76 >> for _,msg :=3D range msgs {
\r
77 >> tag_msg(msg, tagqueries)
\r
81 >> where tagqueries is a subquery of the form:
\r
85 >> "Query": "(to:sebastien.binet@cern.ch and not tag:to-me)"
\r
88 >> "Cmd": "+sci-notmuch",
\r
89 >> "Query": "from:notmuch@notmuchmail.org or to:notmuch@notmuchmail=
\r
90 .org or subject:notmuch"
\r
95 >> the idea being that I only need to crawl through the db only once and
\r
96 >> then iteratively apply tags on those messages (instead of repeatedly
\r
97 >> running "notmuch tag ..." for each and every of those many
\r
100 >> I couldn't find any C-API to do such a thing using the notmuch library.
\r
101 >> did I overlook something ?
\r
103 >> Is it something useful to add ?
\r
107 > Have you tried a more direct translation of the multiple notmuch tag
\r
108 > commands into Go, where you don't worry about subsetting the queries?
\r
109 > Unless you're tagging a huge number of messages, the cost of notmuch
\r
110 > tag is almost certainly the fsync that it does when it closes the
\r
111 > database (which every call to notmuch tag must do). However, in Go,
\r
112 > you can keep the database open across all of the tagging operations
\r
113 > and then close and fsync it just once.
\r
115 nope, I haven't tried that, but will do.
\r
118 > Note that there is an important optimization in notmuch tag that you
\r
119 > might have to replicate. It manipulates the original query to exclude
\r
120 > messages that already have the desired tags, so that they get skipped
\r
121 > very efficiently at the earliest stage possible.
\r
122 I already have this in my original shell script.
\r
123 (wouldn't be too hard to automatically do, though.)
\r
128 Content-Type: application/pgp-signature
\r
130 -----BEGIN PGP SIGNATURE-----
\r
131 Version: GnuPG v2.0.19 (GNU/Linux)
\r
133 iEYEARECAAYFAk/7D50ACgkQPj4AVbsZCCbNJQCgt63SDJf50TSrnZ/j6szzYHsu
\r
134 76EAoO3+PD1VEncWbu/uMckjhesXTOKu
\r
136 -----END PGP SIGNATURE-----
\r