Write data version number at once into empty index. closes #8
This commit is contained in:
parent
61f3087efa
commit
b699bbe78f
@ -556,6 +556,11 @@ bool Db::open(OpenMode mode)
|
||||
int action = (mode == DbUpd) ? Xapian::DB_CREATE_OR_OPEN :
|
||||
Xapian::DB_CREATE_OR_OVERWRITE;
|
||||
m_ndb->xwdb = Xapian::WritableDatabase(dir, action);
|
||||
// If db is empty, write the data format version at once
|
||||
// to avoid stupid error messages:
|
||||
if (m_ndb->xwdb.get_doccount() == 0)
|
||||
m_ndb->xwdb.set_metadata(RCL_IDX_VERSION_KEY,
|
||||
RCL_IDX_VERSION);
|
||||
m_ndb->m_iswritable = true;
|
||||
// We open a readonly object in all cases (possibly in
|
||||
// addition to the r/w one) because some operations
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user