mirror of
https://github.com/lancedb/lancedb.git
synced 2026-12-03 07:45:17 +00:00
## Summary - Replace the website's TypeScript full-text filtering examples with a snippet generated from `docs/web-tests/ts/full_text_search.test.ts`. In a full-text-only query, `where(...)` filters rows before the search selects candidates. - Update the guide and regenerate the Node API reference. Vector and hybrid queries also prefilter by default and can use `VectorQuery.postfilter()`. In hybrid search, it filters candidates from both searches before reranking. ## Root cause The website's TypeScript examples used the legacy `vectordb` method `.prefilter(...)`, which is absent from `@lancedb/lancedb`. The Node API reference left full-text and hybrid filter timing implicit. ## Validation - Ran `full_text_search.test.ts`, `filtering.test.ts`, and `search_examples.test.ts` in `docs/web-tests/ts` with the locked npm SDK. All eight tests passed, as did a targeted TypeScript check of those files. - Ran the exact snippet imported by the guide against the locked npm SDK and the SDK built from this branch. Both runs returned the expected full-text match and confirmed prefiltering and postfiltering behavior for vector and hybrid queries. - Built the Node native binding, compiled the SDK, and regenerated the TypeDoc reference. Biome passed for the SDK, SDK examples, and the changed website test. The full website test directory produced the same existing Biome and TypeScript diagnostics as `main`. Fixes #2237 <!-- lance-gatekeeper-fix:v1 agent=1e80a282d1024d8eadf8e0ff33d83c9d generation=1 --> --------- Co-authored-by: Gatefixer <313497061+lancedb-gatefixer[bot]@users.noreply.github.com> Co-authored-by: Xuanwo <github@xuanwo.io>
7 lines
750 B
Plaintext
7 lines
750 B
Plaintext
{/* Auto-generated by scripts/mdx_snippets_gen.py. Do not edit manually. */}
|
|
|
|
export const TsFtsPrefiltering = "const table = await db.createTable(\"documents\", [\n { text: \"Puppy puppy puppy\", category: \"guide\" },\n { text: \"Frodo was a happy puppy\", category: \"pet\" },\n { text: \"There are several kittens playing\", category: \"pet\" },\n]);\nawait table.createIndex(\"text\", { config: lancedb.Index.fts() });\n\nconst results = await table\n .search(\"puppy\", \"fts\")\n .where(\"category = 'pet'\")\n .limit(1)\n .toArray();\n";
|
|
|
|
export const TsFullTextSearch = "const result = await tbl\n .query()\n .nearestToText(\"apple\")\n .select([\"id\", \"doc\"])\n .limit(10)\n .toArray();\nexpect(result.length).toBe(10);\n";
|
|
|