mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-01-31 15:31:53 +08:00
Lexicographically sort all the map to merge
This commit is contained in:
parent
cb99ac6f7e
commit
2e32d0474c
@ -640,24 +640,13 @@ where
|
||||
}
|
||||
|
||||
// Then manage the content on the HashMap entries that weren't taken (mem::take).
|
||||
let order_count = 1000;
|
||||
while let Some(mut map) = maps.pop() {
|
||||
let mut iter = map.iter_mut();
|
||||
|
||||
loop {
|
||||
let mut ordered_buffer: Vec<_> = iter.by_ref().take(order_count).collect();
|
||||
ordered_buffer.sort_unstable_by_key(|(key, _)| *key);
|
||||
|
||||
if ordered_buffer.is_empty() {
|
||||
break;
|
||||
}
|
||||
|
||||
for (key, bbbul) in ordered_buffer {
|
||||
// Make sure we don't try to work with entries already managed by the spilled
|
||||
if bbbul.is_empty() {
|
||||
continue;
|
||||
}
|
||||
let mut ordered_entries: Vec<_> =
|
||||
map.iter_mut().filter(|(_, bbbul)| !bbbul.is_empty()).collect();
|
||||
ordered_entries.sort_unstable_by_key(|(key, _)| *key);
|
||||
|
||||
for (key, bbbul) in ordered_entries {
|
||||
let mut output = DelAddRoaringBitmap::empty();
|
||||
output.union_and_clear_bbbul(bbbul);
|
||||
|
||||
@ -671,7 +660,6 @@ where
|
||||
(f)(key, output)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user