| # RuVector β Bug Fixes |
|
|
| This is a patched version of [ruvector](https://github.com/ruvector/ruvector) with two critical bugs fixed. |
|
|
| ## Bugs Fixed |
|
|
| ### Bug 1: CLI `create` command fails with "Missing field `dimensions`" |
|
|
| **Symptom:** `npx ruvector create ./db -d 384` fails with `Missing field 'dimensions'` |
|
|
| **Root Cause:** The CLI passes `{ dimension: 384 }` (singular) to the `VectorDB` constructor, but the native Rust binding (`@ruvector/core`) expects `{ dimensions: 384 }` (plural). |
|
|
| **Fix:** The `VectorDBWrapper` constructor now normalizes `dimension` β `dimensions` automatically. (`dist/index.js`) |
|
|
| ### Bug 2: JS API insert fails with "Dimension mismatch: expected 384, got 0" |
|
|
| **Symptom:** `await db.insert([...384 floats...], metadata)` fails with dimension mismatch even though the vector has the correct length. |
|
|
| **Root Cause:** The `insert()` method only accepted object-style args `insert({vector, metadata})`, but users naturally call it with positional args `insert(vector, metadata)`. When a Float32Array was passed as the first arg, `entry.vector` was `undefined`, creating an empty Float32Array(0). |
|
|
| **Fix:** Both `insert()` and `search()` now accept positional arguments in addition to object-style: |
| - `db.insert(vector, metadata)` β positional style (new) |
| - `db.insert({vector, metadata})` β object style (still works) |
| - `db.search(vector, k)` β positional style (new) |
| - `db.search({vector, k})` β object style (still works) |
|
|
| ## Files Modified |
|
|
| - `dist/index.js` β VectorDBWrapper class (constructor, insert, search methods) |
|
|
| ## Original Repository |
|
|
| https://github.com/ruvector/ruvector |
|
|