Last active 1733337825

Revision 48d6670b3b971fb3650781e385f952cc11a0e9f1

LanceDB-1.js Raw
1import * as lancedb from "@lancedb/lancedb";
2
3const db = await lancedb.connect("data/sample-lancedb");
4const table = await db.createTable("vectors", [
5 { id: 1, vector: [0.1, 0.2], item: "foo", price: 10 },
6 { id: 2, vector: [1.1, 1.2], item: "bar", price: 50 },
7], {mode: 'overwrite'});
8
9
10const query = table.vectorSearch([0.1, 0.3]).limit(2);
11const results = await query.toArray();
12
13// You can also search for rows by specific criteria without involving a vector search.
14const rowsByCriteria = await table.query().where("price >= 10").toArray();