pub struct MemoryDocumentStore { /* private fields */ }Implementations§
Source§impl MemoryDocumentStore
impl MemoryDocumentStore
Sourcepub fn new(
dimensions: usize,
embedding_dimensions: Option<usize>,
) -> Result<Self>
pub fn new( dimensions: usize, embedding_dimensions: Option<usize>, ) -> Result<Self>
dimensions is the sparse text-vector dimension; embedding_dimensions enables
caller-supplied dense embeddings for semantic and hybrid search.
pub fn dimensions(&self) -> usize
pub fn embedding_dimensions(&self) -> Option<usize>
Sourcepub fn memorize(&mut self, input: DocumentInput) -> Result<u32>
pub fn memorize(&mut self, input: DocumentInput) -> Result<u32>
Stores or replaces a document and returns its chunk count.
Sourcepub fn memorize_many(&mut self, inputs: Vec<DocumentInput>) -> Result<Vec<u32>>
pub fn memorize_many(&mut self, inputs: Vec<DocumentInput>) -> Result<Vec<u32>>
Stores or replaces several documents; either all are stored or none is.
pub fn search( &self, text: &str, options: &SearchOptions, ) -> Result<Vec<DocumentResult>>
pub fn contains(&self, id: &str) -> bool
Sourcepub fn train_index(&mut self) -> Result<bool>
pub fn train_index(&mut self) -> Result<bool>
Builds the dense index over the stored embeddings. A store with no embedding space or too few embedded chunks is left as it is; returns whether an index is now current.
pub fn index_trained(&self) -> bool
pub fn stats(&self) -> MemoryStoreStats
Sourcepub fn export(&self) -> Result<Vec<u8>>
pub fn export(&self) -> Result<Vec<u8>>
Serializes the store: a checksummed header and an LZ4-compressed JSON payload.
Sourcepub fn import(bytes: &[u8]) -> Result<Self>
pub fn import(bytes: &[u8]) -> Result<Self>
Restores a store written by MemoryDocumentStore::export. The bytes are validated
(magic, version, bounded length, checksum, per-document shape) before any is used.
Auto Trait Implementations§
impl !Freeze for MemoryDocumentStore
impl RefUnwindSafe for MemoryDocumentStore
impl Send for MemoryDocumentStore
impl Sync for MemoryDocumentStore
impl Unpin for MemoryDocumentStore
impl UnsafeUnpin for MemoryDocumentStore
impl UnwindSafe for MemoryDocumentStore
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.