[PATCH v4 1/6] lib: change default for notmuch_query_set_omit_excluded
authorMark Walters <markwalters1009@gmail.com>
Sat, 7 Apr 2012 16:10:03 +0000 (17:10 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:06 +0000 (09:46 -0800)
d7/0b0901285478fbdc67d4fcf91f26681daabcb5 [new file with mode: 0644]

diff --git a/d7/0b0901285478fbdc67d4fcf91f26681daabcb5 b/d7/0b0901285478fbdc67d4fcf91f26681daabcb5
new file mode 100644 (file)
index 0000000..f5ab0e8
--- /dev/null
@@ -0,0 +1,150 @@
+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 6861D431FBF\r
+       for <notmuch@notmuchmail.org>; Sat,  7 Apr 2012 09:10:16 -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 A1viM1wKMB2W for <notmuch@notmuchmail.org>;\r
+       Sat,  7 Apr 2012 09:10:15 -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 32C87431FBC\r
+       for <notmuch@notmuchmail.org>; Sat,  7 Apr 2012 09:10:15 -0700 (PDT)\r
+Received: by mail-we0-f181.google.com with SMTP id m13so2289308wer.26\r
+       for <notmuch@notmuchmail.org>; Sat, 07 Apr 2012 09:10:14 -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=evWbal5TZwC83T81p5PIhFxgGHmqMjVz7PLu6Fut7js=;\r
+       b=U+25Ssu3CtfQ3zGdH4A6nQE6WgQRz9jl21RPj297uNSMD0i/dhnc63BQDs3PndYppJ\r
+       eBIsjmLZczEtd6QQmqNwfsFgVGynAHWT3/3fqwroHCbp+mcZEmX0hNreKn4kqGW6hnuv\r
+       EIyy7SMfEvEr8RgC73WL7L78UpGGnnNNQ2EftTetz1tNR+NFWUDM8QrP9U9lsR4+h7WF\r
+       21ZAoL8zNuuvCNv88B8cEkXC1zgw8DqPLfk28sUrnlIX0P5WdK10AJoea4l8V54Yrx8E\r
+       ZQEWx0zo862VyaMS1U333qi1cplRz9JkncVI8ojEfaMgVc7g/V8unkt48MoJC/kgPCvB\r
+       qLIQ==\r
+Received: by 10.180.82.132 with SMTP id i4mr4086924wiy.12.1333815014833;\r
+       Sat, 07 Apr 2012 09:10:14 -0700 (PDT)\r
+Received: from localhost (94.197.17.51.threembb.co.uk. [94.197.17.51])\r
+       by mx.google.com with ESMTPS id\r
+       bx13sm15630097wib.10.2012.04.07.09.10.12\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Sat, 07 Apr 2012 09:10:14 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v4 1/6] lib: change default for\r
+ notmuch_query_set_omit_excluded\r
+Date: Sat,  7 Apr 2012 17:10:03 +0100\r
+Message-Id: <1333815008-24668-2-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1333815008-24668-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1333815008-24668-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: Sat, 07 Apr 2012 16:10:16 -0000\r
+\r
+---\r
+ lib/notmuch.h |   23 ++++++++++++++++++-----\r
+ lib/query.cc  |   10 +++++-----\r
+ 2 files changed, 23 insertions(+), 10 deletions(-)\r
+\r
+diff --git a/lib/notmuch.h b/lib/notmuch.h\r
+index babd208..673c423 100644\r
+--- a/lib/notmuch.h\r
++++ b/lib/notmuch.h\r
+@@ -449,12 +449,25 @@ typedef enum {\r
+ const char *\r
+ notmuch_query_get_query_string (notmuch_query_t *query);\r
+ \r
+-/* Specify whether to results should omit the excluded results rather\r
+- * than just marking them excluded. This is useful for passing a\r
+- * notmuch_messages_t not containing the excluded messages to other\r
+- * functions. */\r
++/* Specify whether to omit excluded results or simply flag them.  By\r
++ * default, this is set to TRUE.\r
++ *\r
++ * If this is TRUE, notmuch_query_search_messages will omit excluded\r
++ * messages from the results.  notmuch_query_search_threads will omit\r
++ * threads that match only in excluded messages, but will include all\r
++ * messages in threads that match in at least one non-excluded\r
++ * message.\r
++ *\r
++ * The performance difference when calling\r
++ * notmuch_query_search_messages should be relatively small (and both\r
++ * should be very fast).  However, in some cases,\r
++ * notmuch_query_search_threads is very much faster when omitting\r
++ * excluded messages as it does not need to construct the threads that\r
++ * only match in excluded messages.\r
++ */\r
++\r
+ void\r
+-notmuch_query_set_omit_excluded_messages (notmuch_query_t *query, notmuch_bool_t omit);\r
++notmuch_query_set_omit_excluded (notmuch_query_t *query, notmuch_bool_t omit_excluded);\r
+ \r
+ /* Specify the sorting desired for this query. */\r
+ void\r
+diff --git a/lib/query.cc b/lib/query.cc\r
+index 68ac1e4..e9c1a2d 100644\r
+--- a/lib/query.cc\r
++++ b/lib/query.cc\r
+@@ -28,7 +28,7 @@ struct _notmuch_query {\r
+     const char *query_string;\r
+     notmuch_sort_t sort;\r
+     notmuch_string_list_t *exclude_terms;\r
+-    notmuch_bool_t omit_excluded_messages;\r
++    notmuch_bool_t omit_excluded;\r
+ };\r
+ \r
+ typedef struct _notmuch_mset_messages {\r
+@@ -92,7 +92,7 @@ notmuch_query_create (notmuch_database_t *notmuch,\r
+ \r
+     query->exclude_terms = _notmuch_string_list_create (query);\r
+ \r
+-    query->omit_excluded_messages = FALSE;\r
++    query->omit_excluded = TRUE;\r
+ \r
+     return query;\r
+ }\r
+@@ -104,9 +104,9 @@ notmuch_query_get_query_string (notmuch_query_t *query)\r
+ }\r
+ \r
+ void\r
+-notmuch_query_set_omit_excluded_messages (notmuch_query_t *query, notmuch_bool_t omit)\r
++notmuch_query_set_omit_excluded (notmuch_query_t *query, notmuch_bool_t omit_excluded)\r
+ {\r
+-    query->omit_excluded_messages = omit;\r
++    query->omit_excluded = omit_excluded;\r
+ }\r
+ \r
+ void\r
+@@ -220,7 +220,7 @@ notmuch_query_search_messages (notmuch_query_t *query)\r
+       if (query->exclude_terms) {\r
+           exclude_query = _notmuch_exclude_tags (query, final_query);\r
+ \r
+-          if (query->omit_excluded_messages)\r
++          if (query->omit_excluded)\r
+               final_query = Xapian::Query (Xapian::Query::OP_AND_NOT,\r
+                                            final_query, exclude_query);\r
+           else {\r
+-- \r
+1.7.9.1\r
+\r