Skip to content

feat(search): add fast_query for dense read-only collections - #761

Open
luoxiaojian wants to merge 23 commits into
alibaba:mainfrom
luoxiaojian:codex/fast-query-upstream
Open

luoxiaojian wants to merge 23 commits into
alibaba:mainfrom
luoxiaojian:codex/fast-query-upstream

Conversation

@luoxiaojian

Copy link
Copy Markdown
Collaborator

Return owned internal-ID arrays and optional scores through C++ search_fast and Collection.fast_query with a thin NumPy binding. Reuse query parameters and graph/Flat fast paths, retaining filtered and multi-segment fallbacks.

Preserve the existing scale_factor defaults and Uniform raw-Flat fallback. Cover native reference types, default and explicit refine budgets, all dense index families, parameter reuse, result ownership, and untrained/mixed Uniform segments.

Validation: 634 related Python tests passed; 70 C++ tests passed with one existing skip. Ruff, changed-line clang-format, and diff checks passed.

Adapted from alignment commit 9ddbd5aa082615226d91addb41cd60496143d15a onto upstream/main 43f72b1.

Comment thread tests/ailego/buffer/vector_page_table_test.cc Outdated
Comment thread src/db/index/segment/segment.cc Outdated
Comment thread src/db/collection.cc Outdated
@luoxiaojian
luoxiaojian force-pushed the codex/fast-query-upstream branch 3 times, most recently from 9ddd8ef to 6af0d53 Compare September 19, 2026 16:20
Return owned internal-ID arrays and optional scores through C++ search_fast and Collection.fast_query with a thin NumPy binding. Reuse query parameters and graph/Flat fast paths, retaining filtered and multi-segment fallbacks.

Preserve the existing scale_factor defaults and Uniform raw-Flat fallback. Cover native reference types, default and explicit refine budgets, all dense index families, parameter reuse, result ownership, and untrained/mixed Uniform segments.

Validation: 634 related Python tests passed; 70 C++ tests passed with one existing skip. Ruff, changed-line clang-format, and diff checks passed.

Adapted from alignment commit 9ddbd5aa082615226d91addb41cd60496143d15a onto upstream/main 43f72b1.
Reuse query parameter mapping across ordinary and fast queries, remove redundant cached references and result copies, and handle empty collections consistently.

Add coverage for reusable parameters, empty collections, and Uniform quantizer fallback before and after optimize and subsequent inserts.

Validation: 151 related tests passed; the complete 780-point SIFT/GIST comparison stayed within the established QPS and recall tolerances.
Use Turbo distance evaluation and score normalization in fast Flat searches. Preserve base query parameters when graph indexes fall back to Flat, and keep strict validation for concrete graph query paths. Stabilize the queue recovery test by leaving background eviction headroom.

Validation: seven related C++ test executables passed; Python regressions passed 277 tests with seven platform skips; queue recovery passed 500 repetitions; clang-format and git diff checks passed.
Resolve eligible single-block index routes when opening read-only collections. Share synchronous engine dispatch with call-local query and refiner parameters to avoid repeated routing and parameter allocations, while retaining lifecycle locking and the existing composite fallback.

Extend index and metric dispatch tests to alternate refinement settings and defaults. Validated with clang-format 18.1.8, Ruff 0.14.4, 34 native tests, 70 Python tests, and mixed concurrent query/fast_query checks.
@luoxiaojian
luoxiaojian force-pushed the codex/fast-query-upstream branch from f52f7f5 to cb11e4b Compare September 20, 2026 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants