diff --git a/libsearch/index/batch-indexer.cpp b/libsearch/index/batch-indexer.cpp index 60f8d08..d2d9bb9 100644 --- a/libsearch/index/batch-indexer.cpp +++ b/libsearch/index/batch-indexer.cpp @@ -200,7 +200,7 @@ void BatchIndexer::contentIndex() // bool ocrEnable = FileIndexerConfig::getInstance()->isOCREnable(); if(FileIndexerConfig::getInstance()->isOCREnable()) { qDebug() << "OCR enabled."; - suffixMap.insert(targetPhotographTypeMap); + suffixMap.INSERT(targetPhotographTypeMap); } if(m_mode == WorkMode::Rebuild) { contentDb.rebuild(); diff --git a/libsearch/index/compatible-define.h b/libsearch/index/compatible-define.h index 749643d..6b74515 100644 --- a/libsearch/index/compatible-define.h +++ b/libsearch/index/compatible-define.h @@ -19,13 +19,19 @@ */ #ifndef COMPATIBLEDEFINE_H #define COMPATIBLEDEFINE_H +#include #endif // COMPATIBLEDEFINE_H #if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) //T QAtomicInteger::load() const #define LOAD load() + +//QMap &QMap::unite(const QMap &other) +#define INSERT(T) unite(T) #endif #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) //T QAtomicInteger::loadRelaxed() const #define LOAD loadRelaxed() +//void QMap::insert(const QMap &map) +#define INSERT(T) insert(T) #endif diff --git a/libsearch/index/index-updater.cpp b/libsearch/index/index-updater.cpp index 69d8766..e8632ba 100644 --- a/libsearch/index/index-updater.cpp +++ b/libsearch/index/index-updater.cpp @@ -25,6 +25,7 @@ #include "file-content-indexer.h" #include "common.h" #include "file-utils.h" +#include "compatible-define.h" using namespace UkuiSearch; IndexUpdater::IndexUpdater(const QVector& files, QAtomicInt &stop) : m_cache(files), @@ -62,7 +63,7 @@ void IndexUpdater::UpdateIndex() qDebug() << "===finish update basic index==="; } if(FileIndexerConfig::getInstance()->isContentIndexEnable()) { - if(m_stop->loadRelaxed()) { + if(m_stop->LOAD) { qDebug() << "Index stopped, abort update content index."; return; } @@ -75,7 +76,7 @@ void IndexUpdater::UpdateIndex() QMap suffixMap = targetFileTypeMap; //ocr if(FileIndexerConfig::getInstance()->isOCREnable()) { - suffixMap.insert(targetPhotographTypeMap); + suffixMap.INSERT(targetPhotographTypeMap); } qDebug() << "===update content index==="; int size = 0; @@ -110,7 +111,7 @@ void IndexUpdater::UpdateIndex() qDebug() << "30 finished."; size = 0; } - if(m_stop->loadRelaxed()) { + if(m_stop->LOAD) { qDebug() << "Index stopped, content index update interrupted"; m_cache.clear(); m_cache.shrink_to_fit();