Skip to content

feat: add deleteBy, batched auto-save, source roundtrip#1

Open
danielebarbaro wants to merge 6 commits into
neuron-core:mainfrom
danielebarbaro:feat/delete-by
Open

feat: add deleteBy, batched auto-save, source roundtrip#1
danielebarbaro wants to merge 6 commits into
neuron-core:mainfrom
danielebarbaro:feat/delete-by

Conversation

@danielebarbaro
Copy link
Copy Markdown

@danielebarbaro danielebarbaro commented May 28, 2026

Summary

Implements deleteBy(sourceType, ?sourceName) and a few supporting changes, as discussed on ezimuel/PHPVector#7.

PHPVector exposes the primitives (metadataSearch() from #4, deleteDocument() from #3), so this PR composes them.
No neuron-core/neuron-ai dependency is added to PHPVector.

Changes

  • sourceType / sourceName round-trip: folded into PHPVector metadata as reserved keys on write; restored and stripped from metadata on read in similaritySearch. Enables deleteBy to filter on them.
  • deleteBy(sourceType, ?sourceName): builds an ANDed MetadataFilter list, runs metadataSearch, deletes each match via deleteDocument, then persist().
  • deleteBySource(...) (deprecated by the interface) becomes a one-line delegate.
  • Configurable batched auto-save: new bool \$autoSave = true constructor flag; persist() calls save() once per public mutation, gated by \$autoSave && \$database->isPersistent() so in-memory databases are skipped. The pre-existing manual-save path is kept on a single test.
  • README: usage, persistence semantics (answering the load/save question from #7), autoSave, deletion.

Dependency

Requires ezimuel/phpvector ^0.3.0 (now stable on Packagist).

@danielebarbaro danielebarbaro changed the title WIP - TBD deleteBy via metadata filtering feat: add deleteBy, batched auto-save, source roundtrip May 28, 2026
@danielebarbaro danielebarbaro marked this pull request as ready for review May 28, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant