Fix bug in discarding potential candidates

This commit is contained in:
Dirkjan Ochtman 2021-01-07 14:15:03 +01:00
parent df8388a8a1
commit c4708ac032
1 changed files with 2 additions and 4 deletions

View File

@ -489,10 +489,8 @@ trait Layer {
/// case, we use `links` to constrain the number of per-candidate links we consider for search.
fn search<P: Point>(&self, point: &P, search: &mut Search, points: &[P], links: usize) {
while let Some(candidate) = search.candidates.pop() {
if let Some(found) = search.nearest.last() {
if candidate.distance > found.distance {
break;
}
if candidate.distance > search.furthest {
continue;
}
for pid in self.nearest_iter(candidate.pid).take(links) {