zeitgeist team mailing list archive
-
zeitgeist team
-
Mailing list archive
-
Message #05303
[Branch ~zeitgeist/zeitgeist/bluebird] Rev 451: FTS++: Re-index if database is corrupt
------------------------------------------------------------
revno: 451
committer: Siegfried-Angel Gevatter Pujals <siegfried@xxxxxxxxxxxx>
branch nick: bluebird
timestamp: Mon 2012-03-26 18:43:07 +0200
message:
FTS++: Re-index if database is corrupt
modified:
extensions/fts++/indexer.cpp
--
lp:zeitgeist
https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird
Your team Zeitgeist Framework Team is subscribed to branch lp:zeitgeist.
To unsubscribe from this branch go to https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird/+edit-subscription
=== modified file 'extensions/fts++/indexer.cpp'
--- extensions/fts++/indexer.cpp 2012-03-20 12:19:23 +0000
+++ extensions/fts++/indexer.cpp 2012-03-26 16:43:07 +0000
@@ -67,8 +67,25 @@
{
gchar *path = g_build_filename (zeitgeist_utils_get_data_path (),
FTS_MAIN_DIR.c_str (), NULL);
- this->db = new Xapian::WritableDatabase (path,
- Xapian::DB_CREATE_OR_OPEN);
+ try
+ {
+ this->db = new Xapian::WritableDatabase (path,
+ Xapian::DB_CREATE_OR_OPEN);
+ }
+ catch (const Xapian::DatabaseCorruptError &xp_error)
+ {
+ g_message ("Database is corrupt (%s). Overwriting...",
+ xp_error.get_msg ().c_str ());
+ this->db = new Xapian::WritableDatabase (path,
+ Xapian::DB_CREATE_OR_OVERWRITE);
+ }
+ catch (const Xapian::DatabaseOpeningError &xp_error)
+ {
+ g_message ("Database is corrupt (%s). Overwriting...",
+ xp_error.get_msg ().c_str ());
+ this->db = new Xapian::WritableDatabase (path,
+ Xapian::DB_CREATE_OR_OVERWRITE);
+ }
g_free (path);
}