Fts5KeywordIndex
Contract for a BM25-ranked keyword index — the keyword tier of hybrid
retrieval. Implementations: BM25Index (in-memory, rebuilt per process)
and Fts5KeywordIndex (SQLite FTS5, persistent — survives Durable
Object hibernation with zero rebuild).
All methods are synchronous: the in-memory index is pure computation and
DO SQLite’s sql.exec is synchronous, so the contract stays sync to keep
FusionRetriever / KnowledgeFs hot paths allocation-free.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Fts5KeywordIndex(options): Fts5KeywordIndex;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
Returns
Section titled “Returns”Fts5KeywordIndex
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get size(): number;Number of documents in the index.
Returns
Section titled “Returns”number
Number of documents in the index.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”add(documents): void;Add documents. A document with an existing ID is overwritten.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”clear()
Section titled “clear()”clear(): void;Remove all documents.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”remove()
Section titled “remove()”remove(id): boolean;Remove a document by ID. Returns true if it existed.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”search()
Section titled “search()”search(query, topK?): BM25SearchResult[];Search for documents matching the query, BM25-scored, descending.
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
|
|
|
|
|
|
|
|