Skip to content

Fix VectorIndex upsert behavior - #75

Closed
mspandey wants to merge 1 commit into
madhav2348:mainfrom
mspandey:patch-4
Closed

Fix VectorIndex upsert behavior#75
mspandey wants to merge 1 commit into
madhav2348:mainfrom
mspandey:patch-4

Conversation

@mspandey

Copy link
Copy Markdown

Summary

Fix VectorIndex upsert behavior to update existing documents instead of always inserting duplicates.

Changes Made

  • Added lookup logic before inserting documents.
  • Updated existing entries when a document with the same screenshot ID already exists.
  • Preserved insertion behavior for new documents.

Why This Change?

The upsert method currently appends every document to the internal collection, even when an entry with the same identifier already exists. This can lead to duplicate records and inconsistent index state.

Implementing true upsert behavior ensures existing documents are updated while new documents are inserted only when necessary.

Impact

  • Prevents duplicate entries in the vector index.
  • Aligns implementation with the expected semantics of an upsert operation.
  • Improves consistency of stored screenshot analysis records.

Summary: Describe your changes

Issue ticket number and link

Closes #

Changes

Testing

  • Added/updated tests
  • Tested locally (describe steps)

Checklist before requesting a review

  • Code follows the project's TypeScript style conventions
  • No secrets or .env values are committed
  • I have performed a self-review of my code
  • CI passes

## Summary

Fix VectorIndex upsert behavior to update existing documents instead of always inserting duplicates.

## Changes Made

* Added lookup logic before inserting documents.
* Updated existing entries when a document with the same screenshot ID already exists.
* Preserved insertion behavior for new documents.

## Why This Change?

The `upsert` method currently appends every document to the internal collection, even when an entry with the same identifier already exists. This can lead to duplicate records and inconsistent index state.

Implementing true upsert behavior ensures existing documents are updated while new documents are inserted only when necessary.

## Impact

* Prevents duplicate entries in the vector index.
* Aligns implementation with the expected semantics of an upsert operation.
* Improves consistency of stored screenshot analysis records.
@github-actions

Copy link
Copy Markdown

🎉 Thanks for submitting a PR, @mspandey!

Please confirm the following checklist before review:

  • ⭐ I have starred this repository
  • 🍴 I have forked this repository
  • 📖 I have read the Contributing Guidelines
  • 🔀 My changes are pushed to the develop branch

A maintainer will review your PR shortly. Thank you! 🚀

@madhav2348 madhav2348 added the invalid This doesn't seem right label Jun 19, 2026
@madhav2348

Copy link
Copy Markdown
Owner

ESOC or SSOC ? and please read contribution guidlines

@mspandey mspandey closed this by deleting the head repository Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants