Interface: SearchIndex<TBindConfig>
Defined in: retrieval/src/index.ts:37
Generic search index interface.
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
TBindConfig | unknown | Provider-specific binding configuration type. Implementations can be backed by various vector databases: - pgvector (Postgres) - Turbopuffer - Pinecone - Elasticsearch - etc. |
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
id | readonly | string | Identifier 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
| Parameter | Type |
|---|---|
id | string |
config | TBindConfig |
Returns
Promise<void>
capabilities()
capabilities(): SearchCapabilities;Defined in: retrieval/src/index.ts:107
Query backend capabilities for query planning.
Returns
createIndex()
createIndex(params: NewIndexParams): Promise<void>;Defined in: retrieval/src/index.ts:49
Create a new index.
Parameters
| Parameter | Type |
|---|---|
params | NewIndexParams |
Returns
Promise<void>
deleteIndex()
deleteIndex(id: string): Promise<void>;Defined in: retrieval/src/index.ts:64
Delete an index and all its documents.
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
Promise<void>
describeIndex()
describeIndex(id: string): Promise<IndexStats>;Defined in: retrieval/src/index.ts:59
Get statistics about an index.
Parameters
| Parameter | Type |
|---|---|
id | string |
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 Parameter | Default type | Description |
|---|---|---|
TDocument | UnknownDocument | Shape of the document fields for typed results. |
Parameters
| Parameter | Type |
|---|---|
id | string |
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 | undefinedlistIndexes()
listIndexes(params?: ListIndexesParams): Promise<CursorPage<IndexSummary, CursorPageParams>>;Defined in: retrieval/src/index.ts:54
List indexes with optional pagination and prefix filtering.
Parameters
| Parameter | Type |
|---|---|
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
| Parameter | Type |
|---|---|
id | string |
Returns
Promise<void>