createGraphIndexer
@forge/monorepo / backend/src / createGraphIndexer
Function: createGraphIndexer()
createGraphIndexer(
deps):object
Defined in: backend/src/knowledge/graph.ts:340
Parameters
deps
Returns
extractorId
extractorId:
string=deps.extractor.id
indexSource()
indexSource(
context,input):Promise<GraphIndexResult>
Extract one source's chunks into the graph, replacing whatever that source contributed before.
The caller has already decided this should run — indexSource calls shouldIndex first — so this does
not re-check. Keeping the decision in one place is what makes "off costs nothing" a property of one
function rather than a convention two functions share.
Parameters
context
tenantId
input
chunks
readonly ExtractionChunk[]
concurrency?
number
sourceId
string
sourceType
"file" | "artifact" | "message" | "external"
Returns
Promise<GraphIndexResult>
shouldIndex()
shouldIndex(
context,source):Promise<boolean>
Whether this source would be graph-indexed — both switches, in the cheap order.
The tenant switch first, so a deployment with GraphRAG off does one settings read and stops, rather than one read per source. AC-2's "flag is inert while the tenant switch is off" is this ordering: the source flag is never even consulted, and it stays stored for the day the tenant switch flips.
Parameters
context
tenantId
source
sourceId
string
sourceType
"file" | "artifact" | "message" | "external"
Returns
Promise<boolean>