Enforce API boundary between Hnsw and Search

This commit is contained in:
Dirkjan Ochtman 2021-01-20 16:29:04 +01:00
parent f66bad132e
commit ecdce08196
1 changed files with 3 additions and 2 deletions

View File

@ -356,8 +356,9 @@ where
} }
} }
let found = min(search.nearest.len(), out.len()); let nearest = search.select_simple();
for (i, candidate) in search.nearest[..found].iter().enumerate() { let found = min(nearest.len(), out.len());
for (i, candidate) in nearest.iter().take(found).enumerate() {
out[i] = candidate.pid; out[i] = candidate.pid;
} }
found found