Re: Add support for `thread` field in `notmuch show`

2020-05-01 Thread Ciprian Dorin Craciun
On Fri, May 1, 2020 at 3:09 PM David Bremner  wrote:
> Ciprian Dorin Craciun  writes:
> > I know that one can use `thread:{id:MESSAGE_ID}` to achieve the same
> > result, however:
> > * it is somewhat cumbersome for the integrator;
>
> Out of curiousity, what is harder about it? In both cases you have to
> extra one value from the JSON.


It is cumbersome because:
* for once, now you need for each email to run a new `notmuch search`
instance to get that email's thread id;  this is very sub-optimal when
you have more than a handful emails;
* secondly, it adds more code to the client;

To understand my use-case:  I currently intend to use `notmuch show
--format=json` to search my emails, and based on that to generate a
nice HTML page, displaying all found emails.  Now I want to include in
each email's section a link to only display the thread.

In order to do that, I either have to generate (by usin the technique
described above) the `thread:...` for each of those emails, which in
turn generates one CLI call per email.  (And 99% of the time perhaps I
don't even click the thread.)  (Another option would be to use the
`thread:{id:...}` for that link, but I find this quite a hack.)



> > * having the thread identifier explicitly, could be used as a key in a
> > cache, or other internal lookups;
> >
> > In fact the only way one can extract the thread identifier via the
> > `notmuch` CLI is to use `notmuch search --output=threads --
> > id:MESSAGE_ID`
>
> Offhand I have no strong objection to someone (who is not me) adding
> this. I think it's important to be aware that thread id's are ephemeral,
> and subject to change e.g. if the database is re-built from
> scratch.

I understand that `thread:...` is tied to a particular database, but
that shouldn't be an issue, as people don't regenerate often their
databases, and the caches are usually short-lived.


This weekend I'll try to take a stab at adding this to `notmuch`.

Ciprian.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Add support for `thread` field in `notmuch show`

2020-05-01 Thread David Bremner
David Bremner  writes:

> Offhand I have no strong objection to someone (who is not me) adding
> this. I think it's important to be aware that thread id's are ephemeral,
> and subject to change e.g. if the database is re-built from
> scratch.

I guess a more common/interesting case is that two threads can merge if
new is indexed.

d

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Add support for `thread` field in `notmuch show`

2020-05-01 Thread David Bremner
Ciprian Dorin Craciun  writes:

> I know that one can use `thread:{id:MESSAGE_ID}` to achieve the same
> result, however:
> * it is somewhat cumbersome for the integrator;

Out of curiousity, what is harder about it? In both cases you have to
extra one value from the JSON.

> * having the thread identifier explicitly, could be used as a key in a
> cache, or other internal lookups;
>
> In fact the only way one can extract the thread identifier via the
> `notmuch` CLI is to use `notmuch search --output=threads --
> id:MESSAGE_ID`

Offhand I have no strong objection to someone (who is not me) adding
this. I think it's important to be aware that thread id's are ephemeral,
and subject to change e.g. if the database is re-built from
scratch.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Add support for `thread` field in `notmuch show`

2020-04-29 Thread Ciprian Dorin Craciun
According to the `devel/schemata` the message object doesn't contain
the thread identifier to which it was assigned in the database.

Sometimes, for example in an UI that displays a search result at
message level, it would be useful to know the thread each message
belongs to, so the user can easily switch to the entire thread.

I know that one can use `thread:{id:MESSAGE_ID}` to achieve the same
result, however:
* it is somewhat cumbersome for the integrator;
* having the thread identifier explicitly, could be used as a key in a
cache, or other internal lookups;

In fact the only way one can extract the thread identifier via the
`notmuch` CLI is to use `notmuch search --output=threads --
id:MESSAGE_ID`

Ciprian.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch