docs: fix the hybrid search walkthrough (#5334)

## Summary

- Import `lancedb` before the Embedded Python connection example uses
it.
- Explain how to use the default RRF reranker when skipping the optional
setup step in Python or TypeScript.

## Testing

- Ran the original walkthrough in fresh Python 3.12 and Node.js 24
processes. The Python connection raised `NameError`, and skipping the
optional reranker setup raised `NameError` in Python and
`ReferenceError` in TypeScript.
- Ran the updated steps with the published LanceDB 0.42.0 Python and
Node SDKs, real Embedded tables and full-text indexes, and deterministic
test embeddings. Both explicit and default RRF returned the same four
rows in the same order and with the same relevance scores in each SDK.

- Checked the edited page with Vale 3.24.0 and checked the staged diff.

AI assistance disclosure. OpenAI Codex reproduced the errors, prepared
the documentation change, and ran the checks.
This commit is contained in:
Jacky Hsu
2026-12-02 03:25:56 +08:00
committed by GitHub
parent 108e8183e1
commit 82620b1b8e
+2
View File
@@ -67,6 +67,7 @@ Run the steps for your chosen language in order, choosing one connection option.
<CodeGroup>
```python Python icon="python"
import lancedb
from lancedb.index import FTS
from lancedb.rerankers import RRFReranker
from lancedb.embeddings import get_registry
@@ -202,6 +203,7 @@ await table.waitForIndex(["text_idx"], 300);
### 7\. Set Reranker [Optional] {#7-set-reranker-optional}
RRF is the default. The examples below configure it explicitly. Other
rerankers and their language support are described in [Reranking](/reranking).
If you skip this step, omit the `.rerank(reranker)` call in the next step.
<CodeGroup>
```python Python icon="python"