bool Msg1c::reindexQuery ( char *query , collnum_t collnum , int32_t startNum , int32_t endNum , bool forceDel , int32_t langId, void *state , void (* callback) (void *state ) ) { m_collnum = collnum;// = coll; m_startNum = startNum; m_endNum = endNum; m_forceDel = forceDel; m_state = state; m_callback = callback; m_numDocIds = 0; m_numDocIdsAdded = 0; m_niceness = MAX_NICENESS; // langunknown? m_qq.set2 ( query , langId , true ); // sanity fix if ( endNum - startNum > MAXDOCIDSTOCOMPUTE ) endNum = startNum + MAXDOCIDSTOCOMPUTE; // reset again just in case m_req.reset(); // set our Msg39Request m_req.m_collnum = m_collnum; m_req.m_docsToGet = endNum; m_req.m_niceness = 0, m_req.m_getDocIdScoringInfo = false; m_req.m_doSiteClustering = false; m_req.m_doDupContentRemoval = false; m_req.ptr_query = m_qq.m_orig; m_req.size_query = m_qq.m_origLen+1; m_req.m_timeout = 86400*1000; // a whole day. todo: should we just go for infinite here? m_req.m_queryExpansion = true; // so it's like regular rslts // add language dropdown or take from [query reindex] link m_req.m_language = langId; //m_req.m_debug = 1; // log for now logf(LOG_DEBUG,"reindex: qlangid=%" PRId32" q=%s",langId,query); g_errno = 0; // . get the docIds // . this sets m_msg3a.m_clusterLevels[] for us if ( ! m_msg3a.getDocIds ( &m_req, NULL, &m_qq, this, gotDocIdListWrapper )) { return false; } // . this returns false if blocks, true otherwise // . sets g_errno on failure return gotList ( ); }
// . ***** META LIST ADD LOOP ***** // . add meta lists corresponding to the keys in m_addme[] // . call msg5 in case some got dumped to disk! // . never add zids out of order for the same sid // . returns false if blocked, sets g_errno on error and returns true bool Syncdb::loop2 ( ) { // sanity check if ( ! m_calledLoop1 ) { char *xx=NULL;*xx=0; } loop: // breathe just in case QUICKPOLL ( MAX_NICENESS ); // return if done! if ( m_ia >= m_na ) { m_calledLoop2 = true ; return true; } // . check the tree for the next key to add first!!! // . most of the time this should be the case! RdbTree *stree = &m_rdb.m_tree; // get the key key128_t k = m_addMe[m_ia]; // is it there? long n = stree->getNode ( 0 , (char *)&k ); // yes! easy add... if ( n >= 0 ) { //long reqSize = stree->getDataSize ( n ); char *req = stree->getData ( n ); // get zid from key uint64_t zid1 = getZid ( &k ); // get zid from request uint64_t zid2 = *(uint64_t *)(req+4); // must match! if ( zid1 != zid2 ) { char *xx=NULL;*xx=0; } // . add away using Msg4.cpp // . return with g_errno set on error if ( ! addMetaList ( req ) ) return true; // success, delete the key from QUICK TREE m_qt.deleteNode ( 0 , (char *)&k , true ); // . and delete that node (freeData = true) // . no! not until we got all the checkoff requests in! // stree->deleteNode ( n , true ); // advance on success m_ia++; // go back for more goto loop; } // make the key range key128_t sk = k; key128_t ek = k; // make negative sk.n0 &= 0xfffffffffffffffeLL; // do not let sleep ticker call bigLoop m_outstanding = true; // get the meta list from on disk i guess, if not in tree if ( ! m_msg5.getList ( RDB_SYNCDB , (collnum_t)0 , // coll &m_list , (char *)&sk , // startKey (char *)&ek , // endKey 999 , // minRecSizes true , // includeTree? false , // addToCache 0 , // maxCacheAge 0 , // startFielNum -1 , // numFiles NULL , // state gotListWrapper , MAX_NICENESS , true )) // do error correction? return false; // process it. loop back up for another on success! if ( gotList ( ) ) goto loop; // bad. g_errno must be set return false; }
void SieveJob::slotResult( KJob * job ) { Command lastCmd = mCommands.top(); // First, let's see if we come back from a SearchActive. If so, set // mFileExists to No if we didn't see the mUrl.fileName() during // listDir... if ( lastCmd == SearchActive && mFileExists == DontKnow && !job->error() ) mFileExists = No; // prepare for next round: mCommands.pop(); delete mDec; mDec = 0; if ( mSieveCapabilities.empty() ) { mSieveCapabilities = static_cast<KIO::Job*>(job)->queryMetaData( "sieveExtensions" ).split(' ', QString::SkipEmptyParts ); kDebug() << "Received Sieve extensions supported:\n" << mSieveCapabilities.join("\n"); } // check for errors: if ( job->error() ) { if ( static_cast<KIO::Job*>(job)->ui() ) { static_cast<KIO::Job*>(job)->ui()->setWindow( 0 ); static_cast<KIO::Job*>(job)->ui()->showErrorMessage(); } emit result( this, false, mScript, mUrl.fileName() == mActiveScriptName ); if ( lastCmd == List ) emit gotList( this, false, mAvailableScripts, mActiveScriptName ); else emit gotScript( this, false, mScript, mUrl.fileName() == mActiveScriptName ); mJob = 0; deleteLater(); return; } // check for new tasks: if ( !mCommands.empty() ) { // Don't fail getting a non-existent script: if ( mCommands.top() == Get && mFileExists == No ) { mScript.clear(); mCommands.pop(); } } if ( mCommands.empty() ) { // was last command; report success and delete this object: emit result( this, true, mScript, mUrl.fileName() == mActiveScriptName ); if ( lastCmd == List ) emit gotList( this, true, mAvailableScripts, mActiveScriptName ); else emit gotScript( this, true, mScript, mUrl.fileName() == mActiveScriptName ); mJob = 0; // deletes itself on returning from this slot deleteLater(); return; } else { // schedule the next command: schedule( mCommands.top() ); } }