From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id C7CB1431FB6 for ; Sat, 29 Jan 2011 07:59:54 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] 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 bUIEijtXyKVk for ; Sat, 29 Jan 2011 07:59:54 -0800 (PST) Received: from everglades.pioto.org (mail.pioto.org [207.192.71.235]) by olra.theworths.org (Postfix) with ESMTP id E7F42431FB5 for ; Sat, 29 Jan 2011 07:59:53 -0800 (PST) Received: from aether (c-68-44-60-100.hsd1.nj.comcast.net [68.44.60.100]) (Authenticated sender: pioto) by everglades.pioto.org (Postfix) with ESMTPSA id BA0C1160644 for ; Sat, 29 Jan 2011 10:59:52 -0500 (EST) Date: Sat, 29 Jan 2011 10:59:45 -0500 From: Mike Kelly To: notmuch@notmuchmail.org Subject: Re: About the json output and the number of results shown. Message-ID: <20110129105945.17700652@aether> In-Reply-To: <87mxmkn4g7.fsf@yoom.home.cworth.org> References: <1294871985-ner-781@everglades> <87mxmkn4g7.fsf@yoom.home.cworth.org> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.22.1; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/YVvfyRZQKLLDtsblYT9WG/G"; protocol="application/pgp-signature" 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: Sat, 29 Jan 2011 15:59:55 -0000 --Sig_/YVvfyRZQKLLDtsblYT9WG/G Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sat, 29 Jan 2011 06:44:40 +1000 Carl Worth wrote: > On Wed, 12 Jan 2011 22:39:45 +0000, Mike Kelly > wrote: > > For starters, if I'm simply trying to retrieve a single message, the > > interface is rather awkard. I seem to need to do something like: > >=20 > > my $json =3D `notmuch show --format=3Djson id:$message_id`; > > my $parsed_json =3D decode_json($json); > > my $message =3D $parsed_json->[0][0][0]; >=20 > That does seem fairly awkward, yes. Do you have a suggestion for how > you'd like the output to be structured instead? Well, if I ask for a single message, I'd expect to just get a single message. So, $message =3D $parsed_json, without the extra single-entry arrays. > > And, when I'm doing my search earlier to even find those message > > ids, I need to do a check to `notmuch count` first to see if I'll > > even get any results, because the 0 result case is not valid JSON. >=20 > Yikes! That's a bug in notmuch that we should get fixed rather than > you just working around it. I just started adding a test for this > case. Currently: >=20 > notmuch search --format=3Djson "string that matches nothing" >=20 > returns nothing. Presumably, this should return just an empty json > array instead, (that is, "[]")? Yeah, should be "[]". Thanks. --=20 Mike Kelly --Sig_/YVvfyRZQKLLDtsblYT9WG/G Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) iEYEARECAAYFAk1EOXQACgkQokMzJ47YCzoNRgCfcwlZdwPNo7DgIxv4OMt0xHTW CagAn2196bRcBFN6BNvjfFqKCJd1KQua =HpoE -----END PGP SIGNATURE----- --Sig_/YVvfyRZQKLLDtsblYT9WG/G--