fix: Filter and count the exact matching words

This commit is contained in:
Clément Renault 2019-01-06 11:41:47 +01:00
parent c594597a01
commit 0d07af3caf
No known key found for this signature in database
GPG Key ID: 0151CDAB43460DAE

View File

@ -9,13 +9,13 @@ use crate::database::DatabaseView;
use crate::Match; use crate::Match;
#[inline] #[inline]
fn contains_exact(matches: &[Match]) -> bool { fn contains_exact(matches: &&[Match]) -> bool {
matches.iter().any(|m| m.is_exact) matches.iter().any(|m| m.is_exact)
} }
#[inline] #[inline]
fn number_exact_matches(matches: &Matches) -> usize { fn number_exact_matches(matches: &Matches) -> usize {
matches.query_index_groups().map(contains_exact).count() matches.query_index_groups().filter(contains_exact).count()
} }
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]