Skip to content

Class: LakebaseSearchBackend

A Postgres full-text backend. One instance is shared across indexes; each index maps to a table whose name is derived from the index reference.

new LakebaseSearchBackend(pgConfigFactory, schema?, poolFactory?): LakebaseSearchBackend

() => PoolConfig | Promise<PoolConfig>

string = "public"

(config) => Pool

How a pool is built from the resolved config. Overridable for tests.

LakebaseSearchBackend

addDocuments(index, documents, textColumn?, signal?): Promise<{ count: number; index: string; }>

Add or update documents by primary key.

string

Record<string, unknown>[]

string = "text"

AbortSignal

Promise<{ count: number; index: string; }>


close(): Promise<void>

Close the pool so a restarted app rebuilds it.

Promise<void>


deleteDocuments(index, ids, signal?): Promise<{ count: number; index: string; }>

Delete documents by primary key.

string

(string | number)[]

AbortSignal

Promise<{ count: number; index: string; }>


provision(index, options?): Promise<number>

Ensure the table + full-text index exist and seed documents when empty. Idempotent, so it is safe to call on every boot.

string

LakebaseProvisionOptions = {}

Promise<number>


search(index, query, options?): Promise<{ count: number; hits: object[]; index?: string; query: string; }>

Search a Lakebase-backed index. Returns hits sorted most-relevant-first, shaped identically to the Vector Search backend.

string

string

LakebaseSearchOptions = {}

Promise<{ count: number; hits: object[]; index?: string; query: string; }>