Files
lancedb/python/python
Vibhanshu Singh c5a67c3d78 fix(python): skip null texts when reranking with VoyageAI (#5336)
## Summary

A vector, full-text or hybrid search can return a row whose reranking
text is null. `VoyageAIReranker` sent that null in its `documents` list,
although the Voyage rerank API takes a list of strings, so one row with
missing text broke reranking for every other row.

Filter rows with null text out of the Arrow table before building the
request, so the indices Voyage returns still select the right rows and
keep their original columns. When every candidate has null text, return
an empty scored table without calling the API. The class docstring now
says that rows with a null `column` value are left out of the reranked
results.

This is the same change as #5283 (Cohere) and #5296 (Jina), applied to
the VoyageAI reranker.

[Voyage AI reranker
API](https://docs.voyageai.com/reference/reranker-api)

## Verification

- Added `test_voyageai_reranker_nullable_documents`, run through a real
local table and `table.search(...).rerank(...)`, with two cases:
- a null between two valid documents, where the mocked client returns
reordered indices: only the two valid texts are sent, and the result
keeps the correct row IDs, scores, `_distance` column and `float32`
`_relevance_score`;
- all-null input, where the client is never called and an empty typed
result comes back.
- Both cases fail on `main` and pass with this change.
- Ran against LanceDB 0.42.1 with the changed reranker module copied
over the installed one. The installed `voyageai.py` is identical to
`main`. I did not call the live Voyage API.
- Repository Ruff lint and format checks pass.
2026-12-02 06:07:21 +08:00
..