From a027d36190c5419480c3d08fab20a138576154c0 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 17 Feb 2021 15:13:47 +0100 Subject: [PATCH] Fix missing truncation of upper layers --- src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index e7b8448..a14d04d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -238,6 +238,7 @@ where bar.set_message(&format!("Building index (layer {})", layer.0)); } + let end = range.end; nodes[range].into_par_iter().for_each(|(_, pid)| { let node = zero.as_slice()[*pid].write(); let (mut search, mut insertion) = pool.pop(); @@ -285,7 +286,7 @@ where // with `nearest` truncated to `M` elements. if !layer.is_zero() { let mut upper = Vec::new(); - (&zero) + (&zero[..end]) .into_par_iter() .map(|zero| UpperNode::from_zero(&zero.read())) .collect_into_vec(&mut upper);