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() bool BeagleQueueIndexer::index()
{ {
if (!m_db) if (!m_db)
@ -305,6 +316,7 @@ bool BeagleQueueIndexer::index()
// arrange to use a getCurrent() instead, would be more // arrange to use a getCurrent() instead, would be more
// efficient // efficient
indexFromCache(udi); indexFromCache(udi);
updstatus(udi);
} catch (CancelExcept) { } catch (CancelExcept) {
LOGERR(("BeagleQueueIndexer: interrupted\n")); LOGERR(("BeagleQueueIndexer: interrupted\n"));
return false; return false;
@ -448,8 +460,12 @@ BeagleQueueIndexer::processone(const string &path,
LOGERR(("BeagleQueueIndexer: interrupted\n")); LOGERR(("BeagleQueueIndexer: interrupted\n"));
goto out; goto out;
} }
if (fis != FileInterner::FIDone) { if (fis != FileInterner::FIDone && fis != FileInterner::FIAgain) {
LOGERR(("BeagleQueueIndexer: bad status from internfile\n")); 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; goto out;
} }
@ -486,7 +502,7 @@ BeagleQueueIndexer::processone(const string &path,
goto out; goto out;
} }
} }
updstatus(udi);
dounlink = true; dounlink = true;
out: out:
if (dounlink) { if (dounlink) {

View File

@ -77,6 +77,7 @@ private:
bool m_nocacheindex; bool m_nocacheindex;
bool indexFromCache(const string& udi); bool indexFromCache(const string& udi);
void updstatus(const string& udi);
}; };
#endif /* _beaglequeue_h_included_ */ #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 // Tell what we are doing and check for interrupt request
if (m_updater) { if (m_updater) {
++(m_updater->status.docsdone); ++(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; m_updater->status.fn = fn;
if (!ipath.empty()) if (!ipath.empty())
m_updater->status.fn += "|" + ipath; m_updater->status.fn += "|" + ipath;