Skip to content

Commit

Permalink
Patch lanceDB not deleting vectors from workspace (#655)
Browse files Browse the repository at this point in the history
patch lanceDB not deleting vectors from workspace
documentVectors self-sanitize on delete of parent document
  • Loading branch information
timothycarambat authored Jan 29, 2024
1 parent 9d41ff5 commit dfab14a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions server/models/documents.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ const Document = {
await prisma.workspace_documents.delete({
where: { id: document.id, workspaceId: workspace.id },
});
await prisma.document_vectors.deleteMany({
where: { docId: document.docId },
});
} catch (error) {
console.error(error.message);
}
Expand Down
2 changes: 1 addition & 1 deletion server/utils/vectorDbProviders/lance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ const LanceDb = {

vectors.push(vectorRecord);
submissions.push({
...vectorRecord.metadata,
id: vectorRecord.id,
vector: vectorRecord.values,
...vectorRecord.metadata,
});
documentVectors.push({ docId, vectorId: vectorRecord.id });
}
Expand Down

0 comments on commit dfab14a

Please sign in to comment.