slightly improve status reporting during indexing

This commit is contained in:
Jean-Francois Dockes 2010-05-04 17:49:40 +02:00
parent 623065f338
commit d0e56e361f
3 changed files with 21 additions and 2 deletions

View File

@ -270,6 +270,17 @@ bool BeagleQueueIndexer::indexFromCache(const string& udi)
}
}
void BeagleQueueIndexer::updstatus(const string& udi)
{
if (m_updater) {
++(m_updater->status.docsdone);
if (m_updater->status.dbtotdocs < m_updater->status.docsdone)
m_updater->status.dbtotdocs = m_updater->status.docsdone;
m_updater->status.fn = udi;
m_updater->update();
}
}
bool BeagleQueueIndexer::index()
{
if (!m_db)
@ -305,6 +316,7 @@ bool BeagleQueueIndexer::index()
// arrange to use a getCurrent() instead, would be more
// efficient
indexFromCache(udi);
updstatus(udi);
} catch (CancelExcept) {
LOGERR(("BeagleQueueIndexer: interrupted\n"));
return false;
@ -448,8 +460,12 @@ BeagleQueueIndexer::processone(const string &path,
LOGERR(("BeagleQueueIndexer: interrupted\n"));
goto out;
}
if (fis != FileInterner::FIDone) {
if (fis != FileInterner::FIDone && fis != FileInterner::FIAgain) {
LOGERR(("BeagleQueueIndexer: bad status from internfile\n"));
// TOBEDONE: internfile can return FIAgain here if it is
// paging a big text file, we should loop. Means we're
// only indexing the first page for text/plain files
// bigger than the page size (dlft: 1MB) for now.
goto out;
}
@ -486,7 +502,7 @@ BeagleQueueIndexer::processone(const string &path,
goto out;
}
}
updstatus(udi);
dounlink = true;
out:
if (dounlink) {

View File

@ -77,6 +77,7 @@ private:
bool m_nocacheindex;
bool indexFromCache(const string& udi);
void updstatus(const string& udi);
};
#endif /* _beaglequeue_h_included_ */

View File

@ -474,6 +474,8 @@ FsIndexer::processone(const std::string &fn, const struct stat *stp,
// Tell what we are doing and check for interrupt request
if (m_updater) {
++(m_updater->status.docsdone);
if (m_updater->status.dbtotdocs < m_updater->status.docsdone)
m_updater->status.dbtotdocs = m_updater->status.docsdone;
m_updater->status.fn = fn;
if (!ipath.empty())
m_updater->status.fn += "|" + ipath;