mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 12:35:05 +08:00
Fix the exactness criterion algorithm
This commit is contained in:
parent
751b060320
commit
9a57cab3ee
@ -21,19 +21,18 @@ fn number_exact_matches(
|
|||||||
let len = group.len();
|
let len = group.len();
|
||||||
|
|
||||||
let mut found_exact = false;
|
let mut found_exact = false;
|
||||||
for (pos, _) in is_exact[index..index + len]
|
for (pos, is_exact) in is_exact[index..index + len].iter().enumerate() {
|
||||||
.iter()
|
if *is_exact {
|
||||||
.filter(|x| **x)
|
|
||||||
.enumerate()
|
|
||||||
{
|
|
||||||
found_exact = true;
|
found_exact = true;
|
||||||
if let Ok(pos) = fields_counts.binary_search_by_key(&attribute[pos], |(a, _)| a.0) {
|
let attr = &attribute[index + pos];
|
||||||
|
if let Ok(pos) = fields_counts.binary_search_by_key(attr, |(a, _)| a.0) {
|
||||||
let (_, count) = fields_counts[pos];
|
let (_, count) = fields_counts[pos];
|
||||||
if count == 1 {
|
if count == 1 {
|
||||||
return usize::max_value();
|
return usize::max_value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
count += found_exact as usize;
|
count += found_exact as usize;
|
||||||
index += len;
|
index += len;
|
||||||
|
Loading…
Reference in New Issue
Block a user