feat: Replace the linear_group_by by the new linear_group method

This commit is contained in:
Clément Renault 2019-02-12 15:43:43 +01:00
parent 2e5a616d8e
commit 58b417e045
No known key found for this signature in database
GPG Key ID: 0151CDAB43460DAE
5 changed files with 5 additions and 5 deletions

View File

@ -10,7 +10,7 @@ fn number_exact_matches(query_index: &[u32], is_exact: &[bool]) -> usize {
let mut count = 0; let mut count = 0;
let mut index = 0; let mut index = 0;
for group in query_index.linear_group_by(PartialEq::eq) { for group in query_index.linear_group() {
let len = group.len(); let len = group.len();
count += is_exact[index..index + len].contains(&true) as usize; count += is_exact[index..index + len].contains(&true) as usize;
index += len; index += len;

View File

@ -7,7 +7,7 @@ use crate::rank::RawDocument;
#[inline] #[inline]
fn number_of_query_words(query_index: &[u32]) -> usize { fn number_of_query_words(query_index: &[u32]) -> usize {
query_index.linear_group_by(PartialEq::eq).count() query_index.linear_group().count()
} }
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]

View File

@ -11,7 +11,7 @@ fn sum_matches_typos(query_index: &[u32], distance: &[u8]) -> isize {
let mut sum_typos = 0.0; let mut sum_typos = 0.0;
let mut index = 0; let mut index = 0;
for group in query_index.linear_group_by(PartialEq::eq) { for group in query_index.linear_group() {
let typo = distance[index] as f32; let typo = distance[index] as f32;
sum_typos += (typo + 1.0).log10(); sum_typos += (typo + 1.0).log10();
number_words += 1.0_f32; number_words += 1.0_f32;

View File

@ -10,7 +10,7 @@ fn sum_matches_attributes(query_index: &[u32], attribute: &[u16]) -> usize {
let mut sum_attributes = 0; let mut sum_attributes = 0;
let mut index = 0; let mut index = 0;
for group in query_index.linear_group_by(PartialEq::eq) { for group in query_index.linear_group() {
sum_attributes += attribute[index] as usize; sum_attributes += attribute[index] as usize;
index += group.len(); index += group.len();
} }

View File

@ -10,7 +10,7 @@ fn sum_matches_attribute_index(query_index: &[u32], word_index: &[u32]) -> usize
let mut sum_word_index = 0; let mut sum_word_index = 0;
let mut index = 0; let mut index = 0;
for group in query_index.linear_group_by(PartialEq::eq) { for group in query_index.linear_group() {
sum_word_index += word_index[index] as usize; sum_word_index += word_index[index] as usize;
index += group.len(); index += group.len();
} }