Fix missing truncation of upper layers

This commit is contained in:
Dirkjan Ochtman 2021-02-17 15:13:47 +01:00
parent 53b608b474
commit a027d36190
1 changed files with 2 additions and 1 deletions

View File

@ -238,6 +238,7 @@ where
bar.set_message(&format!("Building index (layer {})", layer.0)); bar.set_message(&format!("Building index (layer {})", layer.0));
} }
let end = range.end;
nodes[range].into_par_iter().for_each(|(_, pid)| { nodes[range].into_par_iter().for_each(|(_, pid)| {
let node = zero.as_slice()[*pid].write(); let node = zero.as_slice()[*pid].write();
let (mut search, mut insertion) = pool.pop(); let (mut search, mut insertion) = pool.pop();
@ -285,7 +286,7 @@ where
// with `nearest` truncated to `M` elements. // with `nearest` truncated to `M` elements.
if !layer.is_zero() { if !layer.is_zero() {
let mut upper = Vec::new(); let mut upper = Vec::new();
(&zero) (&zero[..end])
.into_par_iter() .into_par_iter()
.map(|zero| UpperNode::from_zero(&zero.read())) .map(|zero| UpperNode::from_zero(&zero.read()))
.collect_into_vec(&mut upper); .collect_into_vec(&mut upper);