zvec/python/tests
Cuiys 0923f7c691
refactor: make Reranker stateless with std::variant value semantics (… (#471)
* refactor: make Reranker stateless with std::variant value semantics (#461)

Replace class hierarchy (Reranker/ScoreBasedReranker/RrfReranker/
WeightedReranker/CallbackReranker) with std::variant<RrfParams,
WeightedParams, CallbackParams> value type and a stateless free function
reranker::rerank().

Key changes:
- reranker.h: define RerankParams variant + reranker::rerank() API
- query.h: MultiQuery::reranker (shared_ptr) -> MultiQuery::rerank (value)
- schema.h: add CollectionSchema::get_field_ptr() returning FieldSchema::Ptr
- collection.cc: push field lookup to caller, pass vector<FieldSchema::Ptr>
- c_api: remove opaque zvec_reranker_t, add zvec_multi_query_set_rerank_*
- python binding: expose _RrfParams/_WeightedParams/_CallbackParams + setters
- python layer: WeightedReRanker(list[float]), remove Python rerank logic
- all tests updated to new interface

Benefits:
- Thread-safe by design: no mutable state, safe to share across threads
- Collection-decoupled: no bind_schema(), field info passed as parameter
- Simpler lifecycle: value semantics, no shared_ptr management

Closes #461

* chore: remove nightly_build.yml unrelated to reranker refactor

* chore: remove uv.lock unrelated to reranker refactor

* fix: raise ValueError when multi-query has no reranker

After the reranker stateless refactor the C++ MultiQuery rerank
strategy uses a std::variant with a default value, so the implicit
'reranker required' validation no longer triggered. Restore the
check in QueryExecutor._execute_multi_query so that a hybrid
(multi-query) request without a reranker raises ValueError.

* fix(reranker): use index_type FTS check for non-vector normalization

Replace dynamic_cast nullptr check with explicit IndexType::FTS check
and map FTS/BM25 positive scores to (0.0, 1.0) via 2*atan(score)/pi.

* refactor(reranker): move Params types into reranker namespace and qualify usages

Move RrfParams, WeightedParams, CallbackParams and RerankParams into the
zvec::reranker namespace, and add explicit reranker:: qualification at all
usage sites outside the reranker module (query.h, python/c bindings, tests).

* refactor(query): drop unused PendingQuery wrapper, use std::vector<SearchQuery> directly

* refactor(reranker): make _to_cpp_params non-abstract with default NotImplementedError

Remove @abstractmethod from RerankFunction._to_cpp_params and provide a
default implementation raising NotImplementedError. Drop the redundant
_to_cpp_params overrides from Qwen and Sentence rerankers since they use
the Python rerank path and don't need the C++ conversion.
2026-06-09 12:44:17 +08:00
..
detail refactor: make Reranker stateless with std::variant value semantics (… (#471) 2026-06-09 12:44:17 +08:00
test_collection.py refactor: make Reranker stateless with std::variant value semantics (… (#471) 2026-06-09 12:44:17 +08:00
test_collection_diskann.py feat: add diskann index (#369) 2026-06-04 20:52:43 +08:00
test_collection_fts.py refactor: change rerank interface from map-based to vector-based (#458) 2026-06-04 16:03:28 +08:00
test_collection_fts_vector_hybrid.py refactor: change rerank interface from map-based to vector-based (#458) 2026-06-04 16:03:28 +08:00
test_collection_hnsw_rabitq.py deprecate python VectorQuery (#267) 2026-05-12 14:55:49 +08:00
test_convert.py Initial commit 2025-12-30 11:02:17 +08:00
test_doc.py Initial commit 2025-12-30 11:02:17 +08:00
test_embedding.py feat: enlarge topK limit (#348) 2026-04-17 17:51:07 +08:00
test_fts_query.py refactor: change rerank interface from map-based to vector-based (#458) 2026-06-04 16:03:28 +08:00
test_gil_release.py Refactor CPU feature detection to use an explicit x86 whitelist (#258) 2026-06-02 11:51:25 +08:00
test_hnsw_contiguous_memory.py ut: fix some uts (#394) 2026-05-12 19:04:33 +08:00
test_jieba_default_dict.py feat: add fts support (#408) 2026-06-01 15:02:54 +08:00
test_params.py minor: fix python doc string for ivf index params (#473) 2026-06-09 11:41:03 +08:00
test_query_executor.py refactor: change rerank interface from map-based to vector-based (#458) 2026-06-04 16:03:28 +08:00
test_reranker.py refactor: make Reranker stateless with std::variant value semantics (… (#471) 2026-06-09 12:44:17 +08:00
test_schema.py fix: fix default m (#20) 2026-01-12 10:22:58 +08:00
test_typing.py Initial commit 2025-12-30 11:02:17 +08:00
test_util.py feat: support ai extension (#88) 2026-02-12 18:33:41 +08:00
test_vamana.py ut: fix some uts (#394) 2026-05-12 19:04:33 +08:00