Re: [notmuch] [PATCH] Store the size of the file for each message
authorCarl Worth <cworth@cworth.org>
Fri, 18 Dec 2009 22:29:21 +0000 (14:29 +1600)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:35:54 +0000 (09:35 -0800)
94/34ea68e2d5c26df99c56dbeb1b1e04cce925f8 [new file with mode: 0644]

diff --git a/94/34ea68e2d5c26df99c56dbeb1b1e04cce925f8 b/94/34ea68e2d5c26df99c56dbeb1b1e04cce925f8
new file mode 100644 (file)
index 0000000..53d92a3
--- /dev/null
@@ -0,0 +1,96 @@
+Return-Path: <cworth@cworth.org>\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 E3ABB431FC0;\r
+       Fri, 18 Dec 2009 14:29:22 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\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 tZopULiqJp5p; Fri, 18 Dec 2009 14:29:22 -0800 (PST)\r
+Received: from yoom.home.cworth.org (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 078E6431FAE;\r
+       Fri, 18 Dec 2009 14:29:22 -0800 (PST)\r
+Received: by yoom.home.cworth.org (Postfix, from userid 1000)\r
+       id B46A3254306; Fri, 18 Dec 2009 14:29:21 -0800 (PST)\r
+From: Carl Worth <cworth@cworth.org>\r
+To: James Westby <jw+debian@jameswestby.net>, notmuch@notmuchmail.org\r
+In-Reply-To: <1261171263-29687-1-git-send-email-jw+debian@jameswestby.net>\r
+References: <87my1grrdi.fsf@jameswestby.net>\r
+       <1261171263-29687-1-git-send-email-jw+debian@jameswestby.net>\r
+Date: Fri, 18 Dec 2009 14:29:21 -0800\r
+Message-ID: <871virzzjy.fsf@yoom.home.cworth.org>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="=-=-=";\r
+       micalg=pgp-sha1; protocol="application/pgp-signature"\r
+Subject: Re: [notmuch] [PATCH] Store the size of the file for each message\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.12\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, 18 Dec 2009 22:29:23 -0000\r
+\r
+--=-=-=\r
+\r
+On Fri, 18 Dec 2009 21:21:03 +0000, James Westby <jw+debian@jameswestby.net> wrote:\r
+>   Here's the first part, storing the filesize. I'm using\r
+>   add_value so that we can make it sortable, is that valid\r
+>   for retrieving it as well?\r
+\r
+Yes, a value makes sense here and should make the value easy to\r
+retrieve.\r
+\r
+>   The only thing I'm not sure about is if it works. Is there\r
+>   a way to inspect a document to see the values that are\r
+>   stored?\r
+\r
+I usually use a little tool I wrote called xapian-dump. It currently\r
+exists only in the git history of notmuch. Look at commit:\r
+\r
+       22691064666c03c5e76bc787395bfe586929f4cc\r
+\r
+or so.\r
+\r
+> Doing a search isn't working, so I imagine I made a mistake.\r
+\r
+Let's see... (just reviewing here, not testing)..\r
+\r
+> +struct FilesizeValueRangeProcessor : public Xapian::ValueRangeProcessor {\r
+> +    FilesizeValueRangeProcessor() {}\r
+> +\r
+> +    Xapian::valueno operator()(std::string &begin, std::string &) {\r
+> +        if (begin.substr(0, 9) != "filesize:")\r
+> +            return Xapian::BAD_VALUENO;\r
+> +        begin.erase(0, 9);\r
+> +        return NOTMUCH_VALUE_FILESIZE;\r
+> +    }\r
+> +};\r
+\r
+If the file size is just an integer, then you shouldn't need a custom\r
+ValueRangeProcessor. One of the existing processors in Xapian should\r
+work fine.\r
+\r
+Having not ever written a custom processor, I can't say whether the one\r
+above is correct or not.\r
+\r
+-Carl\r
+\r
+--=-=-=\r
+Content-Type: application/pgp-signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.10 (GNU/Linux)\r
+\r
+iD8DBQFLLAJB6JDdNq8qSWgRAjcxAJ9M6oKCVctLVuZchZ6Sf+wrZrMyPwCaAl7y\r
+SOEkN9ksCt39zetus6rMQT0=\r
+=c+YE\r
+-----END PGP SIGNATURE-----\r
+--=-=-=--\r