[notmuch] Rather simple optimization for notmuch tag

Carl Worth cworth at cworth.org
Fri Dec 18 09:39:09 PST 2009


On Fri, 18 Dec 2009 00:49:00 -0700, Mark Anderson <MarkR.Anderson at amd.com> wrote:
> I was updating my poll script that tags messages, and a common idiom is
> to put
>  tag +mytag <search_terms> and not tag:mytag
> 
> I don't know anything about efficiency, but for the simple single-tag
> case, couldn't we imply the "and not tag:mytag" from the +mytag action
> list for the tag command?

On one level, it really shouldn't be a performance issue to tag messages
that already have a particular tag. (And in fact, the recently proposed
patches to fix Xapian defect 250 even address this I think.)

In the meantime, it is fairly annoying to have to type this, and yes,
the tag command could infer that and append it to the search string
automatically. That's a good idea, really.

> The similar (dual?, rusty math terminology, beware of Math-tetanus) case
> of "tag -mytag <search-terms> and tag:mytag" could be similarly optimized,
> since the tag removal action ought to be a null action in the case that
> the search terms matched on a thread or message, but the tag to be
> removed isn't attached to the message/thread returned.

Yes, that would work too.

One potential snag with both ideas is that the "notmuch tag"
command-line as currently implemented allows for multiple tag additions
and removals with a single search. So the optimization here couldn't be
used unless there was just a single tag action.

So that's another reason to really just want the lower-level
optimization to be in place.

-Carl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091218/00565d5b/attachment.pgp>


More information about the notmuch mailing list