Incrementally update the content index after file changes. If the repository HEAD has moved since the last full build, this performs a stale-check rebuild. Otherwise the existing index is returned as-is. For finer-grained incremental updates, use [`notify_and_commit`].
(repo_root: &Path)
| 52 | /// a stale-check rebuild. Otherwise the existing index is returned as-is. |
| 53 | /// For finer-grained incremental updates, use [`notify_and_commit`]. |
| 54 | pub fn update_content_index(repo_root: &Path) -> Result<(), ContentSearchError> { |
| 55 | let config = content_config(repo_root); |
| 56 | let index = Index::open(config)?; |
| 57 | // rebuild_if_stale returns Ok(Some(stats)) when a rebuild happened, |
| 58 | // Ok(None) when the index was already current. |
| 59 | let _stats = index.rebuild_if_stale()?; |
| 60 | Ok(()) |
| 61 | } |
| 62 | |
| 63 | /// Notify the index about a single changed file and commit immediately. |
| 64 | /// |