pub struct Indexes { /* private fields */ }Expand description
Registry of opened indexes read from a snapshot store.
Opens all index kinds found in the current snapshot and provides query-time candidate narrowing by intersecting results from each index. Multiple indexes together produce tighter narrowing than any single index alone.
Owns a [Snapshot] that holds a reader lease, preventing the snapshot
from being garbage-collected while searches are active.
Implementations§
Source§impl Indexes
impl Indexes
Sourcepub fn from_single(index: Index, root: PathBuf) -> Self
pub fn from_single(index: Index, root: PathBuf) -> Self
Create an Indexes registry from a single index and its root.
Useful for testing and benchmarking.
Sourcepub fn open(sift_dir: &Path) -> Result<Self, IndexError>
pub fn open(sift_dir: &Path) -> Result<Self, IndexError>
Open all indexes found under sift_dir.
§Errors
Returns IndexError::InvalidManifest if a snapshot manifest is
malformed, or IndexError::Trigram if a trigram index is malformed.
Returns an empty registry if no current snapshot exists (walk fallback).
pub const fn is_empty(&self) -> bool
pub fn root(&self) -> &Path
Sourcepub fn candidates(&self, query: &QuerySpec<'_>) -> Option<Vec<Candidate>>
pub fn candidates(&self, query: &QuerySpec<'_>) -> Option<Vec<Candidate>>
Produce narrowed candidates from all indexes that can narrow the query.
Returns None if no index could narrow. When at least one index
narrows, all narrowed candidate sets are intersected.
Sourcepub fn indexed_rel_paths(&self) -> HashSet<PathBuf>
pub fn indexed_rel_paths(&self) -> HashSet<PathBuf>
Corpus-relative paths present in the current snapshot.
Sourcepub fn unindexed_hits(
&self,
hits: impl IntoIterator<Item = PathBuf>,
) -> Vec<PathBuf>
pub fn unindexed_hits( &self, hits: impl IntoIterator<Item = PathBuf>, ) -> Vec<PathBuf>
Corpus-relative search hits not yet present in the current snapshot.
pub fn first(&self) -> Option<&Index>
pub fn corpus_kind(&self) -> Option<CorpusKind>
Auto Trait Implementations§
impl Freeze for Indexes
impl RefUnwindSafe for Indexes
impl Send for Indexes
impl Sync for Indexes
impl Unpin for Indexes
impl UnsafeUnpin for Indexes
impl UnwindSafe for Indexes
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more