Skip to content

Commit a90717e

Browse files
committed
Enhance indexing logic to track unique files and count embeddings
1 parent d86f175 commit a90717e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

crates/codegraph-mcp/src/indexer.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,22 @@ impl ProjectIndexer {
294294
// Store nodes into graph and compute stats
295295
let main_pb = self.create_progress_bar(nodes.len() as u64, "Storing nodes");
296296
let mut stats = IndexStats::default();
297+
let mut seen_files = std::collections::HashSet::new();
297298
for n in nodes.into_iter() {
298299
match n.node_type {
299300
Some(NodeType::Function) => stats.functions += 1,
300301
Some(NodeType::Class) => stats.classes += 1,
301302
_ => {}
302303
}
303304
if let Some(ref c) = n.content { stats.lines += c.lines().count(); }
305+
if let Some(ref path) = n.location.file_path.as_str().into() {
306+
if seen_files.insert(n.location.file_path.clone()) {
307+
stats.files += 1;
308+
}
309+
}
310+
if n.embedding.is_some() {
311+
stats.embeddings += 1;
312+
}
304313
self.graph.add_node(n).await?;
305314
main_pb.inc(1);
306315
}

0 commit comments

Comments
 (0)