-
-
Notifications
You must be signed in to change notification settings - Fork 30
Add incremental index #40
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Conversation
tagging @djc for visibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! No need to tag me, I'm pretty good at keeping track of my GitHub notifications -- but also pretty busy so it might take me a bit.
@@ -170,6 +170,12 @@ where | |||
pub fn get(&self, i: usize, search: &Search) -> Option<MapItem<'_, P, V>> { | |||
Some(MapItem::from(self.hnsw.get(i, search)?, self)) | |||
} | |||
|
|||
pub fn insert(&mut self, point: P, value: V) -> Result<PointId, Box<dyn std::error::Error>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to ever result an Err
, so it doesn't need to be fallible?
let zeros = self | ||
.zero | ||
.iter() | ||
.map(|z| RwLock::new(z.clone())) | ||
.collect::<Vec<_>>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a pretty expensive operation, to the point that calling insert()
one-by-one is unlikely to be very effective. Could we yield some construction type here that can be reused to insert multiple points?
This is a great project! Here's a small contribution 🙂
Adds
insert
toHnsw
andHnswMap
. The goal is to allow for incremental updates to the index by following these steps.Construction.insert
I added a simple test to validate the insertion and lookup - however I am no expert and would love any feedback to improve this PR! 🙏
Thank you!