Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Update API for automatic reindexing #323

Open
2 of 3 tasks
kernelsoe opened this issue Dec 24, 2023 · 3 comments
Open
2 of 3 tasks

Feature: Update API for automatic reindexing #323

kernelsoe opened this issue Dec 24, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@kernelsoe
Copy link
Contributor

Describe what you are looking for

There are already add, remove APIs but for frequently updating data like a user's notes, it'd be nice to have a update API. 🙏

Can you contribute to the implementation?

  • I can contribute

Is your feature request specific to a certain interface?

C++ implementation

Contact Details

[email protected]

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@kernelsoe kernelsoe added the enhancement New feature or request label Dec 24, 2023
@ashvardanian
Copy link
Contributor

Thank you @kernelsoe! Such an API indeed makes sense. We can implement it at least slightly more efficiently than the remove & add combo, by reusing the same memory buffers under the hood. However, generally, remove is discouraged. As part of any operation or standalone.

How many vectors do you generally deal with?

@kernelsoe
Copy link
Contributor Author

kernelsoe commented Dec 25, 2023

@ashvardanian For my use case, I'm trying to load and add a few hundred user notes from sqlite into usearch on app startup without remove op then as the user edits 1 or reflecting multiple notes, I'm reindexing by removing and adding all with the same key again.

Doing this combined operation for multiple times in 1 function call would sometimes throw error, so I did something like below for now 😄:

for (const payload of payloads) {
  await remove()...
  await timeout(300)
}

for (const payload of payloads) {
  await add()...
  await timeout(300)
}

May be I should use batch op?

@ashvardanian ashvardanian self-assigned this Dec 26, 2023
@sroussey
Copy link
Contributor

sroussey commented Jan 4, 2024

Aside: There is a sqlite plugin sqlite-vss that adds vector search, but unfortunately uses FAISS Flat not HNSW. In addition, updates are not supported, so it seems the issue is elsewhere. I think pg-vector rolled their own.

While I wish this was inside sqlite, I am looking forward to using it side by side like you are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants