[PATCH] lib: add support for thread:<message-id> queries

Daniel Kahn Gillmor dkg at fifthhorseman.net
Tue Oct 17 11:33:00 PDT 2017


On Mon 2017-10-16 22:07:54 +0300, Jani Nikula wrote:
> Add support for querying threads using message-ids in addition to
> thread-ids. The main benefit is that thread queries via message-ids
> are portable across databases, re-indexing, and thread joining, while
> thread ids can be somewhat transient. A thread:<message-id> query can
> be shared between notmuch users, while a thread:<thread-id> query may
> cease to work after the regular delivery of a message that joins
> threads.
>
> What previously required:
>
> $ notmuch search $(notmuch search --output=threads id:<message-id>)
>
> can now be reduced to:
>
> $ notmuch search thread:<message-id>
>
> We limit the query to message-ids that have @ to optimize regular
> thread-id queries and to avoid collisions with thread-ids which are
> guaranteed (or which we can guarantee) to not contain @. This seems
> reasonable, as valid message-ids will have @.
>
> The performance penalty for regular thread-id queries seems to be
> neglible, and thread queries via message-ids seem to be about 10%
> slower than the direct thread-id query counterpart.

The rationale for this patch really good.  This is functionality we
should make available directly without the shell substitution
shenanigans described above, and i like the elegance of determining
whether it's a message-id or a thread id based on the presence of an '@'
symbol.

i have read the patch and it seems reasonable to me, though i'm not
particularly confident in my ability to catch any subtle bugs in logic
about manipulating Xapian.

I think we should adopt this proposal, though i welcome additional
review from people with more Xapian-fu than myself.

       --dkg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20171017/9836755c/attachment.sig>


More information about the notmuch mailing list