oasysai / oasysdb

Hybrid vector database with flexible SQL storage engine & multi-index support.
https://docs.oasysdb.com/
Apache License 2.0
357 stars 12 forks source link

fix: called option unwrap on a none value on insert #91

Closed edwinkys closed 5 months ago

edwinkys commented 5 months ago

Purpose

This PR fixes a bug that happens when attempting to insert a new vector record to the collection but the collection can't find the first valid vector ID to start the insert operation.

Testing

The script below will reproduce the issue with the previous version:

use oasysdb::prelude::*;

fn main() {
    let config = Config::default();
    let mut collection = Collection::new(&config);
    let record = Record::many_random(1536, 2);

    // Insert and delete a record
    collection.insert(&record[0]).unwrap();
    collection.delete(&VectorID(0)).unwrap();

    // Insert another record
    collection.insert(&record[1]).unwrap();
}

Chore checklist