dovecot-2.0: fts-solr: Fixed handling indexing for multiple body...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Jun 23 00:41:59 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/776e2d96f6bb
changeset: 11616:776e2d96f6bb
user: Timo Sirainen <tss at iki.fi>
date: Tue Jun 22 22:41:55 2010 +0100
description:
fts-solr: Fixed handling indexing for multiple body parts.
diffstat:
src/plugins/fts-solr/fts-backend-solr.c | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)
diffs (63 lines):
diff -r 7ad62742116d -r 776e2d96f6bb src/plugins/fts-solr/fts-backend-solr.c
--- a/src/plugins/fts-solr/fts-backend-solr.c Tue Jun 22 22:27:10 2010 +0100
+++ b/src/plugins/fts-solr/fts-backend-solr.c Tue Jun 22 22:41:55 2010 +0100
@@ -29,6 +29,7 @@
uint32_t prev_uid, uid_validity;
string_t *cmd;
bool headers;
+ bool field_open;
};
struct solr_virtual_uid_map_context {
@@ -569,7 +570,11 @@
ctx->post = solr_connection_post_begin(solr_conn);
str_append(ctx->cmd, "<add>");
} else {
- str_append(ctx->cmd, "</field></doc>");
+ if (ctx->field_open) {
+ str_append(ctx->cmd, "</field>");
+ ctx->field_open = FALSE;
+ }
+ str_append(ctx->cmd, "</doc>");
}
ctx->prev_uid = uid;
ctx->headers = FALSE;
@@ -591,9 +596,15 @@
fts_backend_solr_uid_changed(ctx, uid);
else {
i_assert(!ctx->headers);
- str_append(ctx->cmd, "</field>");
+
+ if (ctx->field_open) {
+ str_append(ctx->cmd, "</field>");
+ ctx->field_open = FALSE;
+ }
}
+ i_assert(!ctx->field_open);
+ ctx->field_open = TRUE;
ctx->headers = TRUE;
str_append(ctx->cmd, "<field name=\"hdr\">");
}
@@ -616,6 +627,8 @@
i_assert(!ctx->headers);
}
+ i_assert(!ctx->field_open);
+ ctx->field_open = TRUE;
ctx->headers = FALSE;
str_append(ctx->cmd, "<field name=\"body\">");
return TRUE;
@@ -645,7 +658,11 @@
if (ctx->post == NULL)
return 0;
- str_append(ctx->cmd, "</field></doc>");
+ if (ctx->field_open) {
+ str_append(ctx->cmd, "</field>");
+ ctx->field_open = FALSE;
+ }
+ str_append(ctx->cmd, "</doc>");
/* Update the mailbox's last_uid field, replacing the existing
document. Note that since there is no locking, it's possible that
More information about the dovecot-cvs
mailing list