mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-15 16:22:27 +00:00
The pages describing this code lived in lancedb/docs, a repository with ten stars that neither contributing guide mentioned. A user who hit a wrong page while reading the source had to find a separate, near-invisible repository to fix it. These 102 pages now sit beside the code, and a documentation fix is a pull request in the repository the reader already had open. `docs/web` is a complete Mintlify site: `cd docs/web && mint dev` serves it with no other checkout. Enterprise pages stay private and are merged in when the published site is assembled, so links into them do not resolve here — every open-source page does. `docs/web-tests` holds the tests the code examples are extracted from. They ran against a published wheel before; here they can run against this repository's own SDK, so an example that stops compiling fails the pull request that broke it rather than being noticed later. Both directories sit beside `docs/src` and are invisible to it: mkdocs reads `docs_dir: src`, so the SDK reference builds and deploys exactly as before.
13 lines
1.1 KiB
Plaintext
13 lines
1.1 KiB
Plaintext
{/* Auto-generated by scripts/mdx_snippets_gen.py. Do not edit manually. */}
|
|
|
|
export const TsImport = "import * as lancedb from \"@lancedb/lancedb\";\nimport type { VectorQuery } from \"@lancedb/lancedb\";\n";
|
|
|
|
export const TsIngest = "const db = await lancedb.connect(databaseDir);\n\nconst data = Array.from({ length: 5_000 }, (_, i) => ({\n vector: Array(128).fill(i),\n id: `${i}`,\n content: \"\",\n longId: `${i}`,\n}));\n\nconst table = await db.createTable(\"my_vectors\", data, {\n mode: \"overwrite\",\n});\nawait table.createIndex(\"vector\", {\n config: lancedb.Index.ivfPq({\n numPartitions: 10,\n numSubVectors: 16,\n }),\n});\n";
|
|
|
|
export const TsSearch1 = "const search = table.search(Array(128).fill(1.2)).limit(2) as VectorQuery;\nconst results1 = await search.nprobes(20).refineFactor(10).toArray();\n";
|
|
|
|
export const TsSearch2 = "const results2 = await table\n .search(Array(128).fill(1.2))\n .where(\"id != '1141'\")\n .limit(2)\n .toArray();\n";
|
|
|
|
export const TsSearch3 = "const results3 = await table\n .search(Array(128).fill(1.2))\n .select([\"id\"])\n .limit(2)\n .toArray();\n";
|
|
|