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