pub struct Index { /* private fields */ }Expand description
A loaded search index: queryable, wasm-clean, fully read-only.
Implementations§
Source§impl Index
impl Index
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, IndexError>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, IndexError>
Decode an index blob. Total: malformed input yields a typed error, never a panic (the index is untrusted input, per the estate decoder pattern).
Sourcepub fn query(&self, query: &str, limit: usize) -> Vec<Hit>
pub fn query(&self, query: &str, limit: usize) -> Vec<Hit>
AND-query the index, ranked by BM25-shaped score (unit term
frequency), best first, at most limit hits.
A query term missing from the dictionary yields no hits (AND semantics). Corrupt postings for a queried term also yield no hits: query is a read path and reports emptiness rather than erroring.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Index
impl Freeze for Index
impl Move 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