From c99ba88288d6c12b0a420218db3482dc113c0dad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Fri, 21 Sep 2018 22:25:59 +0200 Subject: [PATCH] fix: Update the typos sort function to take the distance correctly --- raptor/src/rank/sum_of_typos.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/raptor/src/rank/sum_of_typos.rs b/raptor/src/rank/sum_of_typos.rs index 0b340ddc8..4d1c80eea 100644 --- a/raptor/src/rank/sum_of_typos.rs +++ b/raptor/src/rank/sum_of_typos.rs @@ -7,9 +7,10 @@ use crate::rank::{match_query_index, Document}; fn sum_matches_typos(matches: &[Match]) -> u8 { // note that GroupBy will never return an empty group // so we can do this assumption safely + // matches must and will never be empty GroupBy::new(matches, match_query_index).map(|group| unsafe { group.get_unchecked(0).distance - }).sum() + }).min().unwrap() } #[inline]