Repository navigation
feat(core): runtime-selectable vector engine (usearch + vecq in one build) - #1169
Merged
Merged
Conversation
…ether, select via ENV/config (#1168) Replace the compile-time mutual exclusion of vector engines with runtime selection while keeping slim single-engine builds working. - vector.rs: unified runtime enum Engine { Usearch(Box<Index>), Vecq(VecqIndex) } behind the unchanged VectorIndex API; all cfg- branched sites became match arms on the enum. The vecq profile stays 4-bit + residual (with_residual, #1164) on every path. - compile_error guard: 'both engines' no longer errors — only 'no engine at all' does. Features are additive: desktop builds can compile both engines; mobile keeps single-engine builds (unused variants are eliminated at link time). - Selection precedence: UTEKE_VECTOR_BACKEND env > [vector] backend in uteke.toml > compiled-in default (usearch when present). Unknown values / engines not compiled in fall back to the default with a warning — open() never fails on a bad preference. - Per-engine index files kept (uteke_index.usearch / .vecq). Switching engines leaves the old file intact; the new engine starts empty and finish_open_full auto-rebuilds it from SQLite (source of truth). Both files coexist; switching back picks the old file up without a rebuild. - New API surface: VectorBackend (parse/resolve/default_backend), VectorIndex::with_backend / load_or_create_for / load_from_file_for, VectorIndex::backend(). - CLI: [vector] backend config + UTEKE_VECTOR_BACKEND env override. - Docs: configuration.md env table entry. Verified (all green; clippy 0 warnings and fmt clean on all three feature sets): - dual-engine (onnx+usearch+vecq): 537 passed - vecq-only slim (onnx+vecq): 535 passed - default (onnx+usearch): 534 passed; cli config tests: 45 passed - e2e: engine switch usearch->vecq->usearch on one store — auto-rebuild from SQLite, per-engine files coexist, switch back reuses the old file; invalid env falls back to default
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
Guard the runtime-selection feature: dual-engine build must compile and pass the engine-switch + vector module tests on every PR.
This was referenced Aug 31, 2026
ajianaz
added a commit
that referenced
this pull request
Aug 31, 2026
…ecq (#1171) * feat(build): dual-engine default — official binaries ship usearch + vecq (#1168) Flip the default feature set of uteke-core and all forwarding crates (cli/server/mcp) to compile BOTH vector engines, making runtime selection (UTEKE_VECTOR_BACKEND / [vector] backend, #1169) available out of the box in official binaries and the Docker image. - default = [onnx, usearch, vecq] across the workspace. - Slim builds unchanged: --no-default-features --features vecq (mobile, pure Rust) or --features usearch (classic single-engine). - docker-compose: expose UTEKE_VECTOR_BACKEND (default usearch). - docs/docker.md: engine-choice section + volume layout (.usearch + .vecq coexist; switching rebuilds from SQLite, data untouched). Release binary size: 11.86 MB (was ~10.9 MB usearch-only; +~1 MB for the vecq engine). Verified: - cargo test -p uteke-core --lib (dual-engine default): 537 passed - cli config tests: 45 passed - Release-binary smoke test: default writes .usearch; switch to vecq rebuilds (hybrid recall finds the probe, score 1.13); switch back reuses the old .usearch; invalid env falls back cleanly (exit 0) * fix(core): drop unused VectorBackend import in engine-switch test CI clippy (-D warnings, workspace all-targets) flagged the import as unused — the test never names the type directly. --------- Co-authored-by: ajianaz <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
VectorIndexAPI. The mutual-exclusioncompile_error!is gone; features are now additive — a desktop build can ship both engines, slim mobile builds keep exactly one (unused variants are link-time eliminated).UTEKE_VECTOR_BACKENDenv →[vector] backendin uteke.toml → compiled-in default (usearch when present). Bad/unknown/not-compiled-in values fall back to the default with a warning —open()never fails on a bad preference.uteke_index.usearch/uteke_index.vecq). Switching engines on an existing store leaves the old file intact; the new engine starts empty and the existing auto-rebuild-from-SQLite path repopulates it. Switching back picks the old file up with no rebuild. SQLite stays the single source of truth.with_residual, build(core): bump vecq-core to 0.3.0 — adopt 4-bit + residual profile #1164) on every path.VectorBackend(parse/resolve/default_backend),VectorIndex::with_backend/load_or_create_for/load_from_file_for,VectorIndex::backend().[vector] backendconfig key +UTEKE_VECTOR_BACKENDenv override; docs table entry in configuration.md.Why
UTEKE_VECTOR_BACKENDand restarting.--no-default-features --features onnx,vecqstill builds vecq-only with no C++ toolchain.Testing
cargo test -p uteke-core --features usearch,vecq --lib): 537 passed, 0 failed — includes new dual-engine per-extension roundtrip test--no-default-features --features onnx,vecq): 535 passed, 0 failedonnx+usearch): 534 passed, 0 failed — no regression[vector]backend parsing)usearch → vecq → usearchviaUTEKE_VECTOR_BACKEND— per-engine files written/coexist, auto-rebuild from SQLite finds the probe, switch-back reuses the old fileUTEKE_VECTOR_BACKEND=bogus-engine→ open succeeds on default engine