pub struct Files { /* private fields */ }Expand description
File search backed by a private plocate database.
Implementations§
Source§impl Files
impl Files
Sourcepub fn new(config: Config) -> Option<Self>
pub fn new(config: Config) -> Option<Self>
Build a searcher for config.
Returns None when file search is disabled, or when no XDG data
directory is available to hold the index.
Sourcepub fn needs_refresh(&self) -> bool
pub fn needs_refresh(&self) -> bool
Whether the index is missing or older than the refresh interval.
Sourcepub async fn rebuild(&mut self)
pub async fn rebuild(&mut self)
Rebuild the index.
Runs updatedb per root. This takes seconds for a home directory and
minutes for a multi-terabyte drive, so it is never called on the
interactive path — the caller schedules it.
Sourcepub async fn search(&self, query: &str) -> Vec<Item>
pub async fn search(&self, query: &str) -> Vec<Item>
Search the index and return ranked results.
Sourcepub async fn content_candidates(&self, extensions: &[String]) -> Vec<PathBuf>
pub async fn content_candidates(&self, extensions: &[String]) -> Vec<PathBuf>
Paths worth handing to the content indexer.
Enumerated from the path index rather than by walking the tree again:
updatedb already did that walk, and asking plocate for one extension
at a time is both faster and automatically consistent with whatever the
index excludes.