From 9466ea73219348b98576708155be9159d86dd44b Mon Sep 17 00:00:00 2001 From: iaom Date: Mon, 27 May 2024 16:35:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(index):=E4=BF=AE=E5=A4=8D=E5=8F=AA=E6=89=93?= =?UTF-8?q?=E5=BC=80AI=E7=B4=A2=E5=BC=95=E6=97=B6=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E9=99=A4AI=E7=B4=A2=E5=BC=95=E7=9B=AE=E5=BD=95=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libsearch/index/ai-indexer.cpp | 10 ++++++++-- libsearch/index/index-scheduler.cpp | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libsearch/index/ai-indexer.cpp b/libsearch/index/ai-indexer.cpp index cd6056a..a409c18 100644 --- a/libsearch/index/ai-indexer.cpp +++ b/libsearch/index/ai-indexer.cpp @@ -121,6 +121,7 @@ bool AiIndexer::addImageFileIndex(const QJsonArray &object) bool AiIndexer::deleteFileIndex(const QStringList &files) { if(!AiIndexerPrivate::m_sessionValid) { + qWarning() << "deleteFileIndex: Session is not valid"; return false; } QJsonArray tmpArray; @@ -130,8 +131,13 @@ bool AiIndexer::deleteFileIndex(const QStringList &files) oneFile.insert(QStringLiteral("filepath"), file); tmpArray.append(oneFile); } - - return data_management_delete_files(AiIndexerPrivate::m_session, QJsonDocument(tmpArray).toJson().data()) == DataManagementResult::DATA_MANAGEMENT_SUCCESS; + DataManagementResult result = data_management_delete_files(AiIndexerPrivate::m_session, QJsonDocument(tmpArray).toJson().data()); + if(result != DataManagementResult::DATA_MANAGEMENT_SUCCESS) { + qWarning() << "Fail to call data_management_delete_files, input: " << QJsonDocument(tmpArray).toJson().data() + << "result:" << result; + return false; + } + return true; } bool AiIndexer::getAllIndexedFiles(QJsonObject &object) diff --git a/libsearch/index/index-scheduler.cpp b/libsearch/index/index-scheduler.cpp index 5e8b483..5837e66 100644 --- a/libsearch/index/index-scheduler.cpp +++ b/libsearch/index/index-scheduler.cpp @@ -107,7 +107,7 @@ void IndexScheduler::addNewPath(const QString &folders, const QStringList &black void IndexScheduler::removeIndex(const QString &folders) { - if(m_indexStop.LOAD && m_contentIndexStop.LOAD && m_ocrContentIndexStop.LOAD) { + if(m_indexStop.LOAD && m_contentIndexStop.LOAD && m_ocrContentIndexStop.LOAD && m_aiIndexStop.LOAD) { qDebug() << "Index Scheduler is being stopped, remove operation will be executed when started up next time."; return; }