feat(stats): ripgrep-style --stats (matches, files, bytes, elapsed)#5
Merged
feat(stats): ripgrep-style --stats (matches, files, bytes, elapsed)#5
Conversation
- Add SearchStats.bytes_searched (sum of metadata len per candidate) - sum_candidate_file_bytes in execute for index and walk paths - CLI --stats prints bytes line before elapsed - integration_stats asserts bytes line; matrix notes rg parity not guaranteed
Wire files_with_matches and bytes_printed through index and walk search paths (parallel and capped workers). Add StatsCollection to keep execute helpers within clippy limits. Extend CLI stderr output and integration test; refresh rg compat matrix for --stats.
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
Completes
--stats/SearchStatstoward ripgrep-style reporting:matches: mode-dependent tally (unchanged semantics).files_with_matches: files that had a positive hit for the current mode (seeSearchStatsdocs;--files-without-matchkeeps this at 0).files_searched: candidate count after filtering.bytes_printed: bytes written to stdout (including heading separators between chunks).bytes_searched: sum ofstd::fs::metadata().len()per candidate (approximates rg).elapsed: wall time for the search phase.Core
StandardWorker/SummaryWorkerand capped sequential paths).StatsCollectionbundles optional atomics to satisfy clippy without sprawl.CLI
Stderr lines (order aligned with rg): matches → files contained matches → files searched → bytes printed → bytes searched → elapsed.
Tests / docs
crates/cli/tests/integration_stats.rsupdated.docs/rg-compat-matrix.md--statsrow updated.Validation
cargo fmt --check,cargo clippy -D warnings,cargo test --workspace --all-features