search summary and exclusions

Peter Wang novalazy at gmail.com
Mon May 28 21:01:07 PDT 2012


On Mon, 28 May 2012 10:03:35 -0700, Jameson Graef Rollins <jrollins at finestructure.net> wrote:
> On Mon, May 28 2012, Peter Wang <novalazy at gmail.com> wrote:
> > Exclusions don't work the way I expected with the search command and
> > --output=summary.  I would like messages with excluded tags to be
> > treated as if they don't exist at all, but currently:
> >
> >   * excluded messages are counted towards the "total"
> >   * excluded tags are included in the "tags" set
> >
> > Are these deliberate?  Especially the second point seems to conflict
> > with search --output=tags, which doesn't show excluded tags.
> 
> Hi, Peter.  Can you explain more what you mean?  I'm not sure what your
> two bullets have to do with --output=summary.  Messages are counted with
> the count subcommand, and tags are shown with search --output=tags,
> neither of which have anything to do with --output=summary, and both of
> which accept the exclude flag:
> 
> notmuch count --exclude=true '*'
> notmuch search --output=tags --exclude=true '*'
> 
> Maybe you can give a clearer explanation of what your issue is.
> Examples help.

Sure.  I keep draft messages in the mail store, and tag them with
'draft', and later 'deleted'.  I would like the exclusions to treat
draft and deleted messages as if they didn't exist in the store.

% ./notmuch search --format=json --exclude=true -- thread:0000000000009598 tag:unread
[{"thread": "0000000000009598",
"timestamp": 1338231998,
"date_relative": "Today 05:06",
"matched": 1,
"total": 15,
"authors": "Mark Walters| Peter Wang",
"subject": "[PATCH v6 3/6] cli: make --entire-thread=false work for format=json.",
"tags": ["deleted", "draft", "replied", "sent", "unread"]}]

Here is a thread I participated in.  From this, my MUA displays "1/15",
suggesting that there is 1 unread message out of a total of 15.  But
upon opening the thread, there are only 11 messages visible: 4 were
drafts (possibly deleted) which have been excluded.  To the user, it
looks like some messages went missing.

Therefore I would like search --output=summary --exclude=true
to report the total number of non-excluded messages.  It doesn't need to
be via the "total" field; a new field would be fine.

Peter


More information about the notmuch mailing list