pub struct ProjectIndexer {
pub config: IndexerConfig,
}
Expand description
Main project indexer functionality
This struct implements the core indexing logic for scanning and analyzing project directories. It handles:
- Directory traversal and filtering
- Git repository status detection
- Project categorization
- Tag generation using Ollama
§Examples
use projets_indexer::{IndexerConfig, ProjectIndexer};
use std::path::PathBuf;
let config = IndexerConfig::new(
PathBuf::from("/path/to/projects"),
PathBuf::from("projects_index.json"),
true,
);
let indexer = ProjectIndexer::new(config)?;
indexer.index_projects().await?;
Fields§
§config: IndexerConfig
Configuration for the indexer
Contains all the settings and options needed to run the indexer, including paths and feature flags.
Implementations§
Source§impl ProjectIndexer
impl ProjectIndexer
Sourcepub fn new(config: IndexerConfig) -> Result<Self>
pub fn new(config: IndexerConfig) -> Result<Self>
Create a new project indexer with the given configuration
This function initializes a new ProjectIndexer
with the provided
configuration. If Ollama is enabled, it will also initialize the
Ollama client for tag generation.
§Arguments
config
- The configuration to use for the indexer
§Returns
A Result<Self>
containing the initialized ProjectIndexer
or an error
if initialization fails.
§Examples
use projets_indexer::{IndexerConfig, ProjectIndexer};
use std::path::PathBuf;
let config = IndexerConfig::new(
PathBuf::from("/path/to/projects"),
PathBuf::from("projects_index.json"),
true,
);
let indexer = ProjectIndexer::new(config)?;
Sourcepub async fn index_projects<F>(
&self,
progress_callback: F,
) -> Result<Vec<Project>>
pub async fn index_projects<F>( &self, progress_callback: F, ) -> Result<Vec<Project>>
Index all projects in the configured directory
This is the main function that performs the project indexing process. It:
- Traverses the configured directory
- Identifies and processes project directories
- Generates metadata for each project
- Saves the results to the configured output file
§Returns
A Result<Vec<Project>>
containing the list of indexed projects or an error if
the indexing process fails.
§Examples
use projets_indexer::{IndexerConfig, ProjectIndexer};
use std::path::PathBuf;
let config = IndexerConfig::new(
PathBuf::from("/path/to/projects"),
PathBuf::from("projects_index.json"),
true,
);
let indexer = ProjectIndexer::new(config)?;
indexer.index_projects().await?;