X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=lib%2Fnotmuch.h;h=673c4237ca4f98ba18183cf2c62ee4f0cd785f0d;hb=d6fbef4690968c8d0b8e9dc19a903e693cace316;hp=9f23a106e53b7acef19d1bf26036ed6993a361df;hpb=00c60fbcb3b2b7c9f90c36e4dfb9393fdf678735;p=obsolete%2Fnotmuch-old diff --git a/lib/notmuch.h b/lib/notmuch.h index 9f23a106..673c4237 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -449,6 +449,26 @@ typedef enum { const char * notmuch_query_get_query_string (notmuch_query_t *query); +/* Specify whether to omit excluded results or simply flag them. By + * default, this is set to TRUE. + * + * If this is TRUE, notmuch_query_search_messages will omit excluded + * messages from the results. notmuch_query_search_threads will omit + * threads that match only in excluded messages, but will include all + * messages in threads that match in at least one non-excluded + * message. + * + * The performance difference when calling + * notmuch_query_search_messages should be relatively small (and both + * should be very fast). However, in some cases, + * notmuch_query_search_threads is very much faster when omitting + * excluded messages as it does not need to construct the threads that + * only match in excluded messages. + */ + +void +notmuch_query_set_omit_excluded (notmuch_query_t *query, notmuch_bool_t omit_excluded); + /* Specify the sorting desired for this query. */ void notmuch_query_set_sort (notmuch_query_t *query, notmuch_sort_t sort); @@ -457,6 +477,12 @@ notmuch_query_set_sort (notmuch_query_t *query, notmuch_sort_t sort); notmuch_sort_t notmuch_query_get_sort (notmuch_query_t *query); +/* Add a tag that will be excluded from the query results by default. + * This exclusion will be overridden if this tag appears explicitly in + * the query. */ +void +notmuch_query_add_tag_exclude (notmuch_query_t *query, const char *tag); + /* Execute a query for threads, returning a notmuch_threads_t object * which can be used to iterate over the results. The returned threads * object is owned by the query and as such, will only be valid until @@ -659,8 +685,10 @@ notmuch_thread_get_toplevel_messages (notmuch_thread_t *thread); /* Get the number of messages in 'thread' that matched the search. * * This count includes only the messages in this thread that were - * matched by the search from which the thread was created. Contrast - * with notmuch_thread_get_total_messages() . + * matched by the search from which the thread was created and were + * not excluded by any exclude tags passed in with the query (see + * notmuch_query_add_tag_exclude). Contrast with + * notmuch_thread_get_total_messages() . */ int notmuch_thread_get_matched_messages (notmuch_thread_t *thread); @@ -889,7 +917,8 @@ notmuch_message_get_filenames (notmuch_message_t *message); /* Message flags */ typedef enum _notmuch_message_flag { - NOTMUCH_MESSAGE_FLAG_MATCH + NOTMUCH_MESSAGE_FLAG_MATCH, + NOTMUCH_MESSAGE_FLAG_EXCLUDED } notmuch_message_flag_t; /* Get a value of a flag for the email corresponding to 'message'. */