Files
plainleaf/plugs/index/document.ts
T
Zef HemelandGitHub a524c64884 Go backend (#1555)
* Replaces old Deno server with a Go implementation
* Restructured the code base accordingly
2025-09-19 13:23:20 +02:00

14 lines
584 B
TypeScript

import { space, system } from "@silverbulletmd/silverbullet/syscalls";
import { indexObjects } from "./api.ts";
import type { DocumentMeta } from "../../plug-api/types/index.ts";
// Note: clearFileIndex is not called but since this is the only attachmet:index listener, this should be fine (famous last words)
export async function indexDocument(name: string) {
if (await system.getMode() === "ro") {
return;
}
// console.log("Indexing document", name);
const fileMeta = await space.getDocumentMeta(name);
await indexObjects<DocumentMeta>(fileMeta.name, [fileMeta]);
}