[Patch v2 3/3] lib: fix an exclude bug
authorMark Walters <markwalters1009@gmail.com>
Wed, 14 Mar 2012 12:26:54 +0000 (12:26 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:45:29 +0000 (09:45 -0800)
5c/241588b7ab1bd09e8ac50eab06ae9b82f36a7b [new file with mode: 0644]

diff --git a/5c/241588b7ab1bd09e8ac50eab06ae9b82f36a7b b/5c/241588b7ab1bd09e8ac50eab06ae9b82f36a7b
new file mode 100644 (file)
index 0000000..c9f93d4
--- /dev/null
@@ -0,0 +1,97 @@
+Return-Path: <markwalters1009@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id E7157431FDE\r
+       for <notmuch@notmuchmail.org>; Wed, 14 Mar 2012 05:27:06 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id n0QcI5qiqHeu for <notmuch@notmuchmail.org>;\r
+       Wed, 14 Mar 2012 05:27:05 -0700 (PDT)\r
+Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
+       [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id D6E4B431FD6\r
+       for <notmuch@notmuchmail.org>; Wed, 14 Mar 2012 05:27:02 -0700 (PDT)\r
+Received: by mail-we0-f181.google.com with SMTP id m13so1833650wer.26\r
+       for <notmuch@notmuchmail.org>; Wed, 14 Mar 2012 05:27:02 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+       bh=qGAcE0aauquirs3S+jhs4dMMEvWnZA6XIt7MKSZ4DpE=;\r
+       b=OBBbx7AoE8MjI9rXc285vlSjkjAQy5DGsaciWPfl6PhdqCwXHiSmkqZx1Fh10LRtM+\r
+       n7Tj500/c+1eoDsby6uPdxb8DR/NHB5O9ZyjWK70irfzZmXvBKt1DMnRNHNtcPbaBMYv\r
+       8wvMEngidFSxaNICfyDlE2w1dIqA0/7B1T9BDHoc758gP92M78a9aVyIJZnpKAqUv0Bv\r
+       CmVOsvcyLG9IsnM2WIcw+jEAivJWxfu6WVuTDy8ie2eLtKmDSi2unUZ7REONUuZCH3nG\r
+       xNtQShLlgjNVsWlnS57ScZ4aAqLoItGei3R1QwPY66i53CMRFwAFXUPpNZUcP1PmH3ME\r
+       nJwg==\r
+Received: by 10.180.14.230 with SMTP id s6mr5983517wic.2.1331728022526;\r
+       Wed, 14 Mar 2012 05:27:02 -0700 (PDT)\r
+Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
+ [94.192.233.223])     by mx.google.com with ESMTPS id\r
+ fi4sm11246234wib.4.2012.03.14.05.27.01        (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Wed, 14 Mar 2012 05:27:01 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [Patch v2 3/3] lib: fix an exclude bug\r
+Date: Wed, 14 Mar 2012 12:26:54 +0000\r
+Message-Id: <1331728014-32698-4-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1331728014-32698-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1331728014-32698-1-git-send-email-markwalters1009@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 14 Mar 2012 12:27:07 -0000\r
+\r
+When the exclude tags contain a tag that does not occur anywhere in\r
+the Xapian database the exclusion fails. We modify the way the query\r
+is constructed to `work around' this. (In fact the new code is cleaner\r
+anyway.)\r
+\r
+It also seems to fix another exclusion failure bug reported by\r
+jrollins but we have not yet worked out why it helps in that case.\r
+---\r
+ lib/query.cc |    5 +++--\r
+ 1 files changed, 3 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/lib/query.cc b/lib/query.cc\r
+index ab18fbc..2b73d72 100644\r
+--- a/lib/query.cc\r
++++ b/lib/query.cc\r
+@@ -213,13 +213,14 @@ notmuch_query_search_messages (notmuch_query_t *query)\r
+ \r
+       if (query->exclude_terms) {\r
+           exclude_query = _notmuch_exclude_tags (query, final_query);\r
+-          exclude_query = Xapian::Query (Xapian::Query::OP_AND,\r
+-                                         exclude_query, final_query);\r
+ \r
+           if (query->omit_excluded_messages)\r
+               final_query = Xapian::Query (Xapian::Query::OP_AND_NOT,\r
+                                            final_query, exclude_query);\r
+           else {\r
++              exclude_query = Xapian::Query (Xapian::Query::OP_AND,\r
++                                         exclude_query, final_query);\r
++\r
+               enquire.set_weighting_scheme (Xapian::BoolWeight());\r
+               enquire.set_query (exclude_query);\r
+ \r
+-- \r
+1.7.9.1\r
+\r