dovecot: Index message's all headers (including MIME headers) af...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Dec 3 15:06:30 EET 2007
details: http://hg.dovecot.org/dovecot/rev/9c3f0e180751
changeset: 6914:9c3f0e180751
user: Timo Sirainen <tss at iki.fi>
date: Mon Dec 03 15:06:27 2007 +0200
description:
Index message's all headers (including MIME headers) after the body.
diffstat:
2 files changed, 11 insertions(+), 9 deletions(-)
src/plugins/fts-squat/squat-trie.c | 4 ++--
src/plugins/fts/fts-storage.c | 16 +++++++++-------
diffs (66 lines):
diff -r f28a14a07a98 -r 9c3f0e180751 src/plugins/fts-squat/squat-trie.c
--- a/src/plugins/fts-squat/squat-trie.c Mon Dec 03 14:47:45 2007 +0200
+++ b/src/plugins/fts-squat/squat-trie.c Mon Dec 03 15:06:27 2007 +0200
@@ -788,7 +788,7 @@ int squat_trie_build_more(struct squat_t
bool multibyte_chars = FALSE;
int ret = 0;
- uid = uid * 2 + (type == SQUAT_INDEX_TYPE_HEADER ? 0 : 1);
+ uid = uid * 2 + (type == SQUAT_INDEX_TYPE_HEADER ? 1 : 0);
t_push();
char_lengths = t_malloc(size);
@@ -1394,7 +1394,7 @@ squat_trie_filter_type(enum squat_index_
}
/* we'll have to drop either header or body UIDs */
- mask = (type & SQUAT_INDEX_TYPE_HEADER) != 0 ? 0 : 1;
+ mask = (type & SQUAT_INDEX_TYPE_HEADER) != 0 ? 1 : 0;
for (i = 0; i < count; i++) {
for (uid = src_range[i].seq1; uid <= src_range[i].seq2; uid++) {
if ((uid & 1) == mask)
diff -r f28a14a07a98 -r 9c3f0e180751 src/plugins/fts/fts-storage.c
--- a/src/plugins/fts/fts-storage.c Mon Dec 03 14:47:45 2007 +0200
+++ b/src/plugins/fts/fts-storage.c Mon Dec 03 15:06:27 2007 +0200
@@ -67,14 +67,13 @@ static int fts_mailbox_close(struct mail
return ret;
}
-static int fts_build_mail_flush_headers(struct fts_storage_build_context *ctx,
- bool root)
+static int fts_build_mail_flush_headers(struct fts_storage_build_context *ctx)
{
if (str_len(ctx->headers) == 0)
return 0;
if (fts_backend_build_more(ctx->build, ctx->uid, str_data(ctx->headers),
- str_len(ctx->headers), root) < 0)
+ str_len(ctx->headers), TRUE) < 0)
return -1;
str_truncate(ctx->headers, 0);
@@ -144,10 +143,7 @@ static int fts_build_mail(struct fts_sto
fts_build_mail_header(ctx, &block);
else if (block.size == 0) {
/* end of headers */
- bool root = raw_block.part->parent == NULL;
- ret = fts_build_mail_flush_headers(ctx, root);
- if (ret < 0)
- break;
+ str_append_c(ctx->headers, '\n');
} else {
if (fts_backend_build_more(ctx->build, ctx->uid,
block.data, block.size,
@@ -159,6 +155,12 @@ static int fts_build_mail(struct fts_sto
}
(void)message_parser_deinit(&parser);
message_decoder_deinit(&decoder);
+
+ if (ret == 0) {
+ /* Index all headers at the end. This is required for Squat,
+ because it can handle only incremental UIDs. */
+ ret = fts_build_mail_flush_headers(ctx);
+ }
return ret;
}
More information about the dovecot-cvs
mailing list