1 Return-Path: <chm.duquesne@gmail.com>
\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 4A8B442D2BA
\r
6 for <notmuch@notmuchmail.org>; Wed, 12 Jan 2011 10:37:45 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id rU-gHb6+ifwD for <notmuch@notmuchmail.org>;
\r
17 Wed, 12 Jan 2011 10:37:44 -0800 (PST)
\r
18 Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com
\r
20 by olra.theworths.org (Postfix) with ESMTP id 67F5842D2B1
\r
21 for <notmuch@notmuchmail.org>; Wed, 12 Jan 2011 10:37:44 -0800 (PST)
\r
22 Received: by wyf22 with SMTP id 22so907838wyf.26
\r
23 for <notmuch@notmuchmail.org>; Wed, 12 Jan 2011 10:37:42 -0800 (PST)
\r
24 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
25 h=domainkey-signature:mime-version:from:date:message-id:subject:to
\r
26 :content-type; bh=xlFdPLszRtZW/C2C2VYaoylLAFVeNGpv41toBTNzwVg=;
\r
27 b=BAYLl0izFsL5PoErUGfiJ3PtpGzn/2nUXjweJAI880SwlK4sg87l3jjF+4bO8W3Tcw
\r
28 Ub/FceO5Iht+BQHXGqw8anKt5P/pY0m3jaD13TdZP+oYHsqEi0hkDg5zuPSx/GqnPFA5
\r
29 uIXrI4PPEBPX5Hsoi89tD8Wd3vUYQL+PG2vhg=
\r
30 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
\r
31 h=mime-version:from:date:message-id:subject:to:content-type;
\r
32 b=drVYhvCuvMeByl5lyUd6D+WMOp9GxogGyzvAqBdKVIaRxTGvbDKQ51BNg5GNDQ4onc
\r
33 i5xpLL+At7NLq8iV76v3p0dAO5iaaA6qrFn29lGXTBQnE50cXoSKUrDmG+/whK8Ux0DR
\r
34 pZW4M9QbjG/k6+I+v43LnhoUKdVksaf6BuRRo=
\r
35 Received: by 10.227.146.195 with SMTP id i3mr1391952wbv.67.1294857461961; Wed,
\r
36 12 Jan 2011 10:37:41 -0800 (PST)
\r
38 Received: by 10.227.143.206 with HTTP; Wed, 12 Jan 2011 10:37:21 -0800 (PST)
\r
39 From: Christophe-Marie Duquesne <chm.duquesne@gmail.com>
\r
40 Date: Wed, 12 Jan 2011 19:37:21 +0100
\r
41 Message-ID: <AANLkTi=Mzu9bu3y0RKB5YZUpZOT9qujXgxtpB-8Bvk=2@mail.gmail.com>
\r
42 Subject: About the json output and the number of results shown.
\r
43 To: notmuch@notmuchmail.org
\r
44 Content-Type: text/plain; charset=UTF-8
\r
45 X-BeenThere: notmuch@notmuchmail.org
\r
46 X-Mailman-Version: 2.1.13
\r
48 List-Id: "Use and development of the notmuch mail system."
\r
49 <notmuch.notmuchmail.org>
\r
50 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
52 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
53 List-Post: <mailto:notmuch@notmuchmail.org>
\r
54 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
55 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
56 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
57 X-List-Received-Date: Wed, 12 Jan 2011 18:37:45 -0000
\r
61 The notmuch command line tool has an option that seems very
\r
62 interesting to me: --output=json
\r
64 In several languages, and especially in python, json is as easy to parse as:
\r
65 >>> res = json.load(stream)
\r
66 If your stream contains valid json, you then get all your data in res
\r
67 and you can immediately use it.
\r
69 With notmuch, some commands can bring a lot of results, and can take
\r
70 some time to return. That is why when I began to write a curse
\r
71 interface to notmuch, I added a mechanism to spawn these commands in
\r
72 background and gather the results asynchronously. Sadly, this makes me
\r
73 unable to use the built-in python json parser: As long as the output
\r
74 has not finished, the data on the stream is not valid json since it
\r
75 lacks at least the closing bracket '}'. As a consequence, I find
\r
76 easier not to use json and parse the data as it arrives.
\r
78 So I am wondering: what is the point of having a tool that is able to
\r
79 output json and ending in not using it? Is there a solution to make
\r
80 the json output more useable? One solution I've been thinking about
\r
81 would be to add an option: the range of results to show (something
\r
82 like --range=25:50). Is it doable easily? I mean: if results are not
\r
83 guaranteed to be in a given order, that would obviously be an issue.
\r
84 Same if finding the results 25:50 is exactly as long as finding the
\r
85 results 1:50. Otherwise, if it is doable, I guess this mail is a
\r
86 feature request. In any case, do you have any proposal for making
\r
87 sense of this json output without modifications in the notmuch CLI?
\r
90 Christophe-Marie Duquesne
\r