fix(index):修复只打开AI索引时,删除AI索引目录失败的问题

This commit is contained in:
iaom 2024-05-27 16:35:27 +08:00 committed by Baijunjie
parent 1d0fd49e4b
commit 1101c7b807
2 changed files with 9 additions and 3 deletions

View File

@ -121,6 +121,7 @@ bool AiIndexer::addImageFileIndex(const QJsonArray &object)
bool AiIndexer::deleteFileIndex(const QStringList &files) bool AiIndexer::deleteFileIndex(const QStringList &files)
{ {
if(!AiIndexerPrivate::m_sessionValid) { if(!AiIndexerPrivate::m_sessionValid) {
qWarning() << "deleteFileIndex: Session is not valid";
return false; return false;
} }
QJsonArray tmpArray; QJsonArray tmpArray;
@ -130,8 +131,13 @@ bool AiIndexer::deleteFileIndex(const QStringList &files)
oneFile.insert(QStringLiteral("filepath"), file); oneFile.insert(QStringLiteral("filepath"), file);
tmpArray.append(oneFile); tmpArray.append(oneFile);
} }
DataManagementResult result = data_management_delete_files(AiIndexerPrivate::m_session, QJsonDocument(tmpArray).toJson().data());
return data_management_delete_files(AiIndexerPrivate::m_session, QJsonDocument(tmpArray).toJson().data()) == DataManagementResult::DATA_MANAGEMENT_SUCCESS; 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) bool AiIndexer::getAllIndexedFiles(QJsonObject &object)

View File

@ -107,7 +107,7 @@ void IndexScheduler::addNewPath(const QString &folders, const QStringList &black
void IndexScheduler::removeIndex(const QString &folders) 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."; qDebug() << "Index Scheduler is being stopped, remove operation will be executed when started up next time.";
return; return;
} }