From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id E7157431FDE for ; Wed, 14 Mar 2012 05:27:06 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.201 X-Spam-Level: X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id n0QcI5qiqHeu for ; Wed, 14 Mar 2012 05:27:05 -0700 (PDT) Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id D6E4B431FD6 for ; Wed, 14 Mar 2012 05:27:02 -0700 (PDT) Received: by mail-we0-f181.google.com with SMTP id m13so1833650wer.26 for ; Wed, 14 Mar 2012 05:27:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=qGAcE0aauquirs3S+jhs4dMMEvWnZA6XIt7MKSZ4DpE=; b=OBBbx7AoE8MjI9rXc285vlSjkjAQy5DGsaciWPfl6PhdqCwXHiSmkqZx1Fh10LRtM+ n7Tj500/c+1eoDsby6uPdxb8DR/NHB5O9ZyjWK70irfzZmXvBKt1DMnRNHNtcPbaBMYv 8wvMEngidFSxaNICfyDlE2w1dIqA0/7B1T9BDHoc758gP92M78a9aVyIJZnpKAqUv0Bv CmVOsvcyLG9IsnM2WIcw+jEAivJWxfu6WVuTDy8ie2eLtKmDSi2unUZ7REONUuZCH3nG xNtQShLlgjNVsWlnS57ScZ4aAqLoItGei3R1QwPY66i53CMRFwAFXUPpNZUcP1PmH3ME nJwg== Received: by 10.180.14.230 with SMTP id s6mr5983517wic.2.1331728022526; Wed, 14 Mar 2012 05:27:02 -0700 (PDT) Received: from localhost (94-192-233-223.zone6.bethere.co.uk. [94.192.233.223]) by mx.google.com with ESMTPS id fi4sm11246234wib.4.2012.03.14.05.27.01 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 14 Mar 2012 05:27:01 -0700 (PDT) From: Mark Walters To: notmuch@notmuchmail.org Subject: [Patch v2 3/3] lib: fix an exclude bug Date: Wed, 14 Mar 2012 12:26:54 +0000 Message-Id: <1331728014-32698-4-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1331728014-32698-1-git-send-email-markwalters1009@gmail.com> References: <1331728014-32698-1-git-send-email-markwalters1009@gmail.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Mar 2012 12:27:07 -0000 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 | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/query.cc b/lib/query.cc index ab18fbc..2b73d72 100644 --- a/lib/query.cc +++ b/lib/query.cc @@ -213,13 +213,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); -- 1.7.9.1