pub struct Session {
pub id: Uuid,
/* private fields */
}Expand description
Session for managing multiple documents.
Provides automatic caching of document trees and cross-document operations.
Fields§
§id: UuidSession ID.
Implementations§
Source§impl Session
impl Session
Sourcepub fn with_config(self, config: SessionConfig) -> Self
pub fn with_config(self, config: SessionConfig) -> Self
Create with configuration.
Sourcepub async fn index(&self, path: impl AsRef<Path>) -> Result<String>
pub async fn index(&self, path: impl AsRef<Path>) -> Result<String>
Index a document into this session.
The document is indexed, saved to workspace, and cached in this session.
Sourcepub async fn index_with_options(
&self,
path: impl AsRef<Path>,
options: IndexOptions,
) -> Result<String>
pub async fn index_with_options( &self, path: impl AsRef<Path>, options: IndexOptions, ) -> Result<String>
Index a document with options.
Sourcepub async fn query(&self, doc_id: &str, question: &str) -> Result<QueryResult>
pub async fn query(&self, doc_id: &str, question: &str) -> Result<QueryResult>
Query a document within this session.
Uses the cached tree if available, otherwise loads from workspace.
Sourcepub async fn query_with_options(
&self,
doc_id: &str,
question: &str,
options: RetrieveOptions,
) -> Result<QueryResult>
pub async fn query_with_options( &self, doc_id: &str, question: &str, options: RetrieveOptions, ) -> Result<QueryResult>
Query a document with options.
Sourcepub async fn query_all(&self, question: &str) -> Result<Vec<QueryResult>>
pub async fn query_all(&self, question: &str) -> Result<Vec<QueryResult>>
Query across all documents in this session.
Searches each document and merges results.
Sourcepub async fn query_all_with_options(
&self,
question: &str,
options: RetrieveOptions,
) -> Result<Vec<QueryResult>>
pub async fn query_all_with_options( &self, question: &str, options: RetrieveOptions, ) -> Result<Vec<QueryResult>>
Query across all documents with options.
Sourcepub fn list_documents(&self) -> Vec<DocumentInfo>
pub fn list_documents(&self) -> Vec<DocumentInfo>
Get list of documents in this session.
Sourcepub async fn get_tree(&self, doc_id: &str) -> Result<DocumentTree>
pub async fn get_tree(&self, doc_id: &str) -> Result<DocumentTree>
Get a document tree (from cache or workspace).
Sourcepub async fn preload(&self, doc_ids: &[&str]) -> Result<usize>
pub async fn preload(&self, doc_ids: &[&str]) -> Result<usize>
Preload documents into the session cache.
Useful for warming up the cache before querying.
Sourcepub fn remove_document(&self, doc_id: &str) -> bool
pub fn remove_document(&self, doc_id: &str) -> bool
Remove a document from the session.
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clear all documents from the session cache.
Sourcepub fn stats(&self) -> SessionStats
pub fn stats(&self) -> SessionStats
Get session statistics.
Sourcepub fn cached_count(&self) -> usize
pub fn cached_count(&self) -> usize
Get the number of cached documents.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Session
impl !RefUnwindSafe for Session
impl Send for Session
impl !Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
impl !UnwindSafe for Session
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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