fix delete broken documents
This commit is contained in:
@@ -137,14 +137,30 @@ final readonly class IngestFlow
|
||||
throw new \RuntimeException('Document not found.');
|
||||
}
|
||||
|
||||
// Chunks entfernen
|
||||
$this->chunkManager->compactByDocument($documentId);
|
||||
|
||||
$this->rebuildIndex(false);
|
||||
|
||||
// Dokument aus DB entfernen
|
||||
$this->em->remove($document);
|
||||
$this->em->flush();
|
||||
|
||||
// Prüfen, ob noch INDEXED-Versionen existieren
|
||||
$indexedCount = $this->em
|
||||
->getRepository(DocumentVersion::class)
|
||||
->count([
|
||||
'ingestStatus' => DocumentVersion::INGEST_INDEXED,
|
||||
]);
|
||||
|
||||
if ($indexedCount === 0) {
|
||||
// Kein Reindex notwendig
|
||||
return;
|
||||
}
|
||||
|
||||
// 4️⃣ Reindex nur wenn sinnvoll
|
||||
$this->rebuildIndex(false);
|
||||
}
|
||||
|
||||
|
||||
// =========================================================
|
||||
// CENTRAL REBUILD
|
||||
// =========================================================
|
||||
|
||||
Reference in New Issue
Block a user