]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Generate snippet while saving new mails
authorJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Sun, 18 Feb 2018 23:07:16 +0000 (18:07 -0500)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 20 Feb 2018 08:21:12 +0000 (10:21 +0200)
src/lib-storage/index/index-mail-headers.c

index 7cec825e3fe6a77ea22b0df24f392e754cabe25a..7e3753f3e6d2ee65bdc5da98459f1fdcbe01fe9a 100644 (file)
@@ -386,6 +386,10 @@ index_mail_cache_parse_init(struct mail *_mail, struct istream *input)
        mail->data.save_sent_date = TRUE;
        mail->data.save_bodystructure_header = TRUE;
        mail->data.save_bodystructure_body = TRUE;
+       /* Don't unnecessarily waste time generating a snippet, since it's
+          not as cheap as the others to generate. */
+       if (index_mail_want_cache(mail, MAIL_CACHE_BODY_SNIPPET))
+               mail->data.save_body_snippet = TRUE;
 
        mail->data.tee_stream = tee_i_stream_create(input);
        input = tee_i_stream_create_child(mail->data.tee_stream);