Re: [PATCH v2 1/6] lib: change default for notmuch_query_set_omit_excluded
authorAustin Clements <amdragon@MIT.EDU>
Fri, 6 Apr 2012 01:09:40 +0000 (21:09 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:03 +0000 (09:46 -0800)
00/68ba06080e97b7ea52fd40f62d1d1eb85c3bef [new file with mode: 0644]

diff --git a/00/68ba06080e97b7ea52fd40f62d1d1eb85c3bef b/00/68ba06080e97b7ea52fd40f62d1d1eb85c3bef
new file mode 100644 (file)
index 0000000..f7cd613
--- /dev/null
@@ -0,0 +1,175 @@
+Return-Path: <amdragon@mit.edu>\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 4EB0F431FB6\r
+       for <notmuch@notmuchmail.org>; Thu,  5 Apr 2012 18:09:47 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[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 hNwaU9bFtzxw for <notmuch@notmuchmail.org>;\r
+       Thu,  5 Apr 2012 18:09:46 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU\r
+       [18.9.25.12])\r
+       by olra.theworths.org (Postfix) with ESMTP id 7F62A431FAE\r
+       for <notmuch@notmuchmail.org>; Thu,  5 Apr 2012 18:09:46 -0700 (PDT)\r
+X-AuditID: 1209190c-b7fad6d000000920-b7-4f7e42571a12\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+       by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id F6.1F.02336.7524E7F4; Thu,  5 Apr 2012 21:09:43 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q3619g7J032473; \r
+       Thu, 5 Apr 2012 21:09:43 -0400\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q3619eHI013233\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Thu, 5 Apr 2012 21:09:41 -0400 (EDT)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1SFxgK-0004Oq-JL; Thu, 05 Apr 2012 21:09:40 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2 1/6] lib: change default for\r
+       notmuch_query_set_omit_excluded\r
+In-Reply-To: <1333234442-28616-2-git-send-email-markwalters1009@gmail.com>\r
+References: <1333234442-28616-1-git-send-email-markwalters1009@gmail.com>\r
+       <1333234442-28616-2-git-send-email-markwalters1009@gmail.com>User-Agent:\r
+       Notmuch/0.11.1+358~g3b96caf (http://notmuchmail.org)\r
+       Emacs/23.3.1 (i486-pc-linux-gnu)\r
+Date: Thu, 05 Apr 2012 21:09:40 -0400\r
+Message-ID: <8762ddd5t7.fsf@awakening.csail.mit.edu>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFnrIIsWRmVeSWpSXmKPExsUixCmqrRvuVOdvcHiGuMXquTwW12/OZHZg\r
+       8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4MubPns5WcFymYtnGZ4wNjC3iXYycHBICJhIT\r
+       J85lh7DFJC7cW8/WxcjFISSwj1Hi65deZghnPaPE7pV7WSCcE0wS2y92skI4SxglVv2ayAzS\r
+       zyagIbFt/3JGEFtEwFXi6bfPYHFhgWCJjoaVQHEODk4BL4ntTwIhel8wSqzbcY4FpIZFQFXi\r
+       xMJHrCA2L9BNe+9vZoSwBSVOznwCVsMsoCVx499LpgmM/LOQpGYhSS1gZFrFKJuSW6Wbm5iZ\r
+       U5yarFucnJiXl1qka6iXm1mil5pSuokRHHqSPDsY3xxUOsQowMGoxMN7amutvxBrYllxZe4h\r
+       RkkOJiVRXjaHOn8hvqT8lMqMxOKM+KLSnNTiQ4wSHMxKIrxP+YFyvCmJlVWpRfkwKWkOFiVx\r
+       XhWtd35CAumJJanZqakFqUUwWRkODiUJ3reOQI2CRanpqRVpmTklCGkmDk6Q4TxAw++D1PAW\r
+       FyTmFmemQ+RPMepyPD/Ue4VRiCUvPy9VSpx3KUiRAEhRRmke3BxYynjFKA70ljDvKZAqHmC6\r
+       gZv0CmgJE9CSk1+rQZaUJCKkpBoYhe4ZrneNYp54yvlJvvRqY1ZLN6Z7IVrRvJJxK+Z8/HMm\r
+       Ikt0WftXrXtHtSSWTXib+MdaYdHTeAbNkJhDBxzuMP94vaRqwZyOd9M2xzuaNbp2HDNv8bZh\r
+       NPRc4rf3mWq38A2bE/oplWUVv+oDH9lLiAvdu+HRp5Hygkt/6fLWApYfP92SXvIpsRRnJBpq\r
+       MRcVJwIAQLnwy/QCAAA=\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: Fri, 06 Apr 2012 01:09:47 -0000\r
+\r
+On Sat, 31 Mar 2012, Mark Walters <markwalters1009@gmail.com> wrote:\r
+> ---\r
+>  lib/notmuch.h |   11 ++++++-----\r
+>  lib/query.cc  |   10 +++++-----\r
+>  2 files changed, 11 insertions(+), 10 deletions(-)\r
+>\r
+> diff --git a/lib/notmuch.h b/lib/notmuch.h\r
+> index babd208..029a2c3 100644\r
+> --- a/lib/notmuch.h\r
+> +++ b/lib/notmuch.h\r
+> @@ -449,12 +449,13 @@ 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 the excluded results or just flag\r
+> + * them. Note when calling notmuch_query_search_threads, the returned\r
+> + * thread will contain all messages regardless of this setting but,\r
+> + * unless this is unset, only threads matching in a non-excluded\r
+> + * message will be returned. */\r
+\r
+The docs seem a bit awkward (I suppose the interface is slightly\r
+awkward, but the comment makes it sound much more so) and I don't see a\r
+mention of the default behavior anywhere.  How about something like\r
+\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 are only partially excluded.\r
+\r
+It might be nice to mention the performance implications of the various\r
+options, too.\r
+\r
+>  void\r
+> -notmuch_query_set_omit_excluded_messages (notmuch_query_t *query, notmuch_bool_t omit);\r
+> +notmuch_query_set_omit_excluded_messages (notmuch_query_t *query, notmuch_bool_t omit_excluded);\r
+\r
+Should this be notmuch_query_set_omit_excluded?\r
+\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..f7c7099 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_messages (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
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r