unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: "Jorge P. de Morais Neto" <jorge+list@disroot.org>
To: notmuch@notmuchmail.org
Subject: New Python bindings (notmuch2 module) fail to exclude tags
Date: Fri, 20 Nov 2020 12:54:31 -0300	[thread overview]
Message-ID: <87r1oohvm0.fsf@disroot.org> (raw)

Hi.  I am trying to migrate my Python3 script to the new Python bindings
(notmuch2 module).  However, I cannot obtain a count of messages
matching a query excluding messages that have an exclude tag.  From the
command line:
    $ notmuch count 'is:.bf_spam'
    0

The CLI command correctly counts zero messages having '.bf_spam' tag,
because all such messages also have the excluded 'spam' tag.  But from
Python:

$ python3
Python 3.7.3 (default, Jul 25 2020, 13:03:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import notmuch2
>>> nm_db=notmuch2.Database()
>>> nm_db.count_messages('is:.bf_spam', exclude_tags=('spam',))
379
>>> nm_db.count_messages('is:.bf_spam', exclude_tags=('spam',), omit_excluded=nm_db.EXCLUDE.FALSE)
379
>>> nm_db.count_messages('is:.bf_spam', exclude_tags=('spam',), omit_excluded=nm_db.EXCLUDE.TRUE)
379
>>> nm_db.count_messages('is:.bf_spam', exclude_tags=('spam',), omit_excluded=nm_db.EXCLUDE.ALL)
379
>>> nm_db.count_messages('is:.bf_spam', exclude_tags=('spam',), omit_excluded=nm_db.EXCLUDE.FLAG)
379

Am I doing something wrong?

Regards

-- 
- <https://jorgemorais.gitlab.io/justice-for-rms/>
- If an email of mine arrives at your spam box, please notify me.
- Please adopt free/libre formats like PDF, ODF, Org, LaTeX, Opus, WebM and 7z.
- Free/libre software for Replicant, LineageOS and Android: https://f-droid.org
- [[https://www.gnu.org/philosophy/free-sw.html][What is free software?]]

             reply	other threads:[~2020-11-20 15:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20 15:54 Jorge P. de Morais Neto [this message]
2020-11-20 18:02 ` New Python bindings (notmuch2 module) fail to exclude tags David Bremner
2020-11-20 18:17 ` Floris Bruynooghe
2020-11-21 21:51   ` Jorge P. de Morais Neto
2020-11-24 22:33     ` Floris Bruynooghe
2020-11-25 11:07       ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r1oohvm0.fsf@disroot.org \
    --to=jorge+list@disroot.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).