removed the useless keep_updated flag

This commit is contained in:
dockes 2009-11-10 17:32:13 +00:00
parent e9b5174867
commit 645af1aa55
2 changed files with 12 additions and 10 deletions

View File

@ -512,7 +512,7 @@ list<string> Db::getStemmerNames()
return res; return res;
} }
bool Db::open(OpenMode mode, bool keep_updated) bool Db::open(OpenMode mode)
{ {
if (m_ndb == 0 || m_config == 0) { if (m_ndb == 0 || m_config == 0) {
m_reason = "Null configuration or Xapian Db"; m_reason = "Null configuration or Xapian Db";
@ -547,12 +547,10 @@ bool Db::open(OpenMode mode, bool keep_updated)
m_ndb->xrdb = Xapian::Database(dir); m_ndb->xrdb = Xapian::Database(dir);
LOGDEB(("Db::open: lastdocid: %d\n", LOGDEB(("Db::open: lastdocid: %d\n",
m_ndb->xwdb.get_lastdocid())); m_ndb->xwdb.get_lastdocid()));
if (!keep_updated) { LOGDEB2(("Db::open: resetting updated\n"));
LOGDEB2(("Db::open: resetting updated\n")); updated.resize(m_ndb->xwdb.get_lastdocid() + 1);
updated.resize(m_ndb->xwdb.get_lastdocid() + 1); for (unsigned int i = 0; i < updated.size(); i++)
for (unsigned int i = 0; i < updated.size(); i++) updated[i] = false;
updated[i] = false;
}
} }
break; break;
case DbRO: case DbRO:
@ -640,10 +638,14 @@ bool Db::i_close(bool final)
// Reopen the db with a changed list of additional dbs // Reopen the db with a changed list of additional dbs
bool Db::adjustdbs() bool Db::adjustdbs()
{ {
if (m_mode != DbRO) {
LOGERR(("Db::adjustdbs: mode not RO\n"));
return false;
}
if (m_ndb && m_ndb->m_isopen) { if (m_ndb && m_ndb->m_isopen) {
if (!close()) if (!close())
return false; return false;
if (!open(m_mode, true)) { if (!open(m_mode)) {
return false; return false;
} }
} }

View File

@ -44,7 +44,7 @@ using std::vector;
// user interface. In other words, this is not exhaustive or well-designed or // user interface. In other words, this is not exhaustive or well-designed or
// reusable. // reusable.
// //
// Unique Document Identifier: unically identifies a document in its // Unique Document Identifier: uniquely identifies a document in its
// source storage (file system or other). Used for up to date checks // source storage (file system or other). Used for up to date checks
// etc. "udi". Our user is responsible for making sure it's not too // etc. "udi". Our user is responsible for making sure it's not too
// big, cause it's stored as a Xapian term (< 150 bytes would be // big, cause it's stored as a Xapian term (< 150 bytes would be
@ -86,7 +86,7 @@ class Db {
~Db(); ~Db();
enum OpenMode {DbRO, DbUpd, DbTrunc}; enum OpenMode {DbRO, DbUpd, DbTrunc};
bool open(OpenMode mode, bool keep_updated = false); bool open(OpenMode mode);
bool close(); bool close();
bool isopen(); bool isopen();