diff --git a/nodejs/__test__/table.test.ts b/nodejs/__test__/table.test.ts index 5948ea77..91095764 100644 --- a/nodejs/__test__/table.test.ts +++ b/nodejs/__test__/table.test.ts @@ -305,6 +305,7 @@ describe("When creating an index", () => { const indices = await tbl.listIndices(); expect(indices.length).toBe(1); expect(indices[0]).toEqual({ + name: "vec_idx", indexType: "IvfPq", columns: ["vec"], }); diff --git a/nodejs/package-lock.json b/nodejs/package-lock.json index b33a1b3c..6b197fca 100644 --- a/nodejs/package-lock.json +++ b/nodejs/package-lock.json @@ -18,7 +18,6 @@ "win32" ], "dependencies": { - "@types/axios": "^0.14.0", "apache-arrow": "^15.0.0", "axios": "^1.7.2", "openai": "^4.29.2", @@ -30,6 +29,7 @@ "@biomejs/biome": "^1.7.3", "@jest/globals": "^29.7.0", "@napi-rs/cli": "^2.18.0", + "@types/axios": "^0.14.0", "@types/jest": "^29.1.2", "@types/tmp": "^0.2.6", "apache-arrow-old": "npm:apache-arrow@13.0.0", @@ -3130,6 +3130,7 @@ "resolved": "https://registry.npmjs.org/@types/axios/-/axios-0.14.0.tgz", "integrity": "sha512-KqQnQbdYE54D7oa/UmYVMZKq7CO4l8DEENzOKc4aBRwxCXSlJXGz83flFx5L7AWrOQnmuN3kVsRdt+GZPPjiVQ==", "deprecated": "This is a stub types definition for axios (https://github.com/mzabriskie/axios). axios provides its own type definitions, so you don't need @types/axios installed!", + "dev": true, "dependencies": { "axios": "*" } diff --git a/nodejs/src/table.rs b/nodejs/src/table.rs index b2b0039e..462b2fa3 100644 --- a/nodejs/src/table.rs +++ b/nodejs/src/table.rs @@ -340,6 +340,8 @@ impl Table { #[napi(object)] /// A description of an index currently configured on a column pub struct IndexConfig { + /// The name of the index + pub name: String, /// The type of the index pub index_type: String, /// The columns in the index @@ -355,6 +357,7 @@ impl From for IndexConfig { Self { index_type, columns: value.columns, + name: value.name, } } } diff --git a/rust/lancedb/src/index.rs b/rust/lancedb/src/index.rs index b98dc9a7..4346e579 100644 --- a/rust/lancedb/src/index.rs +++ b/rust/lancedb/src/index.rs @@ -80,6 +80,8 @@ pub enum IndexType { /// A description of an index currently configured on a column pub struct IndexConfig { + /// The name of the index + pub name: String, /// The type of the index pub index_type: IndexType, /// The columns in the index diff --git a/rust/lancedb/src/table.rs b/rust/lancedb/src/table.rs index afc486e9..34a5d1e7 100644 --- a/rust/lancedb/src/table.rs +++ b/rust/lancedb/src/table.rs @@ -1860,7 +1860,9 @@ impl TableInternal for NativeTable { } columns.push(field.name.clone()); } - Ok(IndexConfig { index_type: if is_vector { crate::index::IndexType::IvfPq } else { crate::index::IndexType::BTree }, columns }) + let name = idx.name.clone(); + let index_type = if is_vector { crate::index::IndexType::IvfPq } else { crate::index::IndexType::BTree }; + Ok(IndexConfig { index_type, columns, name }) }).collect::>>() } }