UNPKG

hnswsqlite

Version:

Vector search with HNSWlib and SQLite in TypeScript.

26 lines (25 loc) 894 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.deleteDocument = deleteDocument; exports.listDocuments = listDocuments; async function deleteDocument(store, id) { return store.deleteDocument(id); } async function listDocuments(store) { // This is a simplified implementation that gets all documents // In a real app, you'd want pagination for large datasets const results = []; // This is a workaround since we don't have a direct method to list all documents // In a real app, you'd add a method to VectorStore to get all documents const allIds = store['idMap']; for (const id of allIds) { const doc = await store['preparedStatements'].getDocument.get(id); if (doc) { results.push({ id: doc.id, text: doc.text }); } } return results; }