diff --git a/src/lib.rs b/src/lib.rs index 1638712..a1b22ed 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -241,6 +241,7 @@ where } nodes[range].into_par_iter().for_each(|(_, pid)| { + let node = zero.as_slice()[*pid].write(); let (mut search, mut insertion) = pool.pop(); let point = &points.as_slice()[*pid]; search.reset(); @@ -263,6 +264,7 @@ where insertion.ef = ef_construction; insert( *pid, + node, &mut insertion, &mut search, &zero, @@ -367,13 +369,13 @@ where /// for the new node's neighbors if necessary before appending the new node to the layer. fn insert( new: PointId, + mut node: parking_lot::RwLockWriteGuard, insertion: &mut Search, search: &mut Search, layer: &[RwLock], points: &[P], heuristic: &Option, ) { - let mut node = layer[new].write(); let found = match heuristic { None => search.select_simple(M * 2), Some(heuristic) => search.select_heuristic(&points[new], layer, points, *heuristic),