fix: Update the typos sort function to take the distance correctly

This commit is contained in:
Clément Renault 2018-09-21 22:25:59 +02:00
parent 3f7697f9f0
commit c99ba88288

View File

@ -7,9 +7,10 @@ use crate::rank::{match_query_index, Document};
fn sum_matches_typos(matches: &[Match]) -> u8 { fn sum_matches_typos(matches: &[Match]) -> u8 {
// note that GroupBy will never return an empty group // note that GroupBy will never return an empty group
// so we can do this assumption safely // so we can do this assumption safely
// matches must and will never be empty
GroupBy::new(matches, match_query_index).map(|group| unsafe { GroupBy::new(matches, match_query_index).map(|group| unsafe {
group.get_unchecked(0).distance group.get_unchecked(0).distance
}).sum() }).min().unwrap()
} }
#[inline] #[inline]