pub struct Workspace { /* private fields */ }Expand description
High-level workspace for indexing and searching
Implementations§
Source§impl Workspace
impl Workspace
Sourcepub fn open_with_config(root: &Path, config: Config) -> Result<Self>
pub fn open_with_config(root: &Path, config: Config) -> Result<Self>
Open an existing workspace with custom config (fails if not indexed)
Sourcepub fn create_with_config(root: &Path, config: Config) -> Result<Self>
pub fn create_with_config(root: &Path, config: Config) -> Result<Self>
Create or open a workspace with custom config for indexing
Sourcepub fn set_log_tx(&mut self, tx: LogSender)
pub fn set_log_tx(&mut self, tx: LogSender)
Set a log channel — all progress/warning output goes here instead of stderr
Sourcepub fn index_all(&self) -> Result<IndexStats>
pub fn index_all(&self) -> Result<IndexStats>
Index all files in the workspace (text-only by default, fast)
Sourcepub fn index_all_with_options(
&self,
with_embeddings: bool,
) -> Result<IndexStats>
pub fn index_all_with_options( &self, with_embeddings: bool, ) -> Result<IndexStats>
Index all files with options
Sourcepub fn build_indexed_files_map(&self) -> HashMap<String, (u64, String)>
pub fn build_indexed_files_map(&self) -> HashMap<String, (u64, String)>
Build a map of all indexed files: relative_path -> (mtime, doc_id) Uses fast fields for efficient columnar reads, skipping chunk documents. Returns an empty map if the index is empty or unreadable.
Sourcepub fn index_incremental_with_options(
&self,
with_embeddings: bool,
) -> Result<IndexStats>
pub fn index_incremental_with_options( &self, with_embeddings: bool, ) -> Result<IndexStats>
Incremental index: only re-index files that changed since last index
Sourcepub fn search(&self, query: &str, limit: Option<usize>) -> Result<SearchResult>
pub fn search(&self, query: &str, limit: Option<usize>) -> Result<SearchResult>
Search the workspace
Sourcepub fn search_filtered(
&self,
query: &str,
limit: Option<usize>,
extensions: Option<Vec<String>>,
paths: Option<Vec<String>>,
use_regex: bool,
case_sensitive: bool,
context_before: Option<usize>,
context_after: Option<usize>,
verbose: bool,
) -> Result<SearchResult>
pub fn search_filtered( &self, query: &str, limit: Option<usize>, extensions: Option<Vec<String>>, paths: Option<Vec<String>>, use_regex: bool, case_sensitive: bool, context_before: Option<usize>, context_after: Option<usize>, verbose: bool, ) -> Result<SearchResult>
Search with filters
Sourcepub fn has_semantic_index(&self) -> bool
pub fn has_semantic_index(&self) -> bool
Check if semantic search is available (always false without embeddings feature)
Sourcepub fn index_path(&self) -> &Path
pub fn index_path(&self) -> &Path
Get the index path
Sourcepub fn is_indexed(&self) -> bool
pub fn is_indexed(&self) -> bool
Check if the workspace has been indexed (workspace.json is only created after actual indexing, not just opening)
Sourcepub fn index_file(&self, path: &Path) -> Result<()>
pub fn index_file(&self, path: &Path) -> Result<()>
Index or re-index a single file (for incremental updates) Note: path can be under workspace root OR under a symlink target
Sourcepub fn delete_file(&self, path: &Path) -> Result<()>
pub fn delete_file(&self, path: &Path) -> Result<()>
Delete a file from the index (for incremental updates)
Sourcepub fn create_watcher(&self) -> Result<FileWatcher>
pub fn create_watcher(&self) -> Result<FileWatcher>
Create a file watcher for this workspace
Sourcepub fn indexer_config(&self) -> &IndexerConfig
pub fn indexer_config(&self) -> &IndexerConfig
Get the indexer config
Sourcepub fn stored_semantic_flag(&self) -> Option<bool>
pub fn stored_semantic_flag(&self) -> Option<bool>
Read the stored semantic flag from workspace.json metadata Returns None if no metadata exists or flag is not set
Sourcepub fn stored_schema_version(&self) -> Option<u32>
pub fn stored_schema_version(&self) -> Option<u32>
Read the stored schema version from workspace.json metadata Returns None if no metadata exists or version is not set
Sourcepub fn index_file_with_options(
&self,
path: &Path,
with_embeddings: bool,
) -> Result<()>
pub fn index_file_with_options( &self, path: &Path, with_embeddings: bool, ) -> Result<()>
Index or re-index a single file with optional semantic indexing (for incremental updates)
Sourcepub fn index_file_with_indexer(
&self,
indexer: &Indexer,
path: &Path,
with_embeddings: bool,
) -> Result<()>
pub fn index_file_with_indexer( &self, indexer: &Indexer, path: &Path, with_embeddings: bool, ) -> Result<()>
Index or re-index a single file using an existing Indexer (avoids lock churn)
Sourcepub fn create_indexer(&self) -> Result<Indexer>
pub fn create_indexer(&self) -> Result<Indexer>
Create a persistent Indexer for this workspace (holds a single writer lock)
Sourcepub fn create_watch_indexer(&self) -> Result<Indexer>
pub fn create_watch_indexer(&self) -> Result<Indexer>
Create a persistent Indexer with NoMergePolicy (for watch mode) Prevents background merge threads from racing with commits. Segments accumulate but are consolidated on next incremental index.
Sourcepub fn index_file_no_commit(
&self,
indexer: &Indexer,
path: &Path,
with_embeddings: bool,
) -> Result<()>
pub fn index_file_no_commit( &self, indexer: &Indexer, path: &Path, with_embeddings: bool, ) -> Result<()>
Index a single file without committing (for batched watch operations)
Sourcepub fn delete_file_no_commit(
&self,
indexer: &Indexer,
path: &Path,
) -> Result<()>
pub fn delete_file_no_commit( &self, indexer: &Indexer, path: &Path, ) -> Result<()>
Delete a file from the index without committing (for batched watch operations)
Sourcepub fn commit_indexer(&self, indexer: &Indexer) -> Result<()>
pub fn commit_indexer(&self, indexer: &Indexer) -> Result<()>
Commit all pending indexer changes
Auto Trait Implementations§
impl Freeze for Workspace
impl !RefUnwindSafe for Workspace
impl Send for Workspace
impl Sync for Workspace
impl Unpin for Workspace
impl UnsafeUnpin for Workspace
impl !UnwindSafe for Workspace
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