pub struct Engine { /* private fields */ }Expand description
The main semantic search engine.
Implementations§
Source§impl Engine
impl Engine
Sourcepub fn new(config: EngineConfig) -> Result<Self>
pub fn new(config: EngineConfig) -> Result<Self>
Create a new engine with hash-based embeddings (for testing).
Sourcepub fn with_embedder<E: Embedder + 'static>(
config: EngineConfig,
embedder: E,
) -> Result<Self>
pub fn with_embedder<E: Embedder + 'static>( config: EngineConfig, embedder: E, ) -> Result<Self>
Create an engine with a custom embedder (e.g., ONNX model).
Sourcepub fn config(&self) -> &EngineConfig
pub fn config(&self) -> &EngineConfig
Get the engine configuration.
Sourcepub async fn index_workspace(
&self,
workspace_config: WorkspaceConfig,
progress: Option<Box<dyn Fn(IndexProgress) + Send + Sync>>,
) -> Result<WorkspaceId>
pub async fn index_workspace( &self, workspace_config: WorkspaceConfig, progress: Option<Box<dyn Fn(IndexProgress) + Send + Sync>>, ) -> Result<WorkspaceId>
Index a workspace with an auto-generated ID.
Sourcepub async fn index_workspace_with_id(
&self,
workspace_config: WorkspaceConfig,
workspace_id: Option<WorkspaceId>,
progress: Option<Box<dyn Fn(IndexProgress) + Send + Sync>>,
) -> Result<WorkspaceId>
pub async fn index_workspace_with_id( &self, workspace_config: WorkspaceConfig, workspace_id: Option<WorkspaceId>, progress: Option<Box<dyn Fn(IndexProgress) + Send + Sync>>, ) -> Result<WorkspaceId>
Index a workspace with an optional custom ID.
If workspace_id is None, a new UUID will be generated.
If workspace_id is Some, the provided ID will be used (useful for re-indexing).
Sourcepub fn load_workspace(&self, workspace_id: &WorkspaceId) -> Result<()>
pub fn load_workspace(&self, workspace_id: &WorkspaceId) -> Result<()>
Load an existing workspace index.
Sourcepub fn search(
&self,
workspace_id: &WorkspaceId,
query: SearchQuery,
) -> Result<Vec<SearchResult>>
pub fn search( &self, workspace_id: &WorkspaceId, query: SearchQuery, ) -> Result<Vec<SearchResult>>
Search for code across a workspace.
Sourcepub fn search_text(
&self,
workspace_id: &WorkspaceId,
text: &str,
) -> Result<Vec<SearchResult>>
pub fn search_text( &self, workspace_id: &WorkspaceId, text: &str, ) -> Result<Vec<SearchResult>>
Search with a simple text query.
Sourcepub fn delete_workspace(&self, workspace_id: &WorkspaceId) -> Result<()>
pub fn delete_workspace(&self, workspace_id: &WorkspaceId) -> Result<()>
Delete a workspace and all its data.
Sourcepub fn list_workspaces(&self) -> Result<Vec<WorkspaceId>>
pub fn list_workspaces(&self) -> Result<Vec<WorkspaceId>>
List all indexed workspaces.
Sourcepub fn get_workspace_stats(
&self,
workspace_id: &WorkspaceId,
) -> Result<WorkspaceStats>
pub fn get_workspace_stats( &self, workspace_id: &WorkspaceId, ) -> Result<WorkspaceStats>
Get statistics for a workspace.
Sourcepub fn find_workspace_by_path(
&self,
root_path: &Path,
) -> Result<Option<WorkspaceId>>
pub fn find_workspace_by_path( &self, root_path: &Path, ) -> Result<Option<WorkspaceId>>
Find a workspace by its root path. Returns the workspace ID if found, None otherwise.
Sourcepub async fn index_or_reindex_workspace(
&self,
workspace_config: WorkspaceConfig,
progress: Option<Box<dyn Fn(IndexProgress) + Send + Sync>>,
) -> Result<WorkspaceId>
pub async fn index_or_reindex_workspace( &self, workspace_config: WorkspaceConfig, progress: Option<Box<dyn Fn(IndexProgress) + Send + Sync>>, ) -> Result<WorkspaceId>
Index or re-index a workspace by path. If the workspace was previously indexed, it will be deleted and re-indexed with the same ID.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Engine
impl !RefUnwindSafe for Engine
impl Unpin for Engine
impl !UnwindSafe for Engine
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> 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>
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>
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)
&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)
&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
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