Skip to main content

KeywordIndex

@forge/monorepo


@forge/monorepo / backend/src / KeywordIndex

Interface: KeywordIndex

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

Exact-term retrieval over the same chunks the vector index searches (#136).

The same rows on purpose: semantic and keyword retrieval share one permission-filtered source of truth, so a chunk cannot be visible to one signal and invisible to the other. Two indexes over two copies would eventually disagree about what exists, and the disagreement would be a permission gap.

It exists because semantic search misses what it was never trained on — a product code, an error number, a campaign identifier. An embedding of ERR-4021 is an embedding of a string that looks like other strings.

Methods

search(input): Promise<readonly KeywordSearchHit[]>

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

Lexical search, filtered by permission inside the query.

authSubjects is required for the same reason it is on VectorIndex: an optional filter is one someone omits, and an excluded chunk must not merely be absent from the results — it must never have been a candidate, or its presence still shows in a count.

Parameters

input

TenantScope & object

Returns

Promise<readonly KeywordSearchHit[]>