Re: [PATCH 9/9] add has: query prefix to search for specific properties
[notmuch-archives.git] / 94 / 34ea68e2d5c26df99c56dbeb1b1e04cce925f8
1 Return-Path: <cworth@cworth.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id E3ABB431FC0;\r
6         Fri, 18 Dec 2009 14:29:22 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id tZopULiqJp5p; Fri, 18 Dec 2009 14:29:22 -0800 (PST)\r
11 Received: from yoom.home.cworth.org (localhost [127.0.0.1])\r
12         by olra.theworths.org (Postfix) with ESMTP id 078E6431FAE;\r
13         Fri, 18 Dec 2009 14:29:22 -0800 (PST)\r
14 Received: by yoom.home.cworth.org (Postfix, from userid 1000)\r
15         id B46A3254306; Fri, 18 Dec 2009 14:29:21 -0800 (PST)\r
16 From: Carl Worth <cworth@cworth.org>\r
17 To: James Westby <jw+debian@jameswestby.net>, notmuch@notmuchmail.org\r
18 In-Reply-To: <1261171263-29687-1-git-send-email-jw+debian@jameswestby.net>\r
19 References: <87my1grrdi.fsf@jameswestby.net>\r
20         <1261171263-29687-1-git-send-email-jw+debian@jameswestby.net>\r
21 Date: Fri, 18 Dec 2009 14:29:21 -0800\r
22 Message-ID: <871virzzjy.fsf@yoom.home.cworth.org>\r
23 MIME-Version: 1.0\r
24 Content-Type: multipart/signed; boundary="=-=-=";\r
25         micalg=pgp-sha1; protocol="application/pgp-signature"\r
26 Subject: Re: [notmuch] [PATCH] Store the size of the file for each message\r
27 X-BeenThere: notmuch@notmuchmail.org\r
28 X-Mailman-Version: 2.1.12\r
29 Precedence: list\r
30 List-Id: "Use and development of the notmuch mail system."\r
31         <notmuch.notmuchmail.org>\r
32 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
33         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
34 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
35 List-Post: <mailto:notmuch@notmuchmail.org>\r
36 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
37 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
38         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
39 X-List-Received-Date: Fri, 18 Dec 2009 22:29:23 -0000\r
40 \r
41 --=-=-=\r
42 \r
43 On Fri, 18 Dec 2009 21:21:03 +0000, James Westby <jw+debian@jameswestby.net> wrote:\r
44 >   Here's the first part, storing the filesize. I'm using\r
45 >   add_value so that we can make it sortable, is that valid\r
46 >   for retrieving it as well?\r
47 \r
48 Yes, a value makes sense here and should make the value easy to\r
49 retrieve.\r
50 \r
51 >   The only thing I'm not sure about is if it works. Is there\r
52 >   a way to inspect a document to see the values that are\r
53 >   stored?\r
54 \r
55 I usually use a little tool I wrote called xapian-dump. It currently\r
56 exists only in the git history of notmuch. Look at commit:\r
57 \r
58         22691064666c03c5e76bc787395bfe586929f4cc\r
59 \r
60 or so.\r
61 \r
62 > Doing a search isn't working, so I imagine I made a mistake.\r
63 \r
64 Let's see... (just reviewing here, not testing)..\r
65 \r
66 > +struct FilesizeValueRangeProcessor : public Xapian::ValueRangeProcessor {\r
67 > +    FilesizeValueRangeProcessor() {}\r
68 > +\r
69 > +    Xapian::valueno operator()(std::string &begin, std::string &) {\r
70 > +        if (begin.substr(0, 9) != "filesize:")\r
71 > +            return Xapian::BAD_VALUENO;\r
72 > +        begin.erase(0, 9);\r
73 > +        return NOTMUCH_VALUE_FILESIZE;\r
74 > +    }\r
75 > +};\r
76 \r
77 If the file size is just an integer, then you shouldn't need a custom\r
78 ValueRangeProcessor. One of the existing processors in Xapian should\r
79 work fine.\r
80 \r
81 Having not ever written a custom processor, I can't say whether the one\r
82 above is correct or not.\r
83 \r
84 -Carl\r
85 \r
86 --=-=-=\r
87 Content-Type: application/pgp-signature\r
88 \r
89 -----BEGIN PGP SIGNATURE-----\r
90 Version: GnuPG v1.4.10 (GNU/Linux)\r
91 \r
92 iD8DBQFLLAJB6JDdNq8qSWgRAjcxAJ9M6oKCVctLVuZchZ6Sf+wrZrMyPwCaAl7y\r
93 SOEkN9ksCt39zetus6rMQT0=\r
94 =c+YE\r
95 -----END PGP SIGNATURE-----\r
96 --=-=-=--\r