Skip to content

Commit 37171db

Browse files
authored
fix: called option unwrap on a none value on insert (#91)
2 parents 95397e0 + d81e51c commit 37171db

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/func/utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,11 +393,11 @@ impl<'a> IndexConstruction<'a> {
393393
insertion.ef = self.config.ef_construction;
394394

395395
// Find the first valid vector ID to push.
396-
let validator = |i: usize| self.vectors.get(&i.into()).is_some();
397-
let valid_id = (0..self.vectors.len())
396+
let validator = |i: u32| self.vectors.get(&i.into()).is_some();
397+
let valid_id = (0..u32::MAX)
398398
.into_par_iter()
399399
.find_first(|i| validator(*i))
400-
.unwrap();
400+
.unwrap_or(0);
401401

402402
search.reset();
403403
search.push(&valid_id.into(), vector, self.vectors);

0 commit comments

Comments
 (0)