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