From 4d20ad9b94ae378f8eeff04b46dbc6a958a76478 Mon Sep 17 00:00:00 2001 From: iaom Date: Fri, 26 Apr 2024 09:02:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(ai-index):=E4=BF=AE=E5=A4=8D=E6=9B=B4?= =?UTF-8?q?=E6=96=B0ai=E7=B4=A2=E5=BC=95=E5=A4=B1=E8=B4=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libsearch/index/ai-indexer.cpp | 16 ++++++++++++++-- libsearch/index/index-updater.cpp | 8 +++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/libsearch/index/ai-indexer.cpp b/libsearch/index/ai-indexer.cpp index 17d156e..8abed40 100644 --- a/libsearch/index/ai-indexer.cpp +++ b/libsearch/index/ai-indexer.cpp @@ -95,7 +95,13 @@ bool AiIndexer::addTextFileIndex(const QJsonArray &object) if(!AiIndexerPrivate::m_sessionValid) { return false; } - return data_management_add_text_files(AiIndexerPrivate::m_session, QJsonDocument(object).toJson().data()) == DataManagementResult::DATA_MANAGEMENT_SUCCESS; + DataManagementResult result = data_management_add_text_files(AiIndexerPrivate::m_session, QJsonDocument(object).toJson().data()); + if(result != DataManagementResult::DATA_MANAGEMENT_SUCCESS) { + qWarning() << "Fail to call data_management_add_text_files, input: " << QJsonDocument(object).toJson().data() + << "result:" << result; + return false; + } + return true; } bool AiIndexer::addImageFileIndex(const QJsonArray &object) @@ -103,7 +109,13 @@ bool AiIndexer::addImageFileIndex(const QJsonArray &object) if(!AiIndexerPrivate::m_sessionValid) { return false; } - return data_management_add_image_files(AiIndexerPrivate::m_session, QJsonDocument(object).toJson().data()) == DataManagementResult::DATA_MANAGEMENT_SUCCESS; + DataManagementResult result = data_management_add_image_files(AiIndexerPrivate::m_session, QJsonDocument(object).toJson().data()); + if(result != DataManagementResult::DATA_MANAGEMENT_SUCCESS) { + qWarning() << "Fail to call data_management_add_image_files, input: " << QJsonDocument(object).toJson().data() + << "result:" << result; + return false; + } + return true; } bool AiIndexer::deleteFileIndex(const QStringList &files) diff --git a/libsearch/index/index-updater.cpp b/libsearch/index/index-updater.cpp index cc9f6a5..2b67257 100644 --- a/libsearch/index/index-updater.cpp +++ b/libsearch/index/index-updater.cpp @@ -230,13 +230,11 @@ void IndexUpdater::updateAiIndex() return; } qDebug() << "| index:" <