Skip to content

[UIO] More read_json_via - #9270

Merged
coszio merged 4 commits into
devfrom
more-read-json-via
Jun 2, 2026
Merged

coszio merged 4 commits into
devfrom
more-read-json-via

Conversation

@coszio

@coszio coszio commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Cleans up more places where we were using plain read_json(..), and swaps to use read_json_via(..).

Additionally handles the NotFound case with universal io for:

  • mmap numeric index
  • mmap geo index
  • hnsw config
  • mmap full-text postings

@coszio coszio added this to the Universal IO milestone Jun 2, 2026
@coszio
coszio requested review from dancixx, ffuugoo, generall and xzfc June 2, 2026 16:28
@coderabbitai

coderabbitai Bot commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 6e62b781-76b6-4c05-9efe-63e771bf0b61

📥 Commits

Reviewing files that changed from the base of the PR and between 46844ab and 83c8965.

📒 Files selected for processing (6)
  • lib/segment/src/index/field_index/full_text_index/inverted_index/mmap_inverted_index/mod.rs
  • lib/segment/src/index/field_index/full_text_index/inverted_index/mmap_inverted_index/uio_postings.rs
  • lib/segment/src/index/field_index/geo_index/mmap_geo_index/lifecycle.rs
  • lib/segment/src/index/field_index/numeric_index/universal_numeric_index/lifecycle.rs
  • lib/segment/src/index/hnsw_index/config.rs
  • lib/segment/src/index/hnsw_index/hnsw.rs

📝 Walkthrough

Walkthrough

This PR standardizes missing-file detection across six index types by replacing upfront filesystem checks (is_file()/exists()) with error-driven open/read operations that return Ok(None) when files are missing. The pattern uses the OkNotFound trait and ok_not_found() helper from common::universal_io. Key changes include: UniversalPostings::open returns Option, HnswGraphConfig gains a new load_via method, MmapInvertedIndex and HNSWIndex adopt these new APIs, and geo/numeric indices use read_json_via with ok_not_found(). All changes maintain existing functional behavior while centralizing missing-file handling semantics.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • [Universal IO] Tracking issue #8630: The PR directly implements the UniversalReadFs migration pattern tracked in this issue—changing multiple index loaders (UniversalPostings, HnswGraphConfig, numeric/geo indices) to use read_json_via and treat missing files as Ok(None) rather than filesystem pre-checks.

Possibly related PRs

  • qdrant/qdrant#9234: Both modify UniversalNumericIndex::open config loading in lib/segment/src/index/field_index/numeric_index/universal_numeric_index/lifecycle.rs to use read_json_via(...).ok_not_found()? for missing-file handling.
  • qdrant/qdrant#8961: Both directly refactor UniversalPostings::open in lib/segment/src/index/field_index/full_text_index/inverted_index/mmap_inverted_index/uio_postings.rs—this PR changes the return type to Option and missing-file semantics.
  • qdrant/qdrant#9223: Both replace is_file()/exists() pre-checks with error-driven ok_not_found()-style missing-file detection across multiple index and config loaders.

Suggested reviewers

  • generall
  • ffuugoo

🐰 Hops through indices with glee,
No more is_file() checks to see,
Just Ok(None) flows,
When the data ghost shows,
Universal reads set configs free! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title '[UIO] More read_json_via' accurately captures the main change: expanding the use of read_json_via across multiple index components.
Description check ✅ Passed The description clearly explains the changeset: replacing read_json with read_json_via and handling NotFound cases for specific index components.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coszio
coszio merged commit c073fe3 into dev Jun 2, 2026
20 of 21 checks passed
@coszio
coszio deleted the more-read-json-via branch June 2, 2026 17:14
timvisee pushed a commit that referenced this pull request Jun 3, 2026
@xzfc xzfc mentioned this pull request Jun 3, 2026
34 of 36 tasks
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