Pull `(id, bm25_score)` from each row. NULL/empty score → `None`.
(rows: &[Vec<String>])
| 48 | |
| 49 | /// Pull `(id, bm25_score)` from each row. NULL/empty score → `None`. |
| 50 | fn id_score_pairs(rows: &[Vec<String>]) -> Vec<(String, Option<f64>)> { |
| 51 | rows.iter() |
| 52 | .map(|r| { |
| 53 | let id = r[0].trim().to_string(); |
| 54 | let cell = r[1].trim(); |
| 55 | let score = if cell.is_empty() { |
| 56 | None |
| 57 | } else { |
| 58 | cell.parse::<f64>().ok() |
| 59 | }; |
| 60 | (id, score) |
| 61 | }) |
| 62 | .collect() |
| 63 | } |
| 64 | |
| 65 | fn pair<'a>(pairs: &'a [(String, Option<f64>)], id: &str) -> &'a (String, Option<f64>) { |
| 66 | pairs |
no test coverage detected