@@ -2,7 +2,7 @@ use std::collections::HashMap;
22use std:: path:: { Path , PathBuf } ;
33use std:: time:: { Duration , Instant } ;
44
5- use anyhow:: { anyhow , Context , Result } ;
5+ use anyhow:: { Context , Result , anyhow } ;
66use ignore:: WalkBuilder ;
77use sha2:: { Digest , Sha256 } ;
88use tracing:: info;
@@ -305,7 +305,10 @@ pub fn index_file(
305305 } ) ;
306306
307307 // 2. Embed all chunks
308- let token_counts: Vec < usize > = chunks. iter ( ) . map ( |c| embedder. token_count ( & c. text ) ) . collect ( ) ;
308+ let token_counts: Vec < usize > = chunks
309+ . iter ( )
310+ . map ( |c| embedder. token_count ( & c. text ) )
311+ . collect ( ) ;
309312 let texts: Vec < & str > = chunks. iter ( ) . map ( |c| c. text . as_str ( ) ) . collect ( ) ;
310313 let mut all_vectors = Vec :: with_capacity ( texts. len ( ) ) ;
311314 for batch in texts. chunks ( config. batch_size ) {
@@ -592,11 +595,7 @@ fn run_index_inner(
592595 info ! ( "computing folder centroids" ) ;
593596 let mut folder_vecs: HashMap < String , Vec < Vec < f32 > > > = HashMap :: new ( ) ;
594597 for rel_path in & indexed_rel_paths {
595- let folder = rel_path
596- . split ( '/' )
597- . next ( )
598- . unwrap_or ( "(root)" )
599- . to_string ( ) ;
598+ let folder = rel_path. split ( '/' ) . next ( ) . unwrap_or ( "(root)" ) . to_string ( ) ;
600599 if let Some ( file_record) = store. get_file ( rel_path) ? {
601600 let chunk_vectors = store. get_chunk_vectors_for_file ( file_record. id ) ?;
602601 for vector in chunk_vectors {
@@ -827,9 +826,15 @@ mod tests {
827826 write_file ( root, "c.md" , "# C\n No links here." ) ;
828827
829828 let store = Store :: open_memory ( ) . unwrap ( ) ;
830- let f_a = store. insert_file ( "a.md" , "h1" , 100 , & [ ] , "aaa111" , None ) . unwrap ( ) ;
831- let f_b = store. insert_file ( "b.md" , "h2" , 100 , & [ ] , "bbb222" , None ) . unwrap ( ) ;
832- let _f_c = store. insert_file ( "c.md" , "h3" , 100 , & [ ] , "ccc333" , None ) . unwrap ( ) ;
829+ let f_a = store
830+ . insert_file ( "a.md" , "h1" , 100 , & [ ] , "aaa111" , None )
831+ . unwrap ( ) ;
832+ let f_b = store
833+ . insert_file ( "b.md" , "h2" , 100 , & [ ] , "bbb222" , None )
834+ . unwrap ( ) ;
835+ let _f_c = store
836+ . insert_file ( "c.md" , "h3" , 100 , & [ ] , "ccc333" , None )
837+ . unwrap ( ) ;
833838
834839 let content_a = std:: fs:: read_to_string ( root. join ( "a.md" ) ) . unwrap ( ) ;
835840 let content_b = std:: fs:: read_to_string ( root. join ( "b.md" ) ) . unwrap ( ) ;
0 commit comments