mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 23:04:26 +01:00
feat: Replace the linear_group_by by the new linear_group method
This commit is contained in:
parent
2e5a616d8e
commit
58b417e045
@ -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;
|
||||||
|
@ -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)]
|
||||||
|
@ -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;
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user