MCPcopy Create free account
hub / github.com/altairwei/WizNotePlus / onSearchProcess

Method onSearchProcess

src/share/WizSearch.cpp:412–455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410}
411
412bool WizSearcher::onSearchProcess(const std::string& lpszKbGUID,
413 const std::string& lpszDocumentID,
414 const std::string& lpszURL)
415{
416 Q_UNUSED(lpszURL);
417
418 if (m_nMaxResult != -1 && m_nMaxResult <= m_nResults) {
419 qDebug() << "\nSearch result is bigger than limits: " << m_nMaxResult;
420 return true;
421 }
422
423 QString strKbGUID = QString::fromStdString(lpszKbGUID);
424 QString strGUID = QString::fromStdString(lpszDocumentID);
425
426 // not searched before
427 if (m_mapDocumentSearched.contains(strGUID)) {
428 return true;
429 }
430
431 // make sure document is not belong to invalid group
432 if (!m_dbMgr.isOpened(strKbGUID)) {
433 qDebug() << "\nsearch process meet invalid kb_guid: " << strKbGUID;
434 return false;
435 }
436
437 // make sure document in the search scope
438 if (Scope_PersonalNotes == m_scope && strKbGUID != m_dbMgr.db().kbGUID()) {
439 return false;
440 } else if (Scope_GroupNotes == m_scope && strKbGUID == m_dbMgr.db().kbGUID()) {
441 return false;
442 }
443
444 // valid document
445 WIZDOCUMENTDATA doc;
446 if (!m_dbMgr.db(strKbGUID).documentFromGuid(strGUID, doc)) {
447 qDebug() << "\nsearch process meet invalide document: " << strGUID;
448 return false;
449 }
450
451 m_nResults++;
452 m_mapDocumentSearched[strGUID] = doc;
453
454 return true;
455}
456
457bool WizSearcher::onSearchEnd()
458{

Callers

nothing calls this directly

Calls 3

isOpenedMethod · 0.45
kbGUIDMethod · 0.45
documentFromGuidMethod · 0.45

Tested by

no test coverage detected