pub struct DocumentStore { /* private fields */ }Expand description
SQLite-backed document metadata store.
Implementations§
Source§impl DocumentStore
impl DocumentStore
Sourcepub fn new(db_path: &Path) -> Result<Self, FetchiumError>
pub fn new(db_path: &Path) -> Result<Self, FetchiumError>
Open or create the store at db_path.
Sourcepub fn upsert(
&self,
doc: &IndexedDocument,
) -> Result<(u64, bool), FetchiumError>
pub fn upsert( &self, doc: &IndexedDocument, ) -> Result<(u64, bool), FetchiumError>
Insert or update a document. Returns (id, is_new_or_changed).
Sourcepub fn get_by_id(
&self,
id: u64,
) -> Result<Option<IndexedDocument>, FetchiumError>
pub fn get_by_id( &self, id: u64, ) -> Result<Option<IndexedDocument>, FetchiumError>
Load a document by ID.
Sourcepub fn get_by_ids(
&self,
ids: &[u64],
) -> Result<Vec<IndexedDocument>, FetchiumError>
pub fn get_by_ids( &self, ids: &[u64], ) -> Result<Vec<IndexedDocument>, FetchiumError>
Load multiple documents by their IDs.
Sourcepub fn documents_without_embeddings(
&self,
) -> Result<Vec<IndexedDocument>, FetchiumError>
pub fn documents_without_embeddings( &self, ) -> Result<Vec<IndexedDocument>, FetchiumError>
Return all documents that don’t yet have embeddings.
Sourcepub fn mark_embedded(&self, id: u64) -> Result<(), FetchiumError>
pub fn mark_embedded(&self, id: u64) -> Result<(), FetchiumError>
Mark a document as having an embedding.
Sourcepub fn stats(&self) -> Result<IndexStats, FetchiumError>
pub fn stats(&self) -> Result<IndexStats, FetchiumError>
Return index statistics.
Sourcepub fn search(
&self,
query: &str,
limit: usize,
) -> Result<Vec<IndexedDocument>, FetchiumError>
pub fn search( &self, query: &str, limit: usize, ) -> Result<Vec<IndexedDocument>, FetchiumError>
Full-text search using SQL LIKE against title and content.
Returns up to limit documents ordered by insertion time (newest first).
Sourcepub fn clear(&self) -> Result<usize, FetchiumError>
pub fn clear(&self) -> Result<usize, FetchiumError>
Delete all documents from the store. Returns the number of rows removed.
Sourcepub fn content_hash(content: &str) -> String
pub fn content_hash(content: &str) -> String
Compute SHA-256 hex digest of content.
Auto Trait Implementations§
impl !Freeze for DocumentStore
impl RefUnwindSafe for DocumentStore
impl Send for DocumentStore
impl Sync for DocumentStore
impl Unpin for DocumentStore
impl UnsafeUnpin for DocumentStore
impl UnwindSafe for DocumentStore
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
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 more