query on a subset of messages ?

Subject: query on a subset of messages ?

Date: Mon, 9 Jul 2012 10:25:48 +0200

To: Notmuch developer list

Cc:

From: Sebastien Binet


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
part-000.sig (application/pgp-signature)

Thread: