]> git.cworth.org Git - obsolete/notmuch-old/commitdiff
lib: fix an exclude bug
authorMark Walters <markwalters1009@gmail.com>
Wed, 14 Mar 2012 12:26:54 +0000 (12:26 +0000)
committerDavid Bremner <bremner@debian.org>
Sun, 18 Mar 2012 12:14:23 +0000 (09:14 -0300)
When the exclude tags contain a tag that does not occur anywhere in
the Xapian database the exclusion fails. We modify the way the query
is constructed to `work around' this. (In fact the new code is cleaner
anyway.)

It also seems to fix another exclusion failure bug reported by
jrollins but we have not yet worked out why it helps in that case.

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);