Return statistics about the content index. Returns `None` if the index does not exist or cannot be opened.
(repo_root: &Path)
| 223 | /// |
| 224 | /// Returns `None` if the index does not exist or cannot be opened. |
| 225 | pub fn content_index_stats(repo_root: &Path) -> Option<ContentIndexStats> { |
| 226 | let config = content_config(repo_root); |
| 227 | let index = Index::open(config).ok()?; |
| 228 | let stats = index.stats(); |
| 229 | Some(ContentIndexStats { |
| 230 | total_documents: stats.total_documents, |
| 231 | total_segments: stats.total_segments, |
| 232 | total_grams: stats.total_grams, |
| 233 | index_size_bytes: stats.index_size_bytes, |
| 234 | overlay_generations: stats.overlay_generations, |
| 235 | pending_edits: stats.pending_edits, |
| 236 | }) |
| 237 | } |
| 238 | |
| 239 | fn content_config(repo_root: &Path) -> Config { |
| 240 | Config { |
no test coverage detected