Repository navigation
refactor(numeric_index): split mod.rs into focused submodules - #8997
Merged
generall merged 4 commits intoMay 12, 2026
Merged
Conversation
`numeric_index/mod.rs` was 1308 lines mixing the storage-dispatch enum, the public `NumericIndex<T, P>` wrapper, three builders, per-(T, P) `ValueIndexer` impls, and the `Encodable`/`StreamRange` traits — hard to navigate. Split into: - `mod.rs` keeps the shared traits (`Encodable`, `StreamRange`), `Range<T>::as_index_key_bounds`, and re-exports. - `wrapper.rs` — `NumericIndex<T, P>` + inherent impl + `NumericIndexIntoInnerValue` trait. - `builders.rs` — `NumericIndexBuilder`, `NumericIndexMmapBuilder`, `NumericIndexGridstoreBuilder`. - `value_indexer.rs` — `ValueIndexer` and per-(T, P) `value_retriever` inherent impls. - `storage/` — the `NumericIndexInner` dispatch enum: - `storage/mod.rs` — enum + simple match-and-forward (constructors, lifecycle, telemetry, per-point access). - `storage/statistics.rs` — histogram-driven cardinality and point-count helpers. - `storage/trait_impls.rs` — `PayloadFieldIndex`, `PayloadFieldIndexRead`, `StreamRange` impls. Pure code reorganization — no behavior change. A few inherent methods on `NumericIndexInner` had to widen from private to `pub(super)` / `pub(in crate::index::field_index::numeric_index)` to remain reachable across the new module boundaries (and from `tests.rs`); the new constructors (`NumericIndexMmapBuilder::new`, `NumericIndexGridstoreBuilder::new`) replace direct field construction across files. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…point_ids_by_value out of statistics - Renamed `wrapper.rs` to `numeric_index.rs`, matching the central `NumericIndex` type and the surrounding module name. - Moved `point_ids_by_value` from `storage/statistics.rs` to `storage/mod.rs` next to `get_values`. It is an exact value->points lookup primitive, not a cardinality estimate; the statistics module is left to the histogram-driven helpers. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Merged
4 tasks done
…ception lint Clippy's module_inception rule disallows a module with the same name as its containing module. Rename numeric_index.rs -> index.rs and update the three internal references. Co-authored-by: Cursor <[email protected]>
qdrant-cloud-bot
force-pushed
the
refactor/split-numeric-index
branch
from
May 12, 2026 09:36
91533ac to
2735c68
Compare
…x and move special_check_condition per-variant (#8998) Two related cleanups that share a theme — drop enum-level read dispatch in favor of per-variant trait impls: 1. `NumericIndex<T, P>` now implements `PayloadFieldIndexRead` directly (forwarding to its inner storage enum). The four numeric arms in `FieldIndex`'s `impl PayloadFieldIndexRead` drop their `.inner()` calls, so all eleven variants now use a uniform `idx.<method>(...)` form. 2. `special_check_condition` moves from `FieldIndexRead` to `PayloadFieldIndexRead` with a default `Ok(None)` body. `FullTextIndex` (the only variant with non-trivial logic) overrides it. `NumericIndex<T, P>` forwards through to the inner enum, and the `FieldIndex` enum's match dispatch moves out of `FieldIndexRead` into `PayloadFieldIndexRead` for consistency with the other five trait methods. Removed the now-redundant declaration from `FieldIndexRead` (inherited via the supertrait). Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
generall
merged commit May 12, 2026
1c5ef05
into
refactor/field-index-read-supertrait
11 checks passed
generall
added a commit
that referenced
this pull request
May 12, 2026
…ldIndexRead (#8996) * refactor(field_index): make FieldIndexRead a supertrait of PayloadFieldIndexRead Removes the `get_payload_field_index_read() -> &dyn PayloadFieldIndexRead` bridge from `FieldIndexRead` and the five default impls that forwarded through it. The overlapping read methods now come from the supertrait directly, eliminating one layer of dynamic dispatch on the hot read path: `FieldIndex::filter` → variant match → concrete typed-index method. `FieldIndex` gains a direct `impl PayloadFieldIndexRead` block with per-method match arms, mirroring the existing dispatch shape used by `get_telemetry_data`, `values_count`, etc. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * chore: apply nightly rustfmt Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * refactor(numeric_index): split mod.rs into focused submodules (#8997) * refactor(numeric_index): split mod.rs into focused submodules `numeric_index/mod.rs` was 1308 lines mixing the storage-dispatch enum, the public `NumericIndex<T, P>` wrapper, three builders, per-(T, P) `ValueIndexer` impls, and the `Encodable`/`StreamRange` traits — hard to navigate. Split into: - `mod.rs` keeps the shared traits (`Encodable`, `StreamRange`), `Range<T>::as_index_key_bounds`, and re-exports. - `wrapper.rs` — `NumericIndex<T, P>` + inherent impl + `NumericIndexIntoInnerValue` trait. - `builders.rs` — `NumericIndexBuilder`, `NumericIndexMmapBuilder`, `NumericIndexGridstoreBuilder`. - `value_indexer.rs` — `ValueIndexer` and per-(T, P) `value_retriever` inherent impls. - `storage/` — the `NumericIndexInner` dispatch enum: - `storage/mod.rs` — enum + simple match-and-forward (constructors, lifecycle, telemetry, per-point access). - `storage/statistics.rs` — histogram-driven cardinality and point-count helpers. - `storage/trait_impls.rs` — `PayloadFieldIndex`, `PayloadFieldIndexRead`, `StreamRange` impls. Pure code reorganization — no behavior change. A few inherent methods on `NumericIndexInner` had to widen from private to `pub(super)` / `pub(in crate::index::field_index::numeric_index)` to remain reachable across the new module boundaries (and from `tests.rs`); the new constructors (`NumericIndexMmapBuilder::new`, `NumericIndexGridstoreBuilder::new`) replace direct field construction across files. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * refactor(numeric_index): rename wrapper.rs -> numeric_index.rs, move point_ids_by_value out of statistics - Renamed `wrapper.rs` to `numeric_index.rs`, matching the central `NumericIndex` type and the surrounding module name. - Moved `point_ids_by_value` from `storage/statistics.rs` to `storage/mod.rs` next to `get_values`. It is an exact value->points lookup primitive, not a cardinality estimate; the statistics module is left to the histogram-driven helpers. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix(clippy): rename numeric_index submodule to index to fix module_inception lint Clippy's module_inception rule disallows a module with the same name as its containing module. Rename numeric_index.rs -> index.rs and update the three internal references. Co-authored-by: Cursor <[email protected]> * refactor(field_index): push PayloadFieldIndexRead through NumericIndex and move special_check_condition per-variant (#8998) Two related cleanups that share a theme — drop enum-level read dispatch in favor of per-variant trait impls: 1. `NumericIndex<T, P>` now implements `PayloadFieldIndexRead` directly (forwarding to its inner storage enum). The four numeric arms in `FieldIndex`'s `impl PayloadFieldIndexRead` drop their `.inner()` calls, so all eleven variants now use a uniform `idx.<method>(...)` form. 2. `special_check_condition` moves from `FieldIndexRead` to `PayloadFieldIndexRead` with a default `Ok(None)` body. `FullTextIndex` (the only variant with non-trivial logic) overrides it. `NumericIndex<T, P>` forwards through to the inner enum, and the `FieldIndex` enum's match dispatch moves out of `FieldIndexRead` into `PayloadFieldIndexRead` for consistency with the other five trait methods. Removed the now-redundant declaration from `FieldIndexRead` (inherited via the supertrait). Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: Cursor <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: Cursor <[email protected]>
generall
added a commit
that referenced
this pull request
May 22, 2026
…ldIndexRead (#8996) * refactor(field_index): make FieldIndexRead a supertrait of PayloadFieldIndexRead Removes the `get_payload_field_index_read() -> &dyn PayloadFieldIndexRead` bridge from `FieldIndexRead` and the five default impls that forwarded through it. The overlapping read methods now come from the supertrait directly, eliminating one layer of dynamic dispatch on the hot read path: `FieldIndex::filter` → variant match → concrete typed-index method. `FieldIndex` gains a direct `impl PayloadFieldIndexRead` block with per-method match arms, mirroring the existing dispatch shape used by `get_telemetry_data`, `values_count`, etc. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * chore: apply nightly rustfmt Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * refactor(numeric_index): split mod.rs into focused submodules (#8997) * refactor(numeric_index): split mod.rs into focused submodules `numeric_index/mod.rs` was 1308 lines mixing the storage-dispatch enum, the public `NumericIndex<T, P>` wrapper, three builders, per-(T, P) `ValueIndexer` impls, and the `Encodable`/`StreamRange` traits — hard to navigate. Split into: - `mod.rs` keeps the shared traits (`Encodable`, `StreamRange`), `Range<T>::as_index_key_bounds`, and re-exports. - `wrapper.rs` — `NumericIndex<T, P>` + inherent impl + `NumericIndexIntoInnerValue` trait. - `builders.rs` — `NumericIndexBuilder`, `NumericIndexMmapBuilder`, `NumericIndexGridstoreBuilder`. - `value_indexer.rs` — `ValueIndexer` and per-(T, P) `value_retriever` inherent impls. - `storage/` — the `NumericIndexInner` dispatch enum: - `storage/mod.rs` — enum + simple match-and-forward (constructors, lifecycle, telemetry, per-point access). - `storage/statistics.rs` — histogram-driven cardinality and point-count helpers. - `storage/trait_impls.rs` — `PayloadFieldIndex`, `PayloadFieldIndexRead`, `StreamRange` impls. Pure code reorganization — no behavior change. A few inherent methods on `NumericIndexInner` had to widen from private to `pub(super)` / `pub(in crate::index::field_index::numeric_index)` to remain reachable across the new module boundaries (and from `tests.rs`); the new constructors (`NumericIndexMmapBuilder::new`, `NumericIndexGridstoreBuilder::new`) replace direct field construction across files. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * refactor(numeric_index): rename wrapper.rs -> numeric_index.rs, move point_ids_by_value out of statistics - Renamed `wrapper.rs` to `numeric_index.rs`, matching the central `NumericIndex` type and the surrounding module name. - Moved `point_ids_by_value` from `storage/statistics.rs` to `storage/mod.rs` next to `get_values`. It is an exact value->points lookup primitive, not a cardinality estimate; the statistics module is left to the histogram-driven helpers. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix(clippy): rename numeric_index submodule to index to fix module_inception lint Clippy's module_inception rule disallows a module with the same name as its containing module. Rename numeric_index.rs -> index.rs and update the three internal references. Co-authored-by: Cursor <[email protected]> * refactor(field_index): push PayloadFieldIndexRead through NumericIndex and move special_check_condition per-variant (#8998) Two related cleanups that share a theme — drop enum-level read dispatch in favor of per-variant trait impls: 1. `NumericIndex<T, P>` now implements `PayloadFieldIndexRead` directly (forwarding to its inner storage enum). The four numeric arms in `FieldIndex`'s `impl PayloadFieldIndexRead` drop their `.inner()` calls, so all eleven variants now use a uniform `idx.<method>(...)` form. 2. `special_check_condition` moves from `FieldIndexRead` to `PayloadFieldIndexRead` with a default `Ok(None)` body. `FullTextIndex` (the only variant with non-trivial logic) overrides it. `NumericIndex<T, P>` forwards through to the inner enum, and the `FieldIndex` enum's match dispatch moves out of `FieldIndexRead` into `PayloadFieldIndexRead` for consistency with the other five trait methods. Removed the now-redundant declaration from `FieldIndexRead` (inherited via the supertrait). Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: Cursor <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: Cursor <[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.
Summary
Stacks on top of #8996.
numeric_index/mod.rswas 1308 lines mixing five different concerns; split into focused submodules:mod.rskeeps the shared traits (Encodable,StreamRange),Range<T>::as_index_key_bounds, constants, and re-exports.wrapper.rs—NumericIndex<T, P>+ inherent impl +NumericIndexIntoInnerValuetrait.builders.rs—NumericIndexBuilder,NumericIndexMmapBuilder,NumericIndexGridstoreBuilder.value_indexer.rs—ValueIndexerand per-(T, P)value_retrieverinherent impls.storage/(theNumericIndexInnerstorage-dispatch enum):storage/mod.rs— enum + simple match-and-forward (constructors, lifecycle, telemetry, per-point access).storage/statistics.rs— histogram-driven cardinality / point-count helpers (range_cardinality,estimate_points,point_ids_by_value).storage/trait_impls.rs—PayloadFieldIndex,PayloadFieldIndexRead,StreamRangeimpls.Notes
NumericIndexInnerwidened from private topub(super)/pub(in crate::index::field_index::numeric_index)to remain reachable across the new module boundaries (and fromtests.rs).NumericIndexMmapBuilder::new/NumericIndexGridstoreBuilder::newconstructors replace direct field construction across files.Test plan
🤖 Generated with Claude Code