KMail - (Re-)Building the search index fails

Hi,
after some cleanups (removed the KMail Folders and did some folder structure changes on IMAP accounts) I just realized that I can’t search my EMails any more. It looks like the search index can’t be built/rebuilt…

I stopped KMail, restarted the akonadiserver and ran a

akonadictl fsck 
akonadictl vaccuum

more than once.
When starting the akonadiserver I realized this:

[...]
org.kde.pim.akonadi_indexer_agent: Database Corrupted - What did you do?
org.kde.pim.akonadi_indexer_agent: 
org.kde.pim.akonadiserver: Subscriber Akonadi::Server::NotificationSubscriber(0x7efc3804cb90) identified as "AgentBaseChangeRecorder - 94717869605248"
org.kde.pim.akonadi_search_pim: Failed to open database "/home/tomi/.local/share/akonadi/search_db/email/" : "Expected block 59161 to be level 2, not 0"
org.kde.pim.akonadiserver: DATABASE ERROR:
org.kde.pim.akonadiserver:   Error code: "1062"
org.kde.pim.akonadiserver:   DB error:  "Duplicate entry '30-INBOX' for key 'CollectionTable_parentAndNameIndex'"
org.kde.pim.akonadiserver:   Error text: "Duplicate entry '30-INBOX' for key 'CollectionTable_parentAndNameIndex' QMYSQL3: Unable to execute statement"
org.kde.pim.akonadiserver:   Values: QMap((":0", QVariant(QString, ".INBOX"))(":1", QVariant(QString, ""))(":10", QVariant(int, -1))(":11", QVariant(int, -1))(":12", QVariant(bool, false))(":13", QVariant(QString, ""))(":14", QVariant(bool, false))(":2", QVariant(QString, "INBOX"))(":3", QVariant(qlonglong, 30))(":4", QVariant(qlonglong, 9))(":5", QVariant(bool, true))(":6", QVariant(int, 2))(":7", QVariant(int, 2))(":8", QVariant(int, 2))(":9", QVariant(bool, true)))
org.kde.pim.akonadiserver:   Query: "INSERT INTO CollectionTable (remoteId, remoteRevision, name, parentId, resourceId, enabled, syncPref, displayPref, indexPref, cachePolicyInherit, cachePolicyCheckInterval, cachePolicyCacheTimeout, cachePolicySyncOnDemand, cachePolicyLocalParts, isVirtual) VALUES (:0, :1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14)"
org.kde.pim.akonadiserver: Error during insertion into table "CollectionTable" "Duplicate entry '30-INBOX' for key 'CollectionTable_parentAndNameIndex' QMYSQL3: Unable to execute statement"
org.kde.pim.akonadiserver: Failed to append Collection "INBOX" in resource "akonadi_imap_resource_3"
org.kde.pim.akonadiserver: Error while handling command CreateCollection on connection akonadi_imap_resource_3 (0x55823742f590)
org.kde.pim.akonadiserver: Handler exception when handling command FetchCollections on connection akonadi_imap_resource_3 (0x55823742f590) : Hierarchical RID does not specify an existing collection
org.kde.pim.imapresource: CollectionFetch for idling failed. error= 103 , errorString= "Hierarchical RID does not specify an existing collection"
[...]

In the akonadiconsole I can see that the “Akonadi Indexing Agent” is stuck at “Indexing collection: sent-mail (24%)”. I’m wondering what this ‘block 59161’ might be and how to narrow down the problem to its cause. (I suppose the “Duplicate Entry” error is unrelated, isn’t it?) Can you help me?
What can I do? How can I force the indexer agent to rebuild the email search index?

deleting /home/tomi/.local/share/akonadi/search_db/email/ before starting akonadiserver and then rebuilding the index folder by folder (I have quite a few…) from KMail, seems quite a bit unorthodox (ain’t it?).
I’m afraid I could break Akonadi/KMail so badly it can’t be recovered…
What do you think?

To answer this question myself, I did it. I stopped Akonadi, moved the email folder in ~/.local/share/akonadi/search_db out of place, and then started Akonadi again. It didn’t seem to do any harm, and the error is gone.