simplify calls to update index status
This commit is contained in:
parent
f115dc695a
commit
73b6ebf300
@ -80,19 +80,14 @@ bool ConfIndexer::index(bool resetbefore, ixType typestorun)
|
||||
if (typestorun == IxTAll) {
|
||||
// Get rid of all database entries that don't exist in the
|
||||
// filesystem anymore. Only if all *configured* indexers ran.
|
||||
if (m_updater) {
|
||||
m_updater->status.fn.erase();
|
||||
m_updater->status.phase = DbIxStatus::DBIXS_PURGE;
|
||||
m_updater->update();
|
||||
}
|
||||
if (m_updater)
|
||||
m_updater->update(DbIxStatus::DBIXS_PURGE, string());
|
||||
m_db.purge();
|
||||
}
|
||||
|
||||
if (m_updater) {
|
||||
m_updater->status.phase = DbIxStatus::DBIXS_CLOSING;
|
||||
m_updater->status.fn.erase();
|
||||
m_updater->update();
|
||||
}
|
||||
if (m_updater)
|
||||
m_updater->update(DbIxStatus::DBIXS_CLOSING, string());
|
||||
|
||||
// The close would be done in our destructor, but we want status here
|
||||
if (!m_db.close()) {
|
||||
LOGERR(("ConfIndexer::index: error closing database in %s\n",
|
||||
@ -211,11 +206,8 @@ bool ConfIndexer::createStemmingDatabases()
|
||||
m_db.deleteStemDb(*it);
|
||||
}
|
||||
for (it = langs.begin(); it != langs.end(); it++) {
|
||||
if (m_updater) {
|
||||
m_updater->status.phase = DbIxStatus::DBIXS_STEMDB;
|
||||
m_updater->status.fn = *it;
|
||||
m_updater->update();
|
||||
}
|
||||
if (m_updater)
|
||||
m_updater->update(DbIxStatus::DBIXS_STEMDB, *it);
|
||||
m_db.createStemDb(*it);
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,12 +52,19 @@ class DbIxStatusUpdater {
|
||||
DbIxStatus status;
|
||||
virtual ~DbIxStatusUpdater(){}
|
||||
virtual bool update() = 0;
|
||||
virtual bool update(DbIxStatus::Phase phase, const string& fn)
|
||||
{
|
||||
status.phase = phase;
|
||||
status.fn = fn;
|
||||
return update();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The top level indexing object. Processes the configuration, then invokes
|
||||
* file system walking or other to populate/update the database(s).
|
||||
*/
|
||||
* The top level batch indexing object. Processes the configuration,
|
||||
* then invokes file system walking or other to populate/update the
|
||||
* database(s).
|
||||
*/
|
||||
class ConfIndexer {
|
||||
public:
|
||||
enum runStatus {IndexerOk, IndexerError};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user