[PATCH v2 01/11] lib: message: index message file sizes
David Bremner
david at tethera.net
Tue Jun 6 16:47:37 PDT 2017
Ioan-Adrian Ratiu <adi at adirat.com> writes:
> notmuch_status_t status;
> + unsigned long filesize;
> + char *filesize_str;
>
> status = _notmuch_message_file_get_mime_message (message_file,
> &mime_message);
> @@ -464,6 +466,14 @@ _notmuch_message_index_file (notmuch_message_t *message,
> subject = g_mime_message_get_subject (mime_message);
> _notmuch_message_gen_terms (message, "subject", subject);
>
> + filesize = _notmuch_message_file_get_size (message_file);
> + filesize_str = talloc_asprintf(NULL, "%lu", filesize);
> + if (! filesize_str)
> + return NOTMUCH_STATUS_OUT_OF_MEMORY;
> +
> + _notmuch_message_add_term (message, "filesize", filesize_str);
> + talloc_free (filesize_str);
I wanted to see what the performance impact of this commit was, but
unfortunately this breaks "notmuch new" (and most other things) as the
prefix "filesize" is not defined yet.
A handy way to see that this doesn't happen is to run
% git rebase -i --exec "make clean test" origin/master
before posting a series.
Another preliminary question is why are you adding both a prefixed term
and a value slot for file size? You can use the value slot to query.
d
More information about the notmuch
mailing list