Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 15750431FCF for ; Sun, 7 Dec 2014 09:41:33 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Clc6iL82YTgL for ; Sun, 7 Dec 2014 09:41:29 -0800 (PST) Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 71A31431FC0 for ; Sun, 7 Dec 2014 09:41:29 -0800 (PST) Received: from remotemail by yantan.tethera.net with local (Exim 4.80) (envelope-from ) id 1Xxfpi-00032K-JV; Sun, 07 Dec 2014 13:41:22 -0400 Received: (nullmailer pid 2029 invoked by uid 1000); Sun, 07 Dec 2014 17:41:17 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: Re: notmuch_query_add_tag_excluded and notmuch_query_search_threads In-Reply-To: <1417962498-astroid-0-zqj7j2s0ov-9575@strange> References: <1417905319-astroid-0-i86er7iwg5-10728@strange> <87388rfzhw.fsf@maritornes.cs.unb.ca> <1417958519-astroid-0-ydniq6pte2-8575@strange> <87wq63ef9s.fsf@maritornes.cs.unb.ca> <1417962498-astroid-0-zqj7j2s0ov-9575@strange> User-Agent: Notmuch/0.19+2~g32855b9 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) Date: Sun, 07 Dec 2014 18:41:17 +0100 Message-ID: <87r3wbe4si.fsf@maritornes.cs.unb.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Dec 2014 17:41:33 -0000 Gaute Hope writes: >>=20 > > Ok, that explains it. You are right - I mixed up, the count is correct. > > regards, gaute At the end of this message is a simpler example, that I think demonstrates a bug. At the very list it's not very nice that the destructiveness only shows up when excludes are involved. Here is the output; note the second exclude query! ,---- | =E2=95=AD=E2=94=80 maritornes:~/tmp=20 | =E2=95=B0=E2=94=80% NOTMUCH_DEBUG_QUERY=3D1 ./a.out | Query string is: | tag:muted | Exclude query is: | Xapian::Query() | Final query is: | Xapian::Query((Tmail AND 0 * Kmuted)) | ret1=3D84 | Exclude query is: | Xapian::Query() | Final query is: | Xapian::Query(((Tmail AND 0 * Kmuted) AND_NOT )) | ret2=3D0 `---- #include #include #include int main(int argc, char **argv){ notmuch_database_t *nm_db; notmuch_query_t *query; if (notmuch_database_open ("/home/bremner/Maildir/", NOTMUCH_DATABASE_MODE_READ_ONLY, &nm_db)) return 1; query =3D notmuch_query_create (nm_db, "tag:muted"); notmuch_query_add_tag_exclude (query, "muted"); notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_TRUE); printf("ret1=3D%d\n", notmuch_query_count_threads (query)); printf("ret2=3D%d\n", notmuch_query_count_threads (query)); }