| 410 | } |
| 411 | |
| 412 | bool 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 | |
| 457 | bool WizSearcher::onSearchEnd() |
| 458 | { |
nothing calls this directly
no test coverage detected