kernl

Interface: SearchIndex<TBindConfig>

Defined in: retrieval/src/index.ts:37

Generic search index interface.

Type Parameters

Type ParameterDefault typeDescription
TBindConfigunknownProvider-specific binding configuration type. Implementations can be backed by various vector databases: - pgvector (Postgres) - Turbopuffer - Pinecone - Elasticsearch - etc.

Properties

PropertyModifierTypeDescriptionDefined in
idreadonlystringIdentifier for this search backend. e.g. "pgvector""turbopuffer"

Methods

bindIndex()

bindIndex(id: string, config: TBindConfig): Promise<void>;

Defined in: retrieval/src/index.ts:93

Bind an existing resource as an index.

Not all backends support binding. Throws if unsupported.

Parameters

ParameterType
idstring
configTBindConfig

Returns

Promise<void>


capabilities()

capabilities(): SearchCapabilities;

Defined in: retrieval/src/index.ts:107

Query backend capabilities for query planning.

Returns

SearchCapabilities


createIndex()

createIndex(params: NewIndexParams): Promise<void>;

Defined in: retrieval/src/index.ts:49

Create a new index.

Parameters

ParameterType
paramsNewIndexParams

Returns

Promise<void>


deleteIndex()

deleteIndex(id: string): Promise<void>;

Defined in: retrieval/src/index.ts:64

Delete an index and all its documents.

Parameters

ParameterType
idstring

Returns

Promise<void>


describeIndex()

describeIndex(id: string): Promise<IndexStats>;

Defined in: retrieval/src/index.ts:59

Get statistics about an index.

Parameters

ParameterType
idstring

Returns

Promise<IndexStats>


index()

index<TDocument>(id: string): IndexHandle<TDocument>;

Defined in: retrieval/src/index.ts:86

Get a handle for operating on a specific index.

Type Parameters

Type ParameterDefault typeDescription
TDocumentUnknownDocumentShape of the document fields for typed results.

Parameters

ParameterType
idstring

Returns

IndexHandle<TDocument>

Example

// untyped (default)
const docs = search.index("docs");
await docs.query({ content: "quick fox" });

// typed documents
interface Document { title: string; content: string; }
const docs = search.index<Document>("docs");
const hits = await docs.query({ content: "fox" });
hits[0].document?.title; // string | undefined

listIndexes()

listIndexes(params?: ListIndexesParams): Promise<CursorPage<IndexSummary, CursorPageParams>>;

Defined in: retrieval/src/index.ts:54

List indexes with optional pagination and prefix filtering.

Parameters

ParameterType
params?ListIndexesParams

Returns

Promise<CursorPage<IndexSummary, CursorPageParams>>


warm()

warm(id: string): Promise<void>;

Defined in: retrieval/src/index.ts:102

Warm/preload an index for faster queries.

Not all backends support warming. Throws if unsupported.

Parameters

ParameterType
idstring

Returns

Promise<void>

On this page