unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Carl Worth <cworth@cworth.org>
To: Mike Kelly <pioto@pioto.org>, notmuch@notmuchmail.org
Subject: Re: About the json output and the number of results shown.
Date: Sat, 29 Jan 2011 06:44:40 +1000	[thread overview]
Message-ID: <87mxmkn4g7.fsf@yoom.home.cworth.org> (raw)
In-Reply-To: <1294871985-ner-781@everglades>

[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]

On Wed, 12 Jan 2011 22:39:45 +0000, Mike Kelly <pioto@pioto.org> 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:
> 
>     my $json = `notmuch show --format=json id:$message_id`;
>     my $parsed_json = decode_json($json);
>     my $message = $parsed_json->[0][0][0];

That does seem fairly awkward, yes. Do you have a suggestion for how
you'd like the output to be structured instead?

> 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.

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:

	notmuch search --format=json "string that matches nothing"

returns nothing. Presumably, this should return just an empty json array
instead, (that is, "[]")?

-Carl

-- 
carl.d.worth@intel.com

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2011-01-28 22:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-12 18:37 About the json output and the number of results shown Christophe-Marie Duquesne
2011-01-12 22:39 ` Mike Kelly
2011-01-28 20:44   ` Carl Worth [this message]
2011-01-29 15:59     ` Mike Kelly
2011-01-13 10:34 ` Sebastian Spaeth
2011-01-13 18:46   ` Christophe-Marie Duquesne
2011-01-14 13:48     ` Sebastian Spaeth
2011-01-28 20:27     ` Carl Worth
2011-01-28 20:40 ` Carl Worth
2011-02-13  6:29   ` Jeff Waugh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mxmkn4g7.fsf@yoom.home.cworth.org \
    --to=cworth@cworth.org \
    --cc=notmuch@notmuchmail.org \
    --cc=pioto@pioto.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).