catch Xapian exception caused by bad stemming language. Check stemdb creation status and have recollindex exit in error if it failed
This commit is contained in:
parent
c0892d2327
commit
589c59f6a4
2 changed files with 40 additions and 36 deletions
|
@ -140,14 +140,17 @@ bool ConfIndexer::index(bool resetbefore, ixType typestorun, int flags)
|
||||||
|
|
||||||
if (m_updater && !m_updater->update(DbIxStatus::DBIXS_CLOSING, string()))
|
if (m_updater && !m_updater->update(DbIxStatus::DBIXS_CLOSING, string()))
|
||||||
return false;
|
return false;
|
||||||
createStemmingDatabases();
|
bool ret = true;
|
||||||
|
if (!createStemmingDatabases()) {
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
if (m_updater && !m_updater->update(DbIxStatus::DBIXS_CLOSING, string()))
|
if (m_updater && !m_updater->update(DbIxStatus::DBIXS_CLOSING, string()))
|
||||||
return false;
|
return false;
|
||||||
createAspellDict();
|
ret = ret && createAspellDict();
|
||||||
clearMimeHandlerCache();
|
clearMimeHandlerCache();
|
||||||
if (m_updater)
|
if (m_updater)
|
||||||
m_updater->update(DbIxStatus::DBIXS_DONE, string());
|
m_updater->update(DbIxStatus::DBIXS_DONE, string());
|
||||||
return true;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConfIndexer::indexFiles(list<string>& ifiles, int flag)
|
bool ConfIndexer::indexFiles(list<string>& ifiles, int flag)
|
||||||
|
@ -276,6 +279,7 @@ bool ConfIndexer::purgeFiles(std::list<string> &files, int flag)
|
||||||
bool ConfIndexer::createStemmingDatabases()
|
bool ConfIndexer::createStemmingDatabases()
|
||||||
{
|
{
|
||||||
string slangs;
|
string slangs;
|
||||||
|
bool ret = true;
|
||||||
if (m_config->getConfParam("indexstemminglanguages", slangs)) {
|
if (m_config->getConfParam("indexstemminglanguages", slangs)) {
|
||||||
if (!m_db.open(Rcl::Db::DbUpd)) {
|
if (!m_db.open(Rcl::Db::DbUpd)) {
|
||||||
LOGERR("ConfIndexer::createStemmingDb: could not open db\n" );
|
LOGERR("ConfIndexer::createStemmingDb: could not open db\n" );
|
||||||
|
@ -292,10 +296,10 @@ bool ConfIndexer::createStemmingDatabases()
|
||||||
if (find(langs.begin(), langs.end(), *it) == langs.end())
|
if (find(langs.begin(), langs.end(), *it) == langs.end())
|
||||||
m_db.deleteStemDb(*it);
|
m_db.deleteStemDb(*it);
|
||||||
}
|
}
|
||||||
m_db.createStemDbs(langs);
|
ret = ret && m_db.createStemDbs(langs);
|
||||||
}
|
}
|
||||||
m_db.close();
|
m_db.close();
|
||||||
return true;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConfIndexer::createStemDb(const string &lang)
|
bool ConfIndexer::createStemDb(const string &lang)
|
||||||
|
|
|
@ -53,6 +53,9 @@ bool createExpansionDbs(Xapian::WritableDatabase& wdb,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Walk the list of all terms, and stem/unac each.
|
||||||
|
string ermsg;
|
||||||
|
try {
|
||||||
// Stem dbs
|
// Stem dbs
|
||||||
vector<XapWritableComputableSynFamMember> stemdbs;
|
vector<XapWritableComputableSynFamMember> stemdbs;
|
||||||
// Note: tried to make this to work with stack-allocated objects, couldn't.
|
// Note: tried to make this to work with stack-allocated objects, couldn't.
|
||||||
|
@ -84,9 +87,6 @@ bool createExpansionDbs(Xapian::WritableDatabase& wdb,
|
||||||
if (!o_index_stripchars)
|
if (!o_index_stripchars)
|
||||||
diacasedb.recreate();
|
diacasedb.recreate();
|
||||||
|
|
||||||
// Walk the list of all terms, and stem/unac each.
|
|
||||||
string ermsg;
|
|
||||||
try {
|
|
||||||
Xapian::TermIterator it = wdb.allterms_begin();
|
Xapian::TermIterator it = wdb.allterms_begin();
|
||||||
// We'd want to skip to the first non-prefixed term, but this is a bit
|
// We'd want to skip to the first non-prefixed term, but this is a bit
|
||||||
// complicated, so we just jump over most of the prefixed term and then
|
// complicated, so we just jump over most of the prefixed term and then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue