unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Fwd: notmuch collects empty tags/labels
       [not found]   ` <CAKSm3FLEa6EPF7NFLtOcwnt_Zvq5SFPRPdw2mMGybYU1yOQbeg@mail.gmail.com>
@ 2024-10-20 21:39     ` prowess-alarm-much
  2024-10-21 18:21       ` David Bremner
       [not found]       ` <B9F43BB1-893E-4695-810E-D5E9C66D1AAC.1@smtp-inbound1.duck.com>
  0 siblings, 2 replies; 4+ messages in thread
From: prowess-alarm-much @ 2024-10-20 21:39 UTC (permalink / raw)
  To: notmuch

Dear developers and maintainers,

I'm a fan of notmuch, but recently notmuch indexed 1679 messages with
an empty tag, when I run: notmuch count -- tag:

When I look for some of the messages in this list, I get messages that
have some tags already, and messages with no tags, but somehow,
notmuch seems to consider the existence of a "" tag. And the outcome
is the same, whether I search for: tag:,tag:'', or even
tag:"". Even together with other tags.

It is a tag in the sense that I can look for specific messages with
that empty tag.

if I try
tag remove-all +untagged -- tag
I get 1679 messages tagged with "untagged" as well as "".

if I try:
tag remove-all -- tag:
I get no errors, notmuch will remove all tags, but the empty tag will remain.

I'm running latest stable notmuch 0.37(?) on Debian/WSL2/Win11 if that helps.

Thanks and keep up the great work!
Pam

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fwd: notmuch collects empty tags/labels
  2024-10-20 21:39     ` Fwd: notmuch collects empty tags/labels prowess-alarm-much
@ 2024-10-21 18:21       ` David Bremner
       [not found]       ` <B9F43BB1-893E-4695-810E-D5E9C66D1AAC.1@smtp-inbound1.duck.com>
  1 sibling, 0 replies; 4+ messages in thread
From: David Bremner @ 2024-10-21 18:21 UTC (permalink / raw)
  To: prowess-alarm-much, notmuch

prowess-alarm-much@duck.com writes:

> Dear developers and maintainers,
>
> I'm a fan of notmuch, but recently notmuch indexed 1679 messages with
> an empty tag, when I run: notmuch count -- tag:
>
> When I look for some of the messages in this list, I get messages that
> have some tags already, and messages with no tags, but somehow,
> notmuch seems to consider the existence of a "" tag. And the outcome
> is the same, whether I search for: tag:,tag:'', or even
> tag:"". Even together with other tags.

the TL;DR:

Unfortunately this is just the default query parser in Xapian (that
notmuch extends) falling back to looking for messages containing the
word tag. 

The longer explanation:

If you are curious, you can run

    $ NOTMUCH_DEBUG_QUERY=t notmuch count tag:""
    Query string is:
    tag:
    Exclude query is:
    Query((((Kspam OR Kdeleted) OR Kmuted) OR Kbad-address))
    Final query is:
    Query(((Tmail AND (Ztag@1 OR ZGtag@1 OR ZKtag@1 OR ZKtag@1 OR ZQtag@1 OR
    ZQtag@1 OR ZPtag@1 OR ZXPROPERTYtag@1 OR ZXFOLDER:tag@1 OR ZXFROMtag@1
    OR ZXTOtag@1 OR ZXATTACHMENTtag@1 OR ZXMIMETYPEtag@1 OR ZXSUBJECTtag@1
    OR ZXUList:tag@1)) AND_NOT (((Kspam OR Kdeleted) OR Kmuted) OR
    Kbad-address)))

It's probably not too easy to read, but if squint you can see a bunch of
prefixes other than K, which is tag.

In case of surprising results, it's also worth trying the sexp query
parser, as it is more likely to report errors, and in general handles
corner cases better (the flip side of being less DWIM, I guess).

NOTMUCH_DEBUG_QUERY=t notmuch count --query=sexp '(tag "")'

    Query string is:
    (tag "")
    Exclude query is:
    Query((((Kspam OR Kdeleted) OR Kmuted) OR Kbad-address))
    Final query is:
    Query(((Tmail AND (<alldocuments> AND K)) AND_NOT (((Kspam OR
    Kdeleted) OR Kmuted) OR Kbad-address)))

This query is easier to read, in particular K alone is the correct
translation for an empty tag. For me this gets the expected answer 0.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fwd: notmuch collects empty tags/labels
       [not found]       ` <B9F43BB1-893E-4695-810E-D5E9C66D1AAC.1@smtp-inbound1.duck.com>
@ 2024-10-21 19:50         ` prowess-alarm-much
       [not found]         ` <DE6D1905-862E-48E2-9F20-73F7BC76C381.1@smtp-inbound1.duck.com>
  1 sibling, 0 replies; 4+ messages in thread
From: prowess-alarm-much @ 2024-10-21 19:50 UTC (permalink / raw)
  To: David Bremner, notmuch@notmuchmail.org

So if I understand it well, running the query in sexp mode: notmuch
count --query=sexp '(tag "")'

will yield the actual "tagless" tag, which in my case is 0.

while this query: notmuch count -- tag:

will yield "garbage" results, which in my case today is 1681, it has
increased by 2, and in both cases it's these two very emails I've sent
to the mailing list :-)

I shouldn't be worried, right?


On Mon, 21 Oct 2024 at 20:21, David Bremner
<david_at_tethera.net_prowess-alarm-much@duck.com> wrote:
>
> prowess-alarm-much@duck.com writes:
>
> > Dear developers and maintainers,
> >
> > I'm a fan of notmuch, but recently notmuch indexed 1679 messages with
> > an empty tag, when I run: notmuch count -- tag:
> >
> > When I look for some of the messages in this list, I get messages that
> > have some tags already, and messages with no tags, but somehow,
> > notmuch seems to consider the existence of a "" tag. And the outcome
> > is the same, whether I search for: tag:,tag:'', or even
> > tag:"". Even together with other tags.
>
> the TL;DR:
>
> Unfortunately this is just the default query parser in Xapian (that
> notmuch extends) falling back to looking for messages containing the
> word tag.
>
> The longer explanation:
>
> If you are curious, you can run
>
>     $ NOTMUCH_DEBUG_QUERY=t notmuch count tag:""
>     Query string is:
>     tag:
>     Exclude query is:
>     Query((((Kspam OR Kdeleted) OR Kmuted) OR Kbad-address))
>     Final query is:
>     Query(((Tmail AND (Ztag@1 OR ZGtag@1 OR ZKtag@1 OR ZKtag@1 OR ZQtag@1 OR
>     ZQtag@1 OR ZPtag@1 OR ZXPROPERTYtag@1 OR ZXFOLDER:tag@1 OR ZXFROMtag@1
>     OR ZXTOtag@1 OR ZXATTACHMENTtag@1 OR ZXMIMETYPEtag@1 OR ZXSUBJECTtag@1
>     OR ZXUList:tag@1)) AND_NOT (((Kspam OR Kdeleted) OR Kmuted) OR
>     Kbad-address)))
>
> It's probably not too easy to read, but if squint you can see a bunch of
> prefixes other than K, which is tag.
>
> In case of surprising results, it's also worth trying the sexp query
> parser, as it is more likely to report errors, and in general handles
> corner cases better (the flip side of being less DWIM, I guess).
>
> NOTMUCH_DEBUG_QUERY=t notmuch count --query=sexp '(tag "")'
>
>     Query string is:
>     (tag "")
>     Exclude query is:
>     Query((((Kspam OR Kdeleted) OR Kmuted) OR Kbad-address))
>     Final query is:
>     Query(((Tmail AND (<alldocuments> AND K)) AND_NOT (((Kspam OR
>     Kdeleted) OR Kmuted) OR Kbad-address)))
>
> This query is easier to read, in particular K alone is the correct
> translation for an empty tag. For me this gets the expected answer 0.
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fwd: notmuch collects empty tags/labels
       [not found]         ` <DE6D1905-862E-48E2-9F20-73F7BC76C381.1@smtp-inbound1.duck.com>
@ 2024-10-22 11:07           ` David Bremner
  0 siblings, 0 replies; 4+ messages in thread
From: David Bremner @ 2024-10-22 11:07 UTC (permalink / raw)
  To: prowess-alarm-much, notmuch@notmuchmail.org

prowess-alarm-much@duck.com writes:

> So if I understand it well, running the query in sexp mode: notmuch
> count --query=sexp '(tag "")'
>
> will yield the actual "tagless" tag, which in my case is 0.
>
> while this query: notmuch count -- tag:
>
> will yield "garbage" results, which in my case today is 1681, it has
> increased by 2, and in both cases it's these two very emails I've sent
> to the mailing list :-)
>
> I shouldn't be worried, right?

Right. For the archive, if someone wants to find "tagless" in the sense
of having no tags messages, sexp queries can do that as well

$ notmuch count --query=sexp '(not (tag *))'

This ends todays promotional feature on sexp queries ;)

David

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-10-22 11:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <172945290517.687252.6490702432852377348@yantan.tethera.net>
     [not found] ` <F43B8F48-524A-4B75-80F4-775E0003E8BD.1@smtp-inbound1.duck.com>
     [not found]   ` <CAKSm3FLEa6EPF7NFLtOcwnt_Zvq5SFPRPdw2mMGybYU1yOQbeg@mail.gmail.com>
2024-10-20 21:39     ` Fwd: notmuch collects empty tags/labels prowess-alarm-much
2024-10-21 18:21       ` David Bremner
     [not found]       ` <B9F43BB1-893E-4695-810E-D5E9C66D1AAC.1@smtp-inbound1.duck.com>
2024-10-21 19:50         ` prowess-alarm-much
     [not found]         ` <DE6D1905-862E-48E2-9F20-73F7BC76C381.1@smtp-inbound1.duck.com>
2024-10-22 11:07           ` David Bremner

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).