From d175a7e1851e2f8ade4edaa4ca69ed78a45c4df5 Mon Sep 17 00:00:00 2001 From: Sebastien Binet Date: Mon, 9 Jul 2012 10:25:48 +0200 Subject: [PATCH] query on a subset of messages ? --- fe/3d0f4480bca43968392c4a04e70c70509d139a | 112 ++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 fe/3d0f4480bca43968392c4a04e70c70509d139a diff --git a/fe/3d0f4480bca43968392c4a04e70c70509d139a b/fe/3d0f4480bca43968392c4a04e70c70509d139a new file mode 100644 index 000000000..b5a60af14 --- /dev/null +++ b/fe/3d0f4480bca43968392c4a04e70c70509d139a @@ -0,0 +1,112 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id CD733431FBC + for ; Mon, 9 Jul 2012 01:31:24 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -5 +X-Spam-Level: +X-Spam-Status: No, score=-5 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_HI=-5] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id Y4yLn3wUnud5 for ; + Mon, 9 Jul 2012 01:31:24 -0700 (PDT) +X-Greylist: delayed 322 seconds by postgrey-1.32 at olra; + Mon, 09 Jul 2012 01:31:24 PDT +Received: from CERNMX30.cern.ch (cernmx30.cern.ch [137.138.144.177]) + (using TLSv1 with cipher AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 09BFE431FAE + for ; Mon, 9 Jul 2012 01:31:23 -0700 (PDT) +Received: from CERNFE22.cern.ch (137.138.144.151) by cernmxgwlb2.cern.ch + (137.138.144.177) with Microsoft SMTP Server (TLS) id 14.2.283.3; + Mon, 9 Jul 2012 10:25:58 +0200 +Received: from localhost (134.158.88.68) by smtp.cern.ch (137.138.144.172) + with Microsoft SMTP Server (TLS) id 14.2.298.4; Mon, 9 Jul 2012 10:25:58 + +0200 +From: Sebastien Binet +To: Notmuch developer list +CC: +Subject: query on a subset of messages ? +User-Agent: Notmuch/0.13.2+60~g7ecf77d (http://notmuchmail.org) Emacs/24.1.1 + (x86_64-unknown-linux-gnu) +Date: Mon, 9 Jul 2012 10:25:48 +0200 +Message-ID: <871ukl5oj7.fsf@cern.ch> +MIME-Version: 1.0 +Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; + protocol="application/pgp-signature" +X-Originating-IP: [134.158.88.68] +Keywords: CERN SpamKiller Note: -50 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 09 Jul 2012 08:31:25 -0000 + +--=-=-= +Content-Type: text/plain + + +hi there, + +I was trying to reduce the I/O stress during my usual email +fetching+tagging by writing a little program using the go bindings to +notmuch. + +ie: +db, status := notmuch.OpenDatabase(db_path, + notmuch.DATABASE_MODE_READ_WRITE) +query := db.CreateQuery("(tag:new AND tag:inbox)") +msgs := query.SearchMessages() +for _,msg := range msgs { + tag_msg(msg, tagqueries) +} + + +where tagqueries is a subquery of the form: +[ + { + "Cmd": "+to-me", + "Query": "(to:sebastien.binet@cern.ch and not tag:to-me)" + }, + { + "Cmd": "+sci-notmuch", + "Query": "from:notmuch@notmuchmail.org or to:notmuch@notmuchmail.org or subject:notmuch" + } +] + + +the idea being that I only need to crawl through the db only once and +then iteratively apply tags on those messages (instead of repeatedly +running "notmuch tag ..." for each and every of those many +'tag-queries') + +I couldn't find any C-API to do such a thing using the notmuch library. +did I overlook something ? + +Is it something useful to add ? + +-s + +--=-=-= +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.19 (GNU/Linux) + +iEYEARECAAYFAk/6lZUACgkQPj4AVbsZCCZzDACg2EcoBgFsmozMYmYI/Vj+on6h +mFYAn19k1GKmhbmAo5MYmthYSf2At5zs +=d2QK +-----END PGP SIGNATURE----- +--=-=-=-- -- 2.26.2