--- /dev/null
+Return-Path: <dkg@fifthhorseman.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id ADF3E6DE0B38\r
+ for <notmuch@notmuchmail.org>; Fri, 22 Jan 2016 09:02:43 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.013\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.013 tagged_above=-999 required=5\r
+ tests=[AWL=-0.013] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id W4AgVm5pY6tx for <notmuch@notmuchmail.org>;\r
+ Fri, 22 Jan 2016 09:02:38 -0800 (PST)\r
+Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 4C4F16DE0B2F\r
+ for <notmuch@notmuchmail.org>; Fri, 22 Jan 2016 09:02:38 -0800 (PST)\r
+Received: from fifthhorseman.net (unknown [38.109.115.130])\r
+ by che.mayfirst.org (Postfix) with ESMTPSA id 000A3F984;\r
+ Fri, 22 Jan 2016 12:02:35 -0500 (EST)\r
+Received: by fifthhorseman.net (Postfix, from userid 1000)\r
+ id 7376C20112; Fri, 22 Jan 2016 12:02:35 -0500 (EST)\r
+From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
+To: Antoine Amarilli <a3nm@a3nm.net>, notmuch@notmuchmail.org\r
+Subject: Re: Searching messages by size with notmuch\r
+In-Reply-To: <20160122151318.GA17099@mu.a3nm.net>\r
+References: <20160122151318.GA17099@mu.a3nm.net>\r
+User-Agent: Notmuch/0.21+67~g41ad7ff (http://notmuchmail.org) Emacs/24.5.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Fri, 22 Jan 2016 12:02:35 -0500\r
+Message-ID: <87twm5r1hw.fsf@alice.fifthhorseman.net>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/mixed; boundary="=-=-="\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://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: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 22 Jan 2016 17:02:43 -0000\r
+\r
+--=-=-=\r
+Content-Type: text/plain\r
+\r
+On Fri 2016-01-22 10:13:18 -0500, Antoine Amarilli wrote:\r
+\r
+> After chatting on #notmuch, I wanted to suggest a feature which would be\r
+> useful, at least to me: searching for messages by size.\r
+>\r
+> My use case would be to look for long messages, but dkg on IRC mentioned\r
+> that it could also be useful to clean up messages to save disk space.\r
+>\r
+> It is unclear whether the size of a message should be defined as that of\r
+> a single copy of the message, or that of all copies; and it is unclear\r
+> whether it should be the total size (for my purposes I would have been\r
+> interested in the size of the plaintext part of the message only).\r
+\r
+Note that "the plaintext part of the message" might mean the sum of\r
+multiple plaintext parts too -- consider this message as an example:\r
+\r
+\r
+--=-=-=\r
+Content-Type: image/png\r
+Content-Disposition: inline; filename=stock_smiley-7.png\r
+Content-Transfer-Encoding: base64\r
+\r
+iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\r
+AAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPB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vdL6+TLrn1YO\r
+LPUGW0LEJ4TTMLAKmAZmXnvW2BUbVtffUK/FZzaiENaMZJWhJFCLhOFazFC1Qpp7epmj7yD1EYcX\r
+K66bJzbN/ZED89kTO/cuPOREDgFHgTlg8YSw8cuqkLwswAl9YOkBV3yCR5Z7YwwYAUaSxE5snBm5\r
+eO1E9aKhip2OIjsWWzukxlRRdaLa8z50Uq9zR1vZ07sP9x7vZ24O6AKdUpZbfbnF/bFIPFkfOAFg\r
+qR8sz4toGUx8Qp7US7DKMuglI5SHnseUyUtFByfEt1+m9JIIy4+4TgfgJCBmWXjZFcDMMsWPP6I8\r
+XohkGYiuoOhy0VMpfkqAFUBOhGGZomaFayu9dAWRFa5xKsVPG+BlQJYDcYLSpwI48b2uNBFzmq//\r
+AxyL7Nqf76KTAAAAAElFTkSuQmCC\r
+--=-=-=\r
+Content-Type: text/plain\r
+\r
+\r
+Would you count the total of all related text/plain parts? or all\r
+text/* parts? or, if you have a multipart/alternative node in the MIME\r
+tree, would you report it as the maximum of any of the text/*\r
+alternatives? \r
+\r
+if you're really interested in textual analysis, then the "size of\r
+plaintext" might instead be better measured in words or paragraphs,\r
+rather than octets. Also, you might want to ignore quoted text and only\r
+measure non-quoted text (this is particularly relevant for\r
+conversations where people top-post and don't trim, or else you're\r
+actually measuring just how deep in the thread a given message is).\r
+\r
+I'm not trying to say that these metrics are impossible, just pointing\r
+out that the underlying data formats can be much more complicated than\r
+most people think about with mail. The decision about what to count and\r
+how to count it greatly effects the possible use cases.\r
+\r
+> Ideally I'd say that all of these could make sense.\r
+\r
+They could indeed, but I think we could motivate this much better as\r
+initial work by picking one particular use case, and implementing it.\r
+The work would be something like:\r
+\r
+ a) choose the metric we care about, and describe concretely how to\r
+ calculate it for a given rfc822 file.\r
+\r
+ b) assign and name a new notmuch_value_t to to identify the metric\r
+\r
+ c) update notmuch_database_add_message to insert that new value when a\r
+ file is added\r
+\r
+ d) consider what workflows are available to update the database for\r
+ already-indexed documents that do not have this value.\r
+ \r
+ e) resolve what to do about documents associated with multiple filenames\r
+\r
+ f) define how to include it in searches (this is probably a\r
+ NumberValueRangeProcessor, see\r
+ file:///usr/share/doc/xapian-doc/valueranges.html)\r
+\r
+ g) update documentation for notmuch cli tools.\r
+\r
+\r
+If you work through this process for one particular "message size" use\r
+case and document the steps, then we could presumably handle the other\r
+"message size" metrics in exactly the same way, modifying only steps (a)\r
+and (e) depending on the metric.\r
+\r
+> Would anyone else on the list be interested by such a feature?\r
+\r
+I'm definitely interested, but don't have a lot of time to work on it.\r
+\r
+ --dkg\r
+\r
+--=-=-=--\r