mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 20:08:10 +01:00
lib: change default for notmuch_query_set_omit_excluded
This commit is contained in:
parent
052000f85a
commit
d6fbef4690
2 changed files with 23 additions and 10 deletions
|
@ -449,12 +449,25 @@ typedef enum {
|
||||||
const char *
|
const char *
|
||||||
notmuch_query_get_query_string (notmuch_query_t *query);
|
notmuch_query_get_query_string (notmuch_query_t *query);
|
||||||
|
|
||||||
/* Specify whether to results should omit the excluded results rather
|
/* Specify whether to omit excluded results or simply flag them. By
|
||||||
* than just marking them excluded. This is useful for passing a
|
* default, this is set to TRUE.
|
||||||
* notmuch_messages_t not containing the excluded messages to other
|
*
|
||||||
* functions. */
|
* 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
|
void
|
||||||
notmuch_query_set_omit_excluded_messages (notmuch_query_t *query, notmuch_bool_t omit);
|
notmuch_query_set_omit_excluded (notmuch_query_t *query, notmuch_bool_t omit_excluded);
|
||||||
|
|
||||||
/* Specify the sorting desired for this query. */
|
/* Specify the sorting desired for this query. */
|
||||||
void
|
void
|
||||||
|
|
10
lib/query.cc
10
lib/query.cc
|
@ -28,7 +28,7 @@ struct _notmuch_query {
|
||||||
const char *query_string;
|
const char *query_string;
|
||||||
notmuch_sort_t sort;
|
notmuch_sort_t sort;
|
||||||
notmuch_string_list_t *exclude_terms;
|
notmuch_string_list_t *exclude_terms;
|
||||||
notmuch_bool_t omit_excluded_messages;
|
notmuch_bool_t omit_excluded;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _notmuch_mset_messages {
|
typedef struct _notmuch_mset_messages {
|
||||||
|
@ -92,7 +92,7 @@ notmuch_query_create (notmuch_database_t *notmuch,
|
||||||
|
|
||||||
query->exclude_terms = _notmuch_string_list_create (query);
|
query->exclude_terms = _notmuch_string_list_create (query);
|
||||||
|
|
||||||
query->omit_excluded_messages = FALSE;
|
query->omit_excluded = TRUE;
|
||||||
|
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
@ -104,9 +104,9 @@ notmuch_query_get_query_string (notmuch_query_t *query)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
notmuch_query_set_omit_excluded_messages (notmuch_query_t *query, notmuch_bool_t omit)
|
notmuch_query_set_omit_excluded (notmuch_query_t *query, notmuch_bool_t omit_excluded)
|
||||||
{
|
{
|
||||||
query->omit_excluded_messages = omit;
|
query->omit_excluded = omit_excluded;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -220,7 +220,7 @@ notmuch_query_search_messages (notmuch_query_t *query)
|
||||||
if (query->exclude_terms) {
|
if (query->exclude_terms) {
|
||||||
exclude_query = _notmuch_exclude_tags (query, final_query);
|
exclude_query = _notmuch_exclude_tags (query, final_query);
|
||||||
|
|
||||||
if (query->omit_excluded_messages)
|
if (query->omit_excluded)
|
||||||
final_query = Xapian::Query (Xapian::Query::OP_AND_NOT,
|
final_query = Xapian::Query (Xapian::Query::OP_AND_NOT,
|
||||||
final_query, exclude_query);
|
final_query, exclude_query);
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue