mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 20:15:07 +08:00
feat: Break the groups loops when limit is reached
This commit is contained in:
parent
a49a21ac15
commit
31a83eae4d
@ -71,12 +71,12 @@ fn matches_into_iter(matches: FnvHashMap<DocumentId, Vec<Match>>, limit: usize)
|
|||||||
let temp = mem::replace(&mut groups, Vec::new());
|
let temp = mem::replace(&mut groups, Vec::new());
|
||||||
let mut computed = 0;
|
let mut computed = 0;
|
||||||
|
|
||||||
for group in temp {
|
'grp: for group in temp {
|
||||||
group.sort_unstable_by(sort);
|
group.sort_unstable_by(sort);
|
||||||
for group in GroupByMut::new(group, |a, b| sort(a, b) == Ordering::Equal) {
|
for group in GroupByMut::new(group, |a, b| sort(a, b) == Ordering::Equal) {
|
||||||
computed += group.len();
|
computed += group.len();
|
||||||
groups.push(group);
|
groups.push(group);
|
||||||
if computed >= limit { break }
|
if computed >= limit { break 'grp }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user