Return statistics about the content index. Returns `None` if the index does not exist or cannot be opened.
(repo_root: &Path)
| 334 | /// |
| 335 | /// Returns `None` if the index does not exist or cannot be opened. |
| 336 | pub fn content_index_stats(repo_root: &Path) -> Option<ContentIndexStats> { |
| 337 | let config = content_config(repo_root); |
| 338 | let index = Index::open(config).ok()?; |
| 339 | let stats = index.stats(); |
| 340 | Some(ContentIndexStats { |
| 341 | total_documents: stats.total_documents, |
| 342 | total_segments: stats.total_segments, |
| 343 | total_grams: stats.total_grams, |
| 344 | index_size_bytes: stats.index_size_bytes, |
| 345 | overlay_generations: stats.overlay_generations, |
| 346 | pending_edits: stats.pending_edits, |
| 347 | }) |
| 348 | } |
| 349 | |
| 350 | fn content_config(repo_root: &Path) -> Config { |
| 351 | Config { |