fix(cli): load persisted index only when needed - #25
Merged
Merged
Conversation
Standalone reindex and stats commands construct a fresh SearchIndex. Initialize it before refreshing or reading stats so persisted files and chunks are available.
A full rebuild discards all loaded state, so initializing first only adds unnecessary memory and I/O. Keep initialization for incremental refreshes while avoiding the redundant load for --full.
JohnXu22786
marked this pull request as ready for review
September 12, 2026 11:17
JohnXu22786
deleted the
bug/cli-load-persisted-index-before-commands
branch
September 12, 2026 11:17
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 this PR does
Before this PR:
Standalone
reindexandstatscommands created a freshSearchIndexwithout loading persisted state. Incrementalreindextherefore rebuilt the workspace fully, whilestatsreported an empty in-memory index.After this PR:
Incremental
reindexandstatsload persisted state before operating.reindex --fullskips initialization because the full rebuild discards the loaded state, avoiding redundant memory and I/O. Focused CLI regressions cover persisted refresh/stat reporting and the full-rebuild initialization guard.Type of change
Bug fix
Breaking changes (if any)
None.