Don't update entry if algorithm produces no score
This commit is contained in:
parent
11713b68c0
commit
3edffdf1dd
|
@ -348,9 +348,13 @@ mod schema {
|
|||
if let Some(now) = now {
|
||||
Ok(mappings.iter().fold(HashMap::new(), |mut acc, mapping| {
|
||||
for (document, score) in &mapping.value {
|
||||
let entry = acc.entry(document.clone()).or_default();
|
||||
let updated = the_algorithm(now, mapping.key, *score);
|
||||
|
||||
*entry += the_algorithm(now, mapping.key, *score);
|
||||
if updated > 0_f64 {
|
||||
let entry = acc.entry(document.clone()).or_default();
|
||||
|
||||
*entry += updated;
|
||||
}
|
||||
}
|
||||
acc
|
||||
}))
|
||||
|
|
Loading…
Reference in a new issue