解决全局搜索中遍历搜索不能搜索到顶层文件夹的问题
This commit is contained in:
parent
80320ab9f2
commit
37e3de3cee
|
@ -507,6 +507,7 @@ void DirectSearch::run() {
|
|||
if (!underBlock) {
|
||||
blockList.append(DirWatcher::getDirWatcher()->blackListOfDir(path));
|
||||
bfs.enqueue(path);
|
||||
match(QFileInfo(path));
|
||||
}
|
||||
}
|
||||
if (bfs.isEmpty()) {
|
||||
|
@ -540,34 +541,36 @@ void DirectSearch::run() {
|
|||
}
|
||||
bfs.enqueue(i.absoluteFilePath());
|
||||
}
|
||||
if(i.fileName().contains(m_keyword, Qt::CaseInsensitive)) {
|
||||
// qWarning() << i.fileName() << m_keyword;
|
||||
// if(m_searchResult->length() > 49)
|
||||
// return;
|
||||
if((i.isDir() && m_value == DIR_SEARCH_VALUE)) {
|
||||
SearchPluginIface::ResultInfo ri;
|
||||
if(SearchManager::creatResultInfo(ri,i.absoluteFilePath())) {
|
||||
SearchManager::m_mutexDir.lock();
|
||||
if(m_uniqueSymbol == SearchManager::uniqueSymbolDir) {
|
||||
m_searchResult->enqueue(ri);
|
||||
SearchManager::m_mutexDir.unlock();
|
||||
} else {
|
||||
SearchManager::m_mutexDir.unlock();
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (i.isFile() && m_value == FILE_SEARCH_VALUE) {
|
||||
SearchPluginIface::ResultInfo ri;
|
||||
if(SearchManager::creatResultInfo(ri,i.absoluteFilePath())) {
|
||||
SearchManager::m_mutexFile.lock();
|
||||
if(m_uniqueSymbol == SearchManager::uniqueSymbolFile) {
|
||||
m_searchResult->enqueue(ri);
|
||||
SearchManager::m_mutexFile.unlock();
|
||||
} else {
|
||||
SearchManager::m_mutexFile.unlock();
|
||||
return;
|
||||
}
|
||||
}
|
||||
match(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DirectSearch::match(const QFileInfo &info)
|
||||
{
|
||||
if(info.fileName().contains(m_keyword, Qt::CaseInsensitive)) {
|
||||
if((info.isDir() && m_value == DIR_SEARCH_VALUE)) {
|
||||
SearchPluginIface::ResultInfo ri;
|
||||
if(SearchManager::creatResultInfo(ri,info.absoluteFilePath())) {
|
||||
SearchManager::m_mutexDir.lock();
|
||||
if(m_uniqueSymbol == SearchManager::uniqueSymbolDir) {
|
||||
m_searchResult->enqueue(ri);
|
||||
SearchManager::m_mutexDir.unlock();
|
||||
} else {
|
||||
SearchManager::m_mutexDir.unlock();
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (info.isFile() && m_value == FILE_SEARCH_VALUE) {
|
||||
SearchPluginIface::ResultInfo ri;
|
||||
if(SearchManager::creatResultInfo(ri,info.absoluteFilePath())) {
|
||||
SearchManager::m_mutexFile.lock();
|
||||
if(m_uniqueSymbol == SearchManager::uniqueSymbolFile) {
|
||||
m_searchResult->enqueue(ri);
|
||||
SearchManager::m_mutexFile.unlock();
|
||||
} else {
|
||||
SearchManager::m_mutexFile.unlock();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,6 +161,7 @@ public:
|
|||
protected:
|
||||
void run();
|
||||
private:
|
||||
void match(const QFileInfo& info);
|
||||
QString m_keyword;
|
||||
DataQueue<SearchPluginIface::ResultInfo>* m_searchResult = nullptr;
|
||||
size_t m_uniqueSymbol;
|
||||
|
|
Loading…
Reference in New Issue