fix document delete last document

This commit is contained in:
team 1
2026-02-18 09:26:08 +01:00
parent 64b263c5fe
commit b1e1fe082e
3 changed files with 37 additions and 5 deletions

View File

@@ -46,12 +46,35 @@ final class VectorIndexBuilder
{
$this->assertPreconditions();
// --------------------------------------------
// 🔵 FALL: NDJSON ist leer → kein Vector Index
// --------------------------------------------
if (filesize($this->indexNdjsonPath) === 0) {
// Alten Index entfernen
@unlink($this->vectorIndexPath);
@unlink($this->vectorMetaPath);
if ($logPath !== null) {
@file_put_contents(
$logPath,
"NDJSON empty → Vector index removed\n",
FILE_APPEND
);
}
return; // WICHTIG: kein Python, kein tmp, kein Fehler
}
// --------------------------------------------
// 🟢 FALL: NDJSON enthält Chunks
// --------------------------------------------
if (!is_file($this->indexMetaPath)) {
$this->initializeIndexMeta();
}
$indexMeta = $this->readIndexMeta();
$embeddingModel = $indexMeta['embedding_model'];
$tmpVectorIndexPath = $this->vectorIndexPath . '.tmp';