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)
| 25 | /// a stale-check rebuild. Otherwise the existing index is returned as-is. |
| 26 | /// For finer-grained incremental updates, use [`notify_and_commit`]. |
| 27 | pub fn update_content_index(repo_root: &Path) -> Result<(), ContentSearchError> { |
| 28 | let config = content_config(repo_root); |
| 29 | let index = Index::open(config)?; |
| 30 | // rebuild_if_stale returns Ok(Some(stats)) when a rebuild happened, |
| 31 | // Ok(None) when the index was already current. |
| 32 | let _stats = index.rebuild_if_stale()?; |
| 33 | Ok(()) |
| 34 | } |
| 35 | |
| 36 | /// Notify the index about a single changed file and commit immediately. |
| 37 | /// |