pub struct Index {
pub root: PathBuf,
pub files: Vec<PathBuf>,
pub lexicon: Vec<LexiconEntry>,
pub postings: Vec<u8>,
pub index_dir: Option<PathBuf>,
}Fields§
§root: PathBuf§files: Vec<PathBuf>§lexicon: Vec<LexiconEntry>§postings: Vec<u8>§index_dir: Option<PathBuf>Implementations§
Source§impl Index
impl Index
pub const fn new( root: PathBuf, files: Vec<PathBuf>, lexicon: Vec<LexiconEntry>, postings: Vec<u8>, ) -> Self
Sourcepub fn open(path: &Path) -> Result<Self>
pub fn open(path: &Path) -> Result<Self>
Open an index directory produced by IndexBuilder::build.
§Errors
Returns crate::Error::MissingMeta if sift.meta is absent,
crate::Error::InvalidMeta if metadata is empty or malformed,
crate::Error::MissingComponent if a trigram table file is missing,
or crate::Error::Io on read failure.
Sourcepub fn save_to_dir(&self, dir: &Path) -> Result<()>
pub fn save_to_dir(&self, dir: &Path) -> Result<()>
Persist the in-memory index to dir.
§Errors
Propagates IO errors from creating directories or writing files.
pub fn index_dir(&self) -> Option<&Path>
pub fn explain(&self, pattern: &str) -> QueryPlan
pub fn posting_bytes_slice(&self, tri: [u8; 3]) -> &[u8] ⓘ
pub fn posting_list_for_trigram(&self, tri: [u8; 3]) -> Vec<u32>
pub fn candidate_file_ids(&self, arms: &[Vec<[u8; 3]>]) -> Vec<u32>
pub fn candidate_paths(&self, arms: &[Vec<[u8; 3]>]) -> Vec<PathBuf>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Index
impl RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnsafeUnpin for Index
impl UnwindSafe for Index
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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