From 50bee43617ab7cf02ae9f39683540d02d2a5acb3 Mon Sep 17 00:00:00 2001 From: hewenfei Date: Wed, 30 Mar 2022 14:46:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A4=E6=96=B7?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=B0=8D=E8=B1=A1=E7=9A=84=E9=82=8F=E8=BC=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../searchinterface/searchtasks/file-search-task.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libsearch/searchinterface/searchtasks/file-search-task.cpp b/libsearch/searchinterface/searchtasks/file-search-task.cpp index a332bb7..b91fd79 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; From 55858964aa1cc4d0550a21275edba4be0814f552 Mon Sep 17 00:00:00 2001 From: hewenfei Date: Mon, 25 Apr 2022 13:51:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=B4=A2=E5=BC=95=E6=90=9C=E7=B4=A2=E4=B8=8D=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E7=9A=84=E9=BB=91=E5=90=8D=E5=8D=95=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libsearch/searchinterface/searchtasks/file-search-task.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libsearch/searchinterface/searchtasks/file-search-task.cpp b/libsearch/searchinterface/searchtasks/file-search-task.cpp index b91fd79..e8aa379 100644 --- a/libsearch/searchinterface/searchtasks/file-search-task.cpp +++ b/libsearch/searchinterface/searchtasks/file-search-task.cpp @@ -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;