mirror of
https://github.com/lancedb/lancedb.git
synced 2026-08-18 12:08:35 +00:00
a651b67c76
Four of the eight LSM methods are remote-only in the core: `impl BaseTable for NativeTable` implements only set/unset/get_lsm_write_spec and close_lsm_writers, while flush_lsm, compact_lsm and get_lsm_stats fall through to trait defaults returning NotSupported. That is why Node had bound the four that work locally and stopped, and why the remaining four had no binding-level coverage anywhere. Node: add napi bindings for flush_lsm, compact_lsm, checkpoint_lsm and get_lsm_stats, with typed LsmStats/BucketStats/GenerationStats/ MemtableStats objects mirroring the existing LsmWriteSpec object in the same file. Tests assert each binding reaches the core and surfaces NotSupported locally; behavior against a real endpoint stays covered by the mocked-endpoint tests in rust/lancedb/src/remote/table.rs. Python: LsmWriteSpec was importable only from the private lancedb._lancedb -- it appeared in table.py solely under `if TYPE_CHECKING:`. Export it as lancedb.LsmWriteSpec, add it to __all__, and list it in the API reference, which had no mention of it and so rendered it nowhere. Java: add the LSM routes to lancedb-core. Java reaches LanceDB purely over REST through the generated namespace client, and these routes are not in the Lance Namespace spec, so they are issued through a small dedicated client. LsmWriteSpec is deliberately not org.lance.memwal. InitializeMemWalParams: that type defaults to maintaining no indexes where a spec here defaults to maintaining every index, and it cannot express the null that asks the server to resolve the set. checkpointLsm is ported from rust/lancedb/src/table/checkpoint.rs with its constants and status semantics intact -- 429/503 retried in place, 421 restarting from flush. Note: `mvnw spotless:apply` cannot run on JDK 21 (google-java-format 1.7, pinned in java/pom.xml, predates JDK 16's compiler API change). This is pre-existing and reproduces on a pristine main checkout; the Java sources here were formatted by hand to the checkstyle rules. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
LanceDB JavaScript SDK
A JavaScript library for LanceDB.
Installation
npm install @lancedb/lancedb
This will download the appropriate native library for your platform. We currently support:
- Linux (x86_64 and aarch64 on glibc and musl)
- MacOS (Intel and ARM/M1/M2)
- Windows (x86_64 and aarch64)
Usage
Basic Example
import * as lancedb from "@lancedb/lancedb";
const db = await lancedb.connect("data/sample-lancedb");
const table = await db.createTable("my_table", [
{ id: 1, vector: [0.1, 1.0], item: "foo", price: 10.0 },
{ id: 2, vector: [3.9, 0.5], item: "bar", price: 20.0 },
]);
const results = await table.vectorSearch([0.1, 0.3]).limit(20).toArray();
console.log(results);
The quickstart contains more complete examples.
Development
See CONTRIBUTING.md for information on how to contribute to LanceDB.