fix(ai-index):修复更新ai索引失败问题
This commit is contained in:
parent
fe0950c576
commit
5c7a4ec1f9
|
@ -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)
|
||||
|
|
|
@ -230,13 +230,11 @@ void IndexUpdater::updateAiIndex()
|
|||
return;
|
||||
}
|
||||
qDebug() << "| index:" <<file.path();
|
||||
if((indexer.*creat)(QJsonArray{
|
||||
if(!(indexer.*creat)(QJsonArray{
|
||||
QJsonObject{
|
||||
{QStringLiteral("filepath"), file.path()},
|
||||
{QStringLiteral("filetype"), type}
|
||||
}}))
|
||||
{
|
||||
} else {
|
||||
{QStringLiteral("fileformat"), type}
|
||||
}})){
|
||||
qWarning() << "Ai index failed for" << file.path();
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue