diff --git a/src/VERSION b/src/VERSION index ca8ec414..d8c40e53 100644 --- a/src/VERSION +++ b/src/VERSION @@ -1 +1 @@ -1.23.5 +1.23.6 diff --git a/src/rcldb/rcldb.cpp b/src/rcldb/rcldb.cpp index 5921dea0..4f35516c 100644 --- a/src/rcldb/rcldb.cpp +++ b/src/rcldb/rcldb.cpp @@ -18,6 +18,7 @@ #include #include +#include #include "safeunistd.h" #include #include @@ -792,7 +793,20 @@ bool Db::open(OpenMode mode, OpenError *error) { int action = (mode == DbUpd) ? Xapian::DB_CREATE_OR_OPEN : Xapian::DB_CREATE_OR_OVERWRITE; - m_ndb->xwdb = Xapian::WritableDatabase(dir, action); + if (::access(dir.c_str(), 0) != 0) { + // New index. use a stub to force using Chert + string stub = path_cat(m_config->getConfDir(), + "xapian.stub"); + FILE *fp = fopen(stub.c_str(), "w"); + if (nullptr == fp) { + throw(string("Can't create ") + stub); + } + fprintf(fp, "chert %s\n", dir.c_str()); + fclose(fp); + m_ndb->xwdb = Xapian::WritableDatabase(stub, action); + } else { + 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)