notmuch_query_add_tag_excluded and notmuch_query_search_threads
David Bremner
david at tethera.net
Sun Dec 7 03:52:43 PST 2014
Gaute Hope <eg at gaute.vetsj.com> 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 <notmuch.h>
#include <stdlib.h>
#include <stdio.h>
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);
}
}
More information about the notmuch
mailing list