Skip to content

[AI] Implement read-only PayloadFieldIndexRead / FieldIndexRead - #9026

Merged
generall merged 1 commit into
read-only-map-indexfrom
read-only-payload-field-index
May 13, 2026
Merged

generall merged 1 commit into
read-only-map-indexfrom
read-only-payload-field-index

Conversation

@generall

Copy link
Copy Markdown
Member

Summary

Wires ReadOnlyFieldIndex into the read-only field-index surface that ReadOnlyMapIndex and ReadOnlyNullIndex already provide, sharing the non-trivial bodies with the existing MapIndex impls — zero body duplication between the writable and read-only paths.

  • Per-N PayloadFieldIndexRead bodies extracted in payload_index_impl/{str,int,uuid}.rs to free functions over T: MapIndexRead<N> (filter_impl, estimate_cardinality_impl, for_each_payload_block_impl, condition_checker_impl). Both MapIndex<N> and ReadOnlyMapIndex<N, S> impl PayloadFieldIndexRead via thin delegation to those bodies.
  • value_retriever lifted in value_indexer_impl.rs the same way (value_retriever_str/int/uuid); ReadOnlyMapIndex<N, S> gets the per-K closure for free.
  • Telemetry on MapIndexRead: added telemetry_index_type (required) + get_telemetry_data (default), mirroring the NullIndexRead pattern. Every map-index variant now reports telemetry without an inherent method on the enum.
  • FacetIndex for ReadOnlyMapIndex<N, S> added; FacetIndexEnum extended with S: UniversalRead = MmapFile plus three new variants (KeywordReadOnly, IntReadOnly, UuidReadOnly). FieldIndex::as_facet_index pins S = MmapFile via turbofish since the unused-by-this-variant generic is otherwise ambiguous.
  • ReadOnlyFieldIndex::as_numeric returns None — no concrete read-only numeric type exists yet (the existing NumericFieldIndexRead doc already notes this is intended for a future ReadOnlySegment).
  • MapIndexRead + its module promoted to pub so field_index_base/read_only/ can name them.

Test plan

  • cargo check -p segment --lib --tests
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test -p segment --lib field_index:: — 252/252 pass

Wires `ReadOnlyFieldIndex` into the read-only field-index surface that
`ReadOnlyMapIndex` and `ReadOnlyNullIndex` already provide, sharing the
non-trivial bodies with the existing `MapIndex` impls.

- Extracted per-`N` `PayloadFieldIndexRead` bodies (filter,
  estimate_cardinality, for_each_payload_block, condition_checker) in
  `payload_index_impl/{str,int,uuid}.rs` into free functions over
  `T: MapIndexRead<N>`. Both `MapIndex<N>` and `ReadOnlyMapIndex<N, S>`
  now impl `PayloadFieldIndexRead` via thin delegation to those bodies.
- Lifted `value_retriever` bodies in `value_indexer_impl.rs` the same
  way; `ReadOnlyMapIndex<N, S>` gets the per-K closure for free.
- Added `telemetry_index_type` (required) + `get_telemetry_data`
  (default) to `MapIndexRead`, mirroring the `NullIndexRead` pattern;
  every map-index variant now reports telemetry without an inherent
  method on the enum.
- Promoted `MapIndexRead` + its module to `pub` so
  `field_index_base/read_only/` can name them.
- Implemented `FacetIndex for ReadOnlyMapIndex<N, S>` and extended
  `FacetIndexEnum` with `S: UniversalRead = MmapFile` plus the three
  read-only variants. `FieldIndex::as_facet_index` pins
  `S = MmapFile` via turbofish to keep inference happy.
- `ReadOnlyFieldIndex::as_numeric` returns `None` for now; no concrete
  read-only numeric type exists yet (the doc on `NumericFieldIndexRead`
  already notes this is intended for a future `ReadOnlySegment`).
@generall
generall requested a review from dancixx May 12, 2026 22:25
@generall
generall merged commit 8c20284 into read-only-map-index May 13, 2026
14 checks passed
@generall
generall deleted the read-only-payload-field-index branch May 13, 2026 10:02
generall added a commit that referenced this pull request May 13, 2026
* rename mmap -> universal

* [AI] Introduce `ReadOnlyMapIndex` and implement `MapIndexRead` for it

* add missing file

* [AI] Implement read-only PayloadFieldIndexRead / FieldIndexRead (#9026)

Wires `ReadOnlyFieldIndex` into the read-only field-index surface that
`ReadOnlyMapIndex` and `ReadOnlyNullIndex` already provide, sharing the
non-trivial bodies with the existing `MapIndex` impls.

- Extracted per-`N` `PayloadFieldIndexRead` bodies (filter,
  estimate_cardinality, for_each_payload_block, condition_checker) in
  `payload_index_impl/{str,int,uuid}.rs` into free functions over
  `T: MapIndexRead<N>`. Both `MapIndex<N>` and `ReadOnlyMapIndex<N, S>`
  now impl `PayloadFieldIndexRead` via thin delegation to those bodies.
- Lifted `value_retriever` bodies in `value_indexer_impl.rs` the same
  way; `ReadOnlyMapIndex<N, S>` gets the per-K closure for free.
- Added `telemetry_index_type` (required) + `get_telemetry_data`
  (default) to `MapIndexRead`, mirroring the `NullIndexRead` pattern;
  every map-index variant now reports telemetry without an inherent
  method on the enum.
- Promoted `MapIndexRead` + its module to `pub` so
  `field_index_base/read_only/` can name them.
- Implemented `FacetIndex for ReadOnlyMapIndex<N, S>` and extended
  `FacetIndexEnum` with `S: UniversalRead = MmapFile` plus the three
  read-only variants. `FieldIndex::as_facet_index` pins
  `S = MmapFile` via turbofish to keep inference happy.
- `ReadOnlyFieldIndex::as_numeric` returns `None` for now; no concrete
  read-only numeric type exists yet (the doc on `NumericFieldIndexRead`
  already notes this is intended for a future `ReadOnlySegment`).
generall added a commit that referenced this pull request May 22, 2026
* rename mmap -> universal

* [AI] Introduce `ReadOnlyMapIndex` and implement `MapIndexRead` for it

* add missing file

* [AI] Implement read-only PayloadFieldIndexRead / FieldIndexRead (#9026)

Wires `ReadOnlyFieldIndex` into the read-only field-index surface that
`ReadOnlyMapIndex` and `ReadOnlyNullIndex` already provide, sharing the
non-trivial bodies with the existing `MapIndex` impls.

- Extracted per-`N` `PayloadFieldIndexRead` bodies (filter,
  estimate_cardinality, for_each_payload_block, condition_checker) in
  `payload_index_impl/{str,int,uuid}.rs` into free functions over
  `T: MapIndexRead<N>`. Both `MapIndex<N>` and `ReadOnlyMapIndex<N, S>`
  now impl `PayloadFieldIndexRead` via thin delegation to those bodies.
- Lifted `value_retriever` bodies in `value_indexer_impl.rs` the same
  way; `ReadOnlyMapIndex<N, S>` gets the per-K closure for free.
- Added `telemetry_index_type` (required) + `get_telemetry_data`
  (default) to `MapIndexRead`, mirroring the `NullIndexRead` pattern;
  every map-index variant now reports telemetry without an inherent
  method on the enum.
- Promoted `MapIndexRead` + its module to `pub` so
  `field_index_base/read_only/` can name them.
- Implemented `FacetIndex for ReadOnlyMapIndex<N, S>` and extended
  `FacetIndexEnum` with `S: UniversalRead = MmapFile` plus the three
  read-only variants. `FieldIndex::as_facet_index` pins
  `S = MmapFile` via turbofish to keep inference happy.
- `ReadOnlyFieldIndex::as_numeric` returns `None` for now; no concrete
  read-only numeric type exists yet (the doc on `NumericFieldIndexRead`
  already notes this is intended for a future `ReadOnlySegment`).
@generall generall added this to the Live-reload milestone May 30, 2026
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.

2 participants