diff --git a/libsearch/aisearch/ai-search-plugin.cpp b/libsearch/aisearch/ai-search-plugin.cpp index 26889a1..a586b27 100644 --- a/libsearch/aisearch/ai-search-plugin.cpp +++ b/libsearch/aisearch/ai-search-plugin.cpp @@ -24,6 +24,8 @@ #include "thumbnail-creator.h" #include "file-indexer-config.h" #include "data-collecter.h" +#include "file-utils.h" +#include "dir-watcher.h" #include #include #include @@ -293,6 +295,20 @@ void AiSearch::keywordSearch() data_management_similarity_search(s_session, QJsonDocument(keyword).toJson().data(), &results); for (const auto &aResult : QJsonDocument::fromJson(results).array()) { if (aResult.isObject()) { + bool isBlocked(false); + QStringList blockList = DirWatcher::getDirWatcher()->getBlockDirsOfUser(); + QString filePath = aResult.toObject().value("filepath").toString(); + for (const auto& blockDir : blockList) { + if (FileUtils::isOrUnder(filePath, blockDir)) { + isBlocked = true; + break; + } + } + + if (isBlocked) { + continue; + } + SearchPluginIface::ResultInfo ri; if (createResultInfo(ri, aResult.toObject().value("filepath").toString())) { AiSearchPlugin::mutex.lock();