mirror of
https://github.com/lancedb/lancedb.git
synced 2026-01-07 04:12:59 +00:00
doc: fix js example of create index (#886)
This commit is contained in:
@@ -213,8 +213,7 @@ After a table has been created, you can always add more data to it using
|
||||
=== "Typescript"
|
||||
|
||||
```typescript
|
||||
await tbl.add([{vector: [1.3, 1.4], item: "fizz", price: 100.0},
|
||||
{vector: [9.5, 56.2], item: "buzz", price: 200.0}])
|
||||
--8<-- "docs/src/basic_legacy.ts:add"
|
||||
```
|
||||
|
||||
=== "Rust"
|
||||
@@ -261,7 +260,7 @@ For tables with more than 50K vectors, creating an ANN index is recommended to s
|
||||
=== "Typescript"
|
||||
|
||||
```{.typescript .ignore}
|
||||
await tbl.createIndex({})
|
||||
--8<-- "docs/src/basic_legacy.ts:create_index"
|
||||
```
|
||||
|
||||
=== "Rust"
|
||||
|
||||
@@ -23,6 +23,23 @@ const example = async () => {
|
||||
);
|
||||
// --8<-- [end:create_table]
|
||||
|
||||
// --8<-- [start:add]
|
||||
const newData = Array.from({ length: 500 }, (_, i) => ({
|
||||
vector: [i, i + 1],
|
||||
item: "fizz",
|
||||
price: i * 0.1,
|
||||
}));
|
||||
await tbl.add(newData);
|
||||
// --8<-- [end:add]
|
||||
|
||||
// --8<-- [start:create_index]
|
||||
await tbl.createIndex({
|
||||
type: "ivf_pq",
|
||||
num_partitions: 2,
|
||||
num_sub_vectors: 2,
|
||||
});
|
||||
// --8<-- [end:create_index]
|
||||
|
||||
// --8<-- [start:create_empty_table]
|
||||
const schema = new Schema([
|
||||
new Field("id", new Int32()),
|
||||
|
||||
Reference in New Issue
Block a user