# HG changeset patch # User Timo Sirainen # Date 1312456419 -10800 # Node ID 216710c3736ee50c4f765701e69953b9788ce23a # Parent 7481ea45b95f0fc0674fe003c596694963ec08cb fts: force-resync now calls optimize on the backend. This mainly works with Lucene backend to recheck what messages actually exist. diff -r 7481ea45b95f -r 216710c3736e src/plugins/fts/fts-storage.c --- a/src/plugins/fts/fts-storage.c Thu Aug 04 14:12:56 2011 +0300 +++ b/src/plugins/fts/fts-storage.c Thu Aug 04 14:13:39 2011 +0300 @@ -413,13 +413,22 @@ { struct mailbox *box = ctx->box; struct fts_mailbox *fbox = FTS_CONTEXT(box); - bool precache; + struct fts_mailbox_list *flist = FTS_LIST_CONTEXT(box->list); + bool precache, force_resync; precache = (ctx->flags & MAILBOX_SYNC_FLAG_PRECACHE) != 0; + force_resync = (ctx->flags & MAILBOX_SYNC_FLAG_FORCE_RESYNC) != 0; if (fbox->module_ctx.super.sync_deinit(ctx, status_r) < 0) return -1; ctx = NULL; + if (force_resync) { + if (fts_backend_optimize(flist->backend) < 0) { + mail_storage_set_critical(box->storage, + "FTS optimize for mailbox %s failed", + box->vname); + } + } if (precache) { if (fts_update(box) < 0) { mail_storage_set_critical(box->storage,