query on a subset of messages ?
Jameson Graef Rollins
jrollins at finestructure.net
Mon Jul 9 08:55:29 PDT 2012
On Mon, Jul 09 2012, Sebastien Binet <binet at cern.ch> wrote:
> 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 at cern.ch and not tag:to-me)"
> },
> {
> "Cmd": "+sci-notmuch",
> "Query": "from:notmuch at notmuchmail.org or to:notmuch at notmuchmail.org or subject:notmuch"
> }
> ]
Hi, Sebastian. It's really hard for me to believe that this is much
faster than simply making the two tagging calls in full:
notmuch tag +to-me -- tag:new and tag:inbox and (to:sebastien.binet at cern.ch and not tag:to-me)
notmuch tag +sci-notmuch -- tag:new and tag:inbox and from:notmuch at notmuchmail.org or to:notmuch at notmuchmail.org or subject:notmuch"
After the first call the cache will be fresh, so the overhead should be
minimal. It looks to me you're looking in to this as a post-new hook.
I do pretty much the same thing, and with the above properly constructed
searches the tagging is super fast.
Have you tried profiling the two options? Is it really high I/O stress
on your system? If so, maybe there's another issue that can be
addressed.
As an aside I should point out that a lot of people want to see the
"to:me" search term. But I think the right place to achieve that is in
the query parser.
jamie.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20120709/af57bb42/attachment.pgp>
More information about the notmuch
mailing list