diff --git a/libsearch/searchinterface/searchtasks/file-search-task.cpp b/libsearch/searchinterface/searchtasks/file-search-task.cpp index a332bb7..e8aa379 100644 --- a/libsearch/searchinterface/searchtasks/file-search-task.cpp +++ b/libsearch/searchinterface/searchtasks/file-search-task.cpp @@ -89,17 +89,17 @@ void FileSearchWorker::run() Xapian::Query FileSearchWorker::creatQueryForFileSearch() { 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()) { fileOrDir = Xapian::Query(Xapian::Query::OP_VALUE_RANGE, 1, "1", "1"); } else if (m_searchController->isSearchFileOnly()) { fileOrDir = Xapian::Query(Xapian::Query::OP_VALUE_RANGE, 1, "0", "0"); } - - } else { - //同时指定只搜索目录和只搜索文件。。。 - return {}; } std::vector queries; @@ -240,11 +240,7 @@ bool FileSearchFilter::operator ()(const Xapian::Document &doc) const return true; }); - bool inBlackList = std::any_of(parent->m_blackList.begin(), parent->m_blackList.end(), [&](QString &dir) { - return path.startsWith(dir); - }); - - return inSearchDir && !inBlackList; + return inSearchDir; } return true;