pub struct SimpleIndexer { /* private fields */ }Expand description
Simple file indexer.
Implementations§
Source§impl SimpleIndexer
impl SimpleIndexer
Sourcepub fn new(workspace_root: PathBuf) -> Self
pub fn new(workspace_root: PathBuf) -> Self
Create a new simple indexer with default VTCode paths.
Sourcepub fn with_config(config: SimpleIndexerConfig) -> Self
pub fn with_config(config: SimpleIndexerConfig) -> Self
Create a simple indexer with the provided configuration.
Sourcepub fn with_index_dir(workspace_root: PathBuf, index_dir: PathBuf) -> Self
pub fn with_index_dir(workspace_root: PathBuf, index_dir: PathBuf) -> Self
Create a new simple indexer using a custom index directory.
Sourcepub fn with_components(
config: SimpleIndexerConfig,
storage: Arc<dyn IndexStorage>,
filter: Arc<dyn TraversalFilter>,
) -> Self
pub fn with_components( config: SimpleIndexerConfig, storage: Arc<dyn IndexStorage>, filter: Arc<dyn TraversalFilter>, ) -> Self
Create an indexer with explicit storage and traversal filter implementations.
Sourcepub fn with_storage(self, storage: Arc<dyn IndexStorage>) -> Self
pub fn with_storage(self, storage: Arc<dyn IndexStorage>) -> Self
Replace the storage backend used to persist index entries.
Sourcepub fn with_filter(self, filter: Arc<dyn TraversalFilter>) -> Self
pub fn with_filter(self, filter: Arc<dyn TraversalFilter>) -> Self
Replace the traversal filter used to decide which files and directories are indexed.
Sourcepub fn workspace_root(&self) -> &Path
pub fn workspace_root(&self) -> &Path
Get the workspace root path.
Sourcepub fn index_file(&mut self, file_path: &Path) -> Result<()>
pub fn index_file(&mut self, file_path: &Path) -> Result<()>
Index a single file.
Sourcepub fn index_directory(&mut self, dir_path: &Path) -> Result<()>
pub fn index_directory(&mut self, dir_path: &Path) -> Result<()>
Index all files in directory recursively. Respects .gitignore, .ignore, and other ignore files. SECURITY: Always skips hidden files and sensitive data (.env, .git, etc.)
Sourcepub fn search(
&self,
pattern: &str,
path_filter: Option<&str>,
) -> Result<Vec<SearchResult>>
pub fn search( &self, pattern: &str, path_filter: Option<&str>, ) -> Result<Vec<SearchResult>>
Search files using regex pattern.
Sourcepub fn all_files(&self) -> Vec<String>
pub fn all_files(&self) -> Vec<String>
Get all indexed files without pattern matching. This is more efficient than using find_files(“.*”).
Sourcepub fn get_file_content(
&self,
file_path: &str,
start_line: Option<usize>,
end_line: Option<usize>,
) -> Result<String>
pub fn get_file_content( &self, file_path: &str, start_line: Option<usize>, end_line: Option<usize>, ) -> Result<String>
Get file content with line numbers.