Skip to content

Feature: Update API for automatic reindexing #323

Closed as not planned
Closed as not planned

Description

@kernelsoe

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

Activity

  1. added
    enhancement
    on Dec 24, 2023
  2. ashvardanian commented on Dec 24, 2023

    @ashvardanian
    Member

    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?

  3. kernelsoe commented on Dec 25, 2023

    @kernelsoe
    ContributorAuthor

    @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?

  4. self-assigned this
    on Dec 26, 2023
  5. sroussey commented on Jan 4, 2024

    @sroussey
    Contributor

    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.

  6. ashvardanian commented on Nov 14, 2026

    @ashvardanian
    Member

    @kernelsoe, thanks for the request, and @sroussey for weighing in! In 3.0, updating an entry becomes a batched removal followed by an insert, and #846 proposes that removal as an exclusive call that renumbers the survivors and re-links the graph around them, so I'm closing this in its favor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions