arrange so that a default first indexing run for a given user runs a quick shallow pass, so that queries return some results quickly after indexing starts, avoiding user frustration
This commit is contained in:
+19
-9
@@ -1266,20 +1266,30 @@ bool Db::maybeflush(off_t moretext)
|
||||
if ((m_curtxtsz - m_flushtxtsz) / MB >= m_flushMb) {
|
||||
LOGDEB(("Db::add/delete: txt size >= %d Mb, flushing\n",
|
||||
m_flushMb));
|
||||
string ermsg;
|
||||
try {
|
||||
m_ndb->xwdb.flush();
|
||||
} XCATCHERROR(ermsg);
|
||||
if (!ermsg.empty()) {
|
||||
LOGERR(("Db::add: flush() failed: %s\n", ermsg.c_str()));
|
||||
return false;
|
||||
}
|
||||
m_flushtxtsz = m_curtxtsz;
|
||||
return doFlush();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Db::doFlush()
|
||||
{
|
||||
if (!m_ndb) {
|
||||
LOGERR(("Db::doFLush: no ndb??\n"));
|
||||
return false;
|
||||
}
|
||||
string ermsg;
|
||||
try {
|
||||
m_ndb->xwdb.flush();
|
||||
} XCATCHERROR(ermsg);
|
||||
if (!ermsg.empty()) {
|
||||
LOGERR(("Db::doFlush: flush() failed: %s\n", ermsg.c_str()));
|
||||
return false;
|
||||
}
|
||||
m_flushtxtsz = m_curtxtsz;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Test if doc given by udi has changed since last indexed (test sigs)
|
||||
bool Db::needUpdate(const string &udi, const string& sig)
|
||||
{
|
||||
|
||||
@@ -377,6 +377,19 @@ class Db {
|
||||
*/
|
||||
static void setInPlaceReset() {o_inPlaceReset = true;}
|
||||
|
||||
/** Flush interval get/set. This is used by the first indexing
|
||||
pass to override the config value and flush more rapidly
|
||||
initially so that the user can quickly play with queries */
|
||||
int getFlushMb()
|
||||
{
|
||||
return m_flushMb;
|
||||
}
|
||||
void setFlushMb(int mb)
|
||||
{
|
||||
m_flushMb = mb;
|
||||
}
|
||||
bool doFlush();
|
||||
|
||||
/* This has to be public for access by embedded Query::Native */
|
||||
Native *m_ndb;
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user