From: David Bremner Date: Sun, 7 Dec 2014 11:52:43 +0000 (+0100) Subject: Re: notmuch_query_add_tag_excluded and notmuch_query_search_threads X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=97d106690e52650a16874263e70906e7c38627e8;p=notmuch-archives.git Re: notmuch_query_add_tag_excluded and notmuch_query_search_threads --- diff --git a/ca/99ca6ccc2a9586074aceb1550fe12388381ee9 b/ca/99ca6ccc2a9586074aceb1550fe12388381ee9 new file mode 100644 index 000000000..542322b02 --- /dev/null +++ b/ca/99ca6ccc2a9586074aceb1550fe12388381ee9 @@ -0,0 +1,94 @@ +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 1B688431E62 + for ; Sun, 7 Dec 2014 03:52:57 -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 pIioDdv0oraY for ; + Sun, 7 Dec 2014 03:52:53 -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 DE817431FDF + for ; Sun, 7 Dec 2014 03:52:53 -0800 (PST) +Received: from remotemail by yantan.tethera.net with local (Exim 4.80) + (envelope-from ) + id 1XxaOP-0001m2-2n; Sun, 07 Dec 2014 07:52:49 -0400 +Received: (nullmailer pid 26232 invoked by uid 1000); Sun, 07 Dec 2014 + 11:52:43 -0000 +From: David Bremner +To: Gaute Hope , notmuch@notmuchmail.org +Subject: Re: notmuch_query_add_tag_excluded and notmuch_query_search_threads +In-Reply-To: <1417905319-astroid-0-i86er7iwg5-10728@strange> +References: <1417905319-astroid-0-i86er7iwg5-10728@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 12:52:43 +0100 +Message-ID: <87388rfzhw.fsf@maritornes.cs.unb.ca> +MIME-Version: 1.0 +Content-Type: text/plain +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 11:52:57 -0000 + +Gaute Hope writes: + +> +> I would expect to have the thread matching, I get nothing however. It +> does show up in: $ notmuch search tag:muted (muted added to excluded +> tags), but does notmuch search operate with +> notmuch_query_search_messages? +> + +I expanded your sample into a full program, and it seems to work ok for +me. Not sure what the difference might be. + +#include +#include +#include +int main(int argc, char **argv){ + + notmuch_database_t *nm_db; + notmuch_query_t *query; + notmuch_threads_t *threads; + notmuch_thread_t *thread; + + if (notmuch_database_open ("/home/bremner/Maildir/", + NOTMUCH_DATABASE_MODE_READ_ONLY, &nm_db)) + return 1; + + + + query = notmuch_query_create (nm_db, "tag:muted"); + notmuch_query_add_tag_exclude (query, "muted"); + notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_TRUE); + + for (threads = notmuch_query_search_threads (query); + notmuch_threads_valid (threads); + notmuch_threads_move_to_next (threads)) + { + thread = notmuch_threads_get (threads); + printf("%d\n", notmuch_thread_get_total_messages(thread)); + notmuch_thread_destroy (thread); + } + +} +