mirror of
https://github.com/lancedb/lancedb.git
synced 2026-09-08 14:29:03 +00:00
Enables two new parameters when building indices:
* `name`: Allows explicitly setting a name on the index. Default is
`{col_name}_idx`.
* `train` (default `True`): When set to `False`, an empty index will be
immediately created.
The upgrade of Lance means there are also additional behaviors from
https://github.com/lancedb/lance/commit/cd76a993b8b65877135cb9cfb47448a761ac7f7b:
* When a scalar index is created on a Table, it will be kept around even
if all rows are deleted or updated.
* Scalar indices can be created on empty tables. They will default to
`train=False` if the table is empty.
---------
Co-authored-by: Weston Pace <weston.pace@gmail.com>
81 lines
1.6 KiB
Markdown
81 lines
1.6 KiB
Markdown
[**@lancedb/lancedb**](../README.md) • **Docs**
|
|
|
|
***
|
|
|
|
[@lancedb/lancedb](../globals.md) / IndexOptions
|
|
|
|
# Interface: IndexOptions
|
|
|
|
## Properties
|
|
|
|
### config?
|
|
|
|
```ts
|
|
optional config: Index;
|
|
```
|
|
|
|
Advanced index configuration
|
|
|
|
This option allows you to specify a specfic index to create and also
|
|
allows you to pass in configuration for training the index.
|
|
|
|
See the static methods on Index for details on the various index types.
|
|
|
|
If this is not supplied then column data type(s) and column statistics
|
|
will be used to determine the most useful kind of index to create.
|
|
|
|
***
|
|
|
|
### name?
|
|
|
|
```ts
|
|
optional name: string;
|
|
```
|
|
|
|
Optional custom name for the index.
|
|
|
|
If not provided, a default name will be generated based on the column name.
|
|
|
|
***
|
|
|
|
### replace?
|
|
|
|
```ts
|
|
optional replace: boolean;
|
|
```
|
|
|
|
Whether to replace the existing index
|
|
|
|
If this is false, and another index already exists on the same columns
|
|
and the same name, then an error will be returned. This is true even if
|
|
that index is out of date.
|
|
|
|
The default is true
|
|
|
|
***
|
|
|
|
### train?
|
|
|
|
```ts
|
|
optional train: boolean;
|
|
```
|
|
|
|
Whether to train the index with existing data.
|
|
|
|
If true (default), the index will be trained with existing data in the table.
|
|
If false, the index will be created empty and populated as new data is added.
|
|
|
|
Note: This option is only supported for scalar indices. Vector indices always train.
|
|
|
|
***
|
|
|
|
### waitTimeoutSeconds?
|
|
|
|
```ts
|
|
optional waitTimeoutSeconds: number;
|
|
```
|
|
|
|
Timeout in seconds to wait for index creation to complete.
|
|
|
|
If not specified, the method will return immediately after starting the index creation.
|