notmuch_query_add_tag_exclude bug

classic Classic list List threaded Threaded
3 messages Options
Justus Winter-3 Justus Winter-3
Reply | Threaded
Open this post in threaded view
|

notmuch_query_add_tag_exclude bug

Hi :)

so I found a weird bug with notmuch_query_add_tag_exclude.  Apparently,
when I exclude 'spam', and search for 'spam', I still get results, but
if I exclude 'spam', and search for 'is_a_spam', I get no results, even
though there are mails tagged with that tag.

~~~ snip ~~~
import notmuch

d = notmuch.Database()
q = d.create_query("tag:spam")
q.exclude_tag("spam")
assert len(list(q.search_messages())) > 0

q = d.create_query("tag:is_a_spam")
assert len(list(q.search_messages())) > 0

q = d.create_query("tag:is_a_spam")
q.exclude_tag("spam")
assert len(list(q.search_messages())) > 0, "weird"
~~~ snip ~~~

% python3 ignore_tag_bug.py
Traceback (most recent call last):
  File "ignore_tag_bug.py", line 13, in <module>
    assert len(list(q.search_messages())) > 0, "weird"
AssertionError: weird
% notmuch --version
notmuch 0.26

Cheers,
Justus

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (497 bytes) Download Attachment
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: notmuch_query_add_tag_exclude bug

Justus Winter <[hidden email]> writes:

> Hi :)
>
> so I found a weird bug with notmuch_query_add_tag_exclude.  Apparently,
> when I exclude 'spam', and search for 'spam', I still get results, but
> if I exclude 'spam', and search for 'is_a_spam', I get no results, even
> though there are mails tagged with that tag.
>

I'm not sure I follow you you. Can you try with

    export NOTMUCH_DEBUG_QUERY=yes

and see what the query terms are?

The latter actually sounds legit assuming

    - the excluded messages are tagged spam
    - the query parser is not breaking is_a_spam up, but treating it as
      one term.
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Justus Winter-3 Justus Winter-3
Reply | Threaded
Open this post in threaded view
|

Re: notmuch_query_add_tag_exclude bug

David Bremner <[hidden email]> writes:

> Justus Winter <[hidden email]> writes:
>
>> Hi :)
>>
>> so I found a weird bug with notmuch_query_add_tag_exclude.  Apparently,
>> when I exclude 'spam', and search for 'spam', I still get results, but
>> if I exclude 'spam', and search for 'is_a_spam', I get no results, even
>> though there are mails tagged with that tag.
>>
>
> I'm not sure I follow you you. Can you try with
>
>     export NOTMUCH_DEBUG_QUERY=yes
>
> and see what the query terms are?
>
> The latter actually sounds legit assuming
>
>     - the excluded messages are tagged spam
Uh, actually they are, so there is no bug other than me being
confused...

Sorry for the noise...
Justus

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (497 bytes) Download Attachment