]> git.notmuchmail.org Git - notmuch/blobdiff - lib/query.cc
lib: fix an exclude bug
[notmuch] / lib / query.cc
index 53d505a557ba83e81d6e8effd5641b23bbcfccec..68ac1e40178548f53dae91a263972eb210fdccf1 100644 (file)
@@ -219,13 +219,14 @@ notmuch_query_search_messages (notmuch_query_t *query)
 
        if (query->exclude_terms) {
            exclude_query = _notmuch_exclude_tags (query, final_query);
-           exclude_query = Xapian::Query (Xapian::Query::OP_AND,
-                                          exclude_query, final_query);
 
            if (query->omit_excluded_messages)
                final_query = Xapian::Query (Xapian::Query::OP_AND_NOT,
                                             final_query, exclude_query);
            else {
+               exclude_query = Xapian::Query (Xapian::Query::OP_AND,
+                                          exclude_query, final_query);
+
                enquire.set_weighting_scheme (Xapian::BoolWeight());
                enquire.set_query (exclude_query);