Skip to main content

KnowledgeStore

@forge/monorepo


@forge/monorepo / backend/src / KnowledgeStore

Interface: KnowledgeStore

Defined in: backend/src/persistence/index.ts:1395

Methods

deleteSource()

deleteSource(input): Promise<{ removed: number; }>

Defined in: backend/src/persistence/index.ts:1419

Removes a source's chunks. For a deleted document: its content must stop being searchable.

Parameters

input

TenantScope & object

Returns

Promise<{ removed: number; }>


get()

get(input): Promise<KnowledgeChunk | null>

Defined in: backend/src/persistence/index.ts:1416

Parameters

input

TenantScope & object

Returns

Promise<KnowledgeChunk | null>


listBySource()

listBySource(input): Promise<Page<KnowledgeChunk>>

Defined in: backend/src/persistence/index.ts:1412

A source's chunks in order, for reading around a hit or for re-indexing.

Parameters

input

TenantScope & PageRequest & object

Returns

Promise<Page<KnowledgeChunk>>


listStaleSources()

listStaleSources(input): Promise<Page<{ chunkCount: number; sourceId: string; sourceType: "file" | "artifact" | "message" | "external"; }>>

Defined in: backend/src/persistence/index.ts:1429

Sources whose chunks were embedded by anything other than current — AC-5.

The whole basis of incremental re-indexing: the work list is derived from what is stored, so an interrupted re-index resumes by asking again rather than by remembering where it was.

Parameters

input

TenantScope & PageRequest & object

Returns

Promise<Page<{ chunkCount: number; sourceId: string; sourceType: "file" | "artifact" | "message" | "external"; }>>


replaceSource()

replaceSource(input): Promise<{ removed: number; written: number; }>

Defined in: backend/src/persistence/index.ts:1403

Replaces a source's chunks with a new set, atomically from a reader's point of view.

Replace rather than append, because re-indexing a changed document must not leave its old chunks searchable — a stale chunk is a citation pointing at text that is no longer there. The whole source at once, because a partial replacement is a document that is half old and half new, and no reader can tell.

Parameters

input

TenantScope & object

Returns

Promise<{ removed: number; written: number; }>