@@ -31,7 +31,10 @@ pub fn run() -> Result<()> { |
| 31 | // Find max score for normalization | 31 | // Find max score for normalization |
| 32 | let max_score = entries.iter().map(|(_, s)| *s).fold(0.0f64, f64::max); | 32 | let max_score = entries.iter().map(|(_, s)| *s).fold(0.0f64, f64::max); |
| 33 | | 33 | |
| | 34 | + let total_found = entries.len(); |
| | 35 | + |
| 34 | // Normalize and import | 36 | // Normalize and import |
| | 37 | + let mut skipped = 0; |
| 35 | for (path, score) in entries { | 38 | for (path, score) in entries { |
| 36 | // Scale score to 0-MAX_IMPORT_SCORE range | 39 | // Scale score to 0-MAX_IMPORT_SCORE range |
| 37 | let normalized = if max_score > 0.0 { | 40 | let normalized = if max_score > 0.0 { |
@@ -40,14 +43,20 @@ pub fn run() -> Result<()> { |
| 40 | 1.0 | 43 | 1.0 |
| 41 | }; | 44 | }; |
| 42 | | 45 | |
| 43 | - if db.import_entry(&path, normalized.max(1.0)).is_ok() { | 46 | + match db.import_entry(&path, normalized.max(1.0)) { |
| 44 | - total_imported += 1; | 47 | + Ok(()) => total_imported += 1, |
| | 48 | + Err(_) => skipped += 1, |
| 45 | } | 49 | } |
| 46 | } | 50 | } |
| 47 | | 51 | |
| 48 | if total_imported > 0 { | 52 | if total_imported > 0 { |
| 49 | db.save()?; | 53 | db.save()?; |
| 50 | - println!("Imported {} entries (scores normalized to 1-{})", total_imported, MAX_IMPORT_SCORE as u32); | 54 | + } |
| | 55 | + |
| | 56 | + println!("Found {} entries, imported {} (scores normalized to 1-{})", |
| | 57 | + total_found, total_imported, MAX_IMPORT_SCORE as u32); |
| | 58 | + if skipped > 0 { |
| | 59 | + println!("Skipped {} entries (excluded or unresolvable paths)", skipped); |
| 51 | } | 60 | } |
| 52 | | 61 | |
| 53 | Ok(()) | 62 | Ok(()) |