fix(ai-search):可以搜到黑名单中的文件.
This commit is contained in:
parent
77f0e52495
commit
3f9f78e82b
|
@ -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 <unistd.h>
|
||||
#include <QMessageBox>
|
||||
#include <QJsonObject>
|
||||
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue