Merge branch 'ukss-dev' into 'ukss-dev'
去掉不需要的黑名单判断代码 See merge request kylin-desktop/ukui-search!297
This commit is contained in:
commit
8ada095f21
|
@ -89,17 +89,17 @@ void FileSearchWorker::run()
|
||||||
|
|
||||||
Xapian::Query FileSearchWorker::creatQueryForFileSearch() {
|
Xapian::Query FileSearchWorker::creatQueryForFileSearch() {
|
||||||
Xapian::Query fileOrDir = Xapian::Query::MatchAll;
|
Xapian::Query fileOrDir = Xapian::Query::MatchAll;
|
||||||
if (!m_searchController->isSearchDirOnly() || !m_searchController->isSearchFileOnly()) {
|
if (m_searchController->isSearchDirOnly() && m_searchController->isSearchFileOnly()) {
|
||||||
|
//同时指定'只搜索目录'和'只搜索文件',那麼拒絕搜索
|
||||||
|
return {};
|
||||||
|
|
||||||
|
} else {
|
||||||
if (m_searchController->isSearchDirOnly()) {
|
if (m_searchController->isSearchDirOnly()) {
|
||||||
fileOrDir = Xapian::Query(Xapian::Query::OP_VALUE_RANGE, 1, "1", "1");
|
fileOrDir = Xapian::Query(Xapian::Query::OP_VALUE_RANGE, 1, "1", "1");
|
||||||
|
|
||||||
} else if (m_searchController->isSearchFileOnly()) {
|
} else if (m_searchController->isSearchFileOnly()) {
|
||||||
fileOrDir = Xapian::Query(Xapian::Query::OP_VALUE_RANGE, 1, "0", "0");
|
fileOrDir = Xapian::Query(Xapian::Query::OP_VALUE_RANGE, 1, "0", "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
//同时指定只搜索目录和只搜索文件。。。
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Xapian::Query> queries;
|
std::vector<Xapian::Query> queries;
|
||||||
|
@ -240,11 +240,7 @@ bool FileSearchFilter::operator ()(const Xapian::Document &doc) const
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
bool inBlackList = std::any_of(parent->m_blackList.begin(), parent->m_blackList.end(), [&](QString &dir) {
|
return inSearchDir;
|
||||||
return path.startsWith(dir);
|
|
||||||
});
|
|
||||||
|
|
||||||
return inSearchDir && !inBlackList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue