* Optimization for notmuch tag by implicit filters
@ 2011-04-14 8:23 Florian Friesdorf
2011-04-16 12:59 ` Pieter Praet
0 siblings, 1 reply; 4+ messages in thread
From: Florian Friesdorf @ 2011-04-14 8:23 UTC (permalink / raw)
To: notmuch
[-- Attachment #1: Type: text/plain, Size: 1074 bytes --]
With 60k messages and 12k tagged as sent:
$ time notmuch tag +sent -- from:flo@chaoflow.net
real 0m8.561s
user 0m8.069s
sys 0m0.212s
$ time notmuch tag +sent -- from:flo@chaoflow.net and not tag:sent
real 0m0.043s
user 0m0.036s
sys 0m0.006s
This could be made implicit:
notmuch tag +A +B -- <filter>
-->
notmuch tag +A +B -- <filter> and not \(tag:A and tag:B\)
Apply command, if one of the tags is not set.
notmuch tag -C -D -- <filter>
-->
notmuch tag -C -D -- <filter> and \(tag:C or tag:D\)
Apply command, if one of the tags is set.
notmuch tag +A +B -C -D -- <filter>
-->
notmuch tag +A +B -C -D -- <filter> and \(not tag:A or not tag:B\ or tag:C or tag:D\)
In order to enforce tagging and disable the filter there could be a
flag.
I lack the knowledge/time to implement it, but I think it's at least
worth documenting it.
--
Florian Friesdorf <flo@chaoflow.net>
GPG FPR: 7A13 5EEE 1421 9FC2 108D BAAF 38F8 99A3 0C45 F083
Jabber/XMPP: flo@chaoflow.net
IRC: chaoflow on freenode,ircnet,blafasel,OFTC
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Optimization for notmuch tag by implicit filters
2011-04-14 8:23 Optimization for notmuch tag by implicit filters Florian Friesdorf
@ 2011-04-16 12:59 ` Pieter Praet
2011-04-26 21:31 ` Florian Friesdorf
0 siblings, 1 reply; 4+ messages in thread
From: Pieter Praet @ 2011-04-16 12:59 UTC (permalink / raw)
To: Florian Friesdorf, notmuch
On Thu, 14 Apr 2011 10:23:46 +0200, Florian Friesdorf <flo@chaoflow.net> wrote:
>
> With 60k messages and 12k tagged as sent:
>
> $ time notmuch tag +sent -- from:flo@chaoflow.net
>
> real 0m8.561s
> user 0m8.069s
> sys 0m0.212s
>
> $ time notmuch tag +sent -- from:flo@chaoflow.net and not tag:sent
>
> real 0m0.043s
> user 0m0.036s
> sys 0m0.006s
>
>
> This could be made implicit:
>
> notmuch tag +A +B -- <filter>
> -->
> notmuch tag +A +B -- <filter> and not \(tag:A and tag:B\)
>
> Apply command, if one of the tags is not set.
>
>
> notmuch tag -C -D -- <filter>
> -->
> notmuch tag -C -D -- <filter> and \(tag:C or tag:D\)
>
> Apply command, if one of the tags is set.
>
>
> notmuch tag +A +B -C -D -- <filter>
> -->
> notmuch tag +A +B -C -D -- <filter> and \(not tag:A or not tag:B\ or tag:C or tag:D\)
>
>
> In order to enforce tagging and disable the filter there could be a
> flag.
>
> I lack the knowledge/time to implement it, but I think it's at least
> worth documenting it.
>
> --
> Florian Friesdorf <flo@chaoflow.net>
> GPG FPR: 7A13 5EEE 1421 9FC2 108D BAAF 38F8 99A3 0C45 F083
> Jabber/XMPP: flo@chaoflow.net
> IRC: chaoflow on freenode,ircnet,blafasel,OFTC
Non-text part: application/pgp-signature
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
Most of us already do this explicitly in our tagging scripts, so no harm
in making it standard behaviour, I guess.
Though to keep the implementation nice & clean, I'd advise against the
use of parens: no need for escape chars, no messing with De Morgan's
law, simply map the tag operations to their inverse in conjunctively
joined filters:
notmuch tag +A +B -- <filter> and not tag:A or not tag:B
notmuch tag -C -D -- <filter> and tag:C or tag:D
notmuch tag +A +B -C -D -- <filter> and not tag:A or not tag:B or tag:C or tag:D
Peace
-Pieter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Optimization for notmuch tag by implicit filters
2011-04-16 12:59 ` Pieter Praet
@ 2011-04-26 21:31 ` Florian Friesdorf
2011-04-27 20:41 ` Pieter Praet
0 siblings, 1 reply; 4+ messages in thread
From: Florian Friesdorf @ 2011-04-26 21:31 UTC (permalink / raw)
To: Pieter Praet, notmuch
[-- Attachment #1: Type: text/plain, Size: 2324 bytes --]
On Sat, 16 Apr 2011 14:59:34 +0200, Pieter Praet <pieter@praet.org> wrote:
> On Thu, 14 Apr 2011 10:23:46 +0200, Florian Friesdorf <flo@chaoflow.net> wrote:
> >
> > With 60k messages and 12k tagged as sent:
> >
> > $ time notmuch tag +sent -- from:flo@chaoflow.net
> >
> > real 0m8.561s
> > user 0m8.069s
> > sys 0m0.212s
> >
> > $ time notmuch tag +sent -- from:flo@chaoflow.net and not tag:sent
> >
> > real 0m0.043s
> > user 0m0.036s
> > sys 0m0.006s
> >
> >
> > This could be made implicit:
> >
> > notmuch tag +A +B -- <filter>
> > -->
> > notmuch tag +A +B -- <filter> and not \(tag:A and tag:B\)
> >
> > Apply command, if one of the tags is not set.
> >
> >
> > notmuch tag -C -D -- <filter>
> > -->
> > notmuch tag -C -D -- <filter> and \(tag:C or tag:D\)
> >
> > Apply command, if one of the tags is set.
> >
> >
> > notmuch tag +A +B -C -D -- <filter>
> > -->
> > notmuch tag +A +B -C -D -- <filter> and \(not tag:A or not tag:B\ or tag:C or tag:D\)
The second '\' after 'B' is not supposed to be there.
> > In order to enforce tagging and disable the filter there could be a
> > flag.
> >
> > I lack the knowledge/time to implement it, but I think it's at least
> > worth documenting it.
>
> Most of us already do this explicitly in our tagging scripts, so no harm
> in making it standard behaviour, I guess.
>
> Though to keep the implementation nice & clean, I'd advise against the
> use of parens: no need for escape chars, no messing with De Morgan's
> law, simply map the tag operations to their inverse in conjunctively
> joined filters:
>
> notmuch tag +A +B -- <filter> and not tag:A or not tag:B
> notmuch tag -C -D -- <filter> and tag:C or tag:D
> notmuch tag +A +B -C -D -- <filter> and not tag:A or not tag:B or tag:C or tag:D
I am not sure whether I understand what you mean.
The parens are already supported by notmuch and also needed. Your second
line for example would remove C and D, if D is set, independently of
<filter>. Without parens, based on `and` taking precedence over `or`:
F and (C or D) = F and C or F and D.
--
Florian Friesdorf <flo@chaoflow.net>
GPG FPR: 7A13 5EEE 1421 9FC2 108D BAAF 38F8 99A3 0C45 F083
Jabber/XMPP: flo@chaoflow.net
IRC: chaoflow on freenode,ircnet,blafasel,OFTC
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Optimization for notmuch tag by implicit filters
2011-04-26 21:31 ` Florian Friesdorf
@ 2011-04-27 20:41 ` Pieter Praet
0 siblings, 0 replies; 4+ messages in thread
From: Pieter Praet @ 2011-04-27 20:41 UTC (permalink / raw)
To: Florian Friesdorf, notmuch
On Tue, 26 Apr 2011 23:31:09 +0200, Florian Friesdorf <flo@chaoflow.net> wrote:
> On Sat, 16 Apr 2011 14:59:34 +0200, Pieter Praet <pieter@praet.org> wrote:
> > On Thu, 14 Apr 2011 10:23:46 +0200, Florian Friesdorf <flo@chaoflow.net> wrote:
> > >
> > > With 60k messages and 12k tagged as sent:
> > >
> > > $ time notmuch tag +sent -- from:flo@chaoflow.net
> > >
> > > real 0m8.561s
> > > user 0m8.069s
> > > sys 0m0.212s
> > >
> > > $ time notmuch tag +sent -- from:flo@chaoflow.net and not tag:sent
> > >
> > > real 0m0.043s
> > > user 0m0.036s
> > > sys 0m0.006s
> > >
> > >
> > > This could be made implicit:
> > >
> > > notmuch tag +A +B -- <filter>
> > > -->
> > > notmuch tag +A +B -- <filter> and not \(tag:A and tag:B\)
> > >
> > > Apply command, if one of the tags is not set.
> > >
> > >
> > > notmuch tag -C -D -- <filter>
> > > -->
> > > notmuch tag -C -D -- <filter> and \(tag:C or tag:D\)
> > >
> > > Apply command, if one of the tags is set.
> > >
> > >
> > > notmuch tag +A +B -C -D -- <filter>
> > > -->
> > > notmuch tag +A +B -C -D -- <filter> and \(not tag:A or not tag:B\ or tag:C or tag:D\)
>
> The second '\' after 'B' is not supposed to be there.
>
> > > In order to enforce tagging and disable the filter there could be a
> > > flag.
> > >
> > > I lack the knowledge/time to implement it, but I think it's at least
> > > worth documenting it.
> >
> > Most of us already do this explicitly in our tagging scripts, so no harm
> > in making it standard behaviour, I guess.
> >
> > Though to keep the implementation nice & clean, I'd advise against the
> > use of parens: no need for escape chars, no messing with De Morgan's
> > law, simply map the tag operations to their inverse in conjunctively
> > joined filters:
> >
> > notmuch tag +A +B -- <filter> and not tag:A or not tag:B
> > notmuch tag -C -D -- <filter> and tag:C or tag:D
> > notmuch tag +A +B -C -D -- <filter> and not tag:A or not tag:B or tag:C or tag:D
>
> I am not sure whether I understand what you mean.
>
> The parens are already supported by notmuch and also needed. Your second
> line for example would remove C and D, if D is set, independently of
> <filter>. Without parens, based on `and` taking precedence over `or`:
>
> F and (C or D) = F and C or F and D.
>
> --
> Florian Friesdorf <flo@chaoflow.net>
> GPG FPR: 7A13 5EEE 1421 9FC2 108D BAAF 38F8 99A3 0C45 F083
> Jabber/XMPP: flo@chaoflow.net
> IRC: chaoflow on freenode,ircnet,blafasel,OFTC
Non-text part: application/pgp-signature
Correct.
I wasn't taking the user-defined <filter> into consideration, which
should indeed be conjunctive with the *entire* following expression.
I was commenting on the use of parens *inside* our implicit filter,
which was absolutely superfluous since you did no such thing. :D
Also, I said "simply map the tag operations to their inverse in
conjunctively joined filters", but what I meant was "DISjunctively
joined filters".
Perhaps I should go over my textbook on propositional logic again one
of these days :)
Peace
-Pieter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-04-27 20:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-14 8:23 Optimization for notmuch tag by implicit filters Florian Friesdorf
2011-04-16 12:59 ` Pieter Praet
2011-04-26 21:31 ` Florian Friesdorf
2011-04-27 20:41 ` Pieter Praet
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).