Re: Bug: counting messages twice after excluding tags yields different results

Subject: Re: Bug: counting messages twice after excluding tags yields different results

Date: Wed, 31 Aug 2016 12:56:07 +0000

To: David Bremner, Lucas Hoffmann, notmuch@notmuchmail.org

Cc:

From: Franz Fellner


On Wed, 31 Aug 2016 09:20:52 -0300, David Bremner <david@tethera.net> wrote:
> Lucas Hoffmann <luc.lists@gmail.com> writes:
> 
> > Thank you Franz, sadly your reply did not convince me:
> >
> > Quoting Franz Fellner (2016-08-31 11:21:18)
> >> Your problem: the example sucks ;)
> >
> > No, I must object :(
> >
> >> If the query searches for a tag you also have in exclude_tags (in your
> >> case: spam) the exclude gets ignored.
> >
> > Is that documented?  Because it is not what I would expect.
> 
> Yes, it is documented in notmuch-config(1)

And for "destructiveness" see the implementation in lib/query.cc _notmuch_exclude_tags:
It replaces every matching tag in query_string and exclude_tags with an empty string ""
in the exclude terms. This most likely results in <match_all_documents> which can be
seen as a bug, if you want; removing would be better but also more expensive.

For a quick test run your test program with different queries/exclude_tags with
NOTMUCH_DEBUG_QUERY (man notmuch) set to a non-empty value and look what happens ;)

Thread: