aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorGravatar Mark Walters <markwalters1009@gmail.com>2012-03-14 12:26:54 +0000
committerGravatar David Bremner <bremner@debian.org>2012-03-18 09:14:23 -0300
commitc695534df5830d0681f451bd213e75758b532e31 (patch)
tree0c3aee2c22c76c88253296692802d33ff8a31e45 /lib
parent1351aafac1e8c77e6ee3d2f41ac7445d0e07238d (diff)
lib: fix an exclude bug
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/query.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/query.cc b/lib/query.cc
index 53d505a5..68ac1e40 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -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);