From dc6df96e75f1286a657e03db81e9efe2601cfd5c Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Sat, 25 Oct 2014 08:40:16 +2000 Subject: [PATCH] Re: [PATCH v1 1/3] search: Seperately report matching and non-matching authors. --- c8/24fbc8a85599dfc1365f06fd2c8d11fbf6cfe3 | 95 +++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 c8/24fbc8a85599dfc1365f06fd2c8d11fbf6cfe3 diff --git a/c8/24fbc8a85599dfc1365f06fd2c8d11fbf6cfe3 b/c8/24fbc8a85599dfc1365f06fd2c8d11fbf6cfe3 new file mode 100644 index 000000000..b89af9479 --- /dev/null +++ b/c8/24fbc8a85599dfc1365f06fd2c8d11fbf6cfe3 @@ -0,0 +1,95 @@ +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 C002F431FC9 + for ; Fri, 24 Oct 2014 05:40:29 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -2.3 +X-Spam-Level: +X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_MED=-2.3] 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 wjv3750uwI7q for ; + Fri, 24 Oct 2014 05:40:22 -0700 (PDT) +Received: from outgoing.csail.mit.edu (outgoing.csail.mit.edu [128.30.2.149]) + by olra.theworths.org (Postfix) with ESMTP id 35D1D431FBD + for ; Fri, 24 Oct 2014 05:40:22 -0700 (PDT) +Received: from [104.131.20.129] (helo=awakeningjr) + by outgoing.csail.mit.edu with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) + (Exim 4.72) (envelope-from ) + id 1XheAD-0006Vv-LH; Fri, 24 Oct 2014 08:40:17 -0400 +Received: from amthrax by awakeningjr with local (Exim 4.84) + (envelope-from ) + id 1XheAD-0001RW-2X; Fri, 24 Oct 2014 08:40:17 -0400 +Date: Fri, 24 Oct 2014 08:40:16 -0400 +From: Austin Clements +To: David Edmondson +Subject: Re: [PATCH v1 1/3] search: Seperately report matching and + non-matching authors. +Message-ID: <20141024124016.GG7970@csail.mit.edu> +References: <1414140488-29978-1-git-send-email-dme@dme.org> + <1414140488-29978-2-git-send-email-dme@dme.org> + <87y4s5vn12.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <87y4s5vn12.fsf@qmul.ac.uk> +User-Agent: Mutt/1.5.23 (2014-03-12) +Cc: notmuch@notmuchmail.org +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, 24 Oct 2014 12:40:29 -0000 + +Quoth Mark Walters on Oct 24 at 10:23 am: +> +> Hi +> +> I definitely like the idea: some comments below. + +Agreed. + +> On Fri, 24 Oct 2014, David Edmondson wrote: +> > In addition to the :authors attribute of each search result, include +> > :authors_matched and :authors_non_matched attributes. Both attributes +> > are always included. If there are no non-matching authors, the +> > :authors_non_matched attribute is set to the empty string. +> +> What about having both authors_matched and authors_not_matched as lists +> of authors (ie one string for each author)? Then emacs, for example, +> wouldn't try and parse the string back into authors before +> splitting. And authors_non_matched could be an empty list when +> appropriate which seems more natural than the empty string. +> +> All the above is based on what a client might want in the output rather +> than what is easy or sensible to implement in the C code. + +I was going to suggest exactly the same thing. + +And I think there's a fairly easy way to do it in C code that will +also prevent library interface bloat: instead of introducing new +library APIs to get at this information, just use the existing +notmuch_thread_get_messages API and construct the matched and +non-matched lists in the CLI. Doing it in the CLI wouldn't require +the library to export yet another string list structure, which is +always a huge pain (thanks C!), and wouldn't introduce more "helper" +functions into the library API. + +I think the only disadvantage to doing this would be some duplication +of the {matched_,}authors_{array,hash} logic into the CLI, but those +are only there to support notmuch_thread_get_authors, which I think is +a huge hack and should go away in the long term. (And, by doing this +list building in the CLI, we avoid further embellishing the +unnecessary "get thread authors" API). -- 2.26.2