Skip to content

Class: SearchIndex

A handle bound to one index. Modeled on Meilisearch’s client.index(uid): search / autocomplete read, addDocuments / deleteDocuments write (to a direct-access index), and info fetches the live definition.

new SearchIndex(name, client): SearchIndex

string

SearchClient

SearchIndex

readonly name: string

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

Add or update documents in this (direct-access) index.

Record<string, unknown>[]

AbortSignal

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


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

Autocomplete against this index: a search with a small default limit and the raw prefix as the query. Hybrid mode already handles prefixes, so this is a self-documenting alias rather than a separate code path.

string

SearchOptions

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


delete(signal?): Promise<void>

Delete this index.

AbortSignal

Promise<void>


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

Delete documents from this (direct-access) index by primary key.

(string | number)[]

AbortSignal

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


ensure(options?): Promise<IndexInfo>

Create this index if it does not exist, otherwise return the existing one.

CreateIndexOptions

Promise<IndexInfo>


info(signal?): Promise<IndexInfo>

Fetch this index’s live definition (primary key, columns, readiness).

AbortSignal

Promise<IndexInfo>


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

Search this index. See SearchClient.search.

string

SearchOptions

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


sync(signal?): Promise<void>

Trigger a sync of this (Delta Sync) index from its source table.

AbortSignal

Promise<void>