mirror of
https://github.com/langchain-ai/langchain-postgres.git
synced 2026-07-16 01:33:18 -04:00
Support metadata-based filtering for delete operations #99
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @yukiharada1228 on GitHub (Dec 16, 2025).
Support metadata-based filtering for delete operations
Feature Request
Current Behavior
Currently, the
delete()andadelete()methods only support deletion by document IDs:Reference:
langchain_postgres/v2/async_vectorstore.py:400-419Proposed Enhancement
Add support for metadata-based filtering in delete operations, similar to how
similarity_searchsupports filtering:Motivation
_create_filter_clause()method that supports metadata filtering for search operationsImplementation Suggestion
The
adelete()method could be enhanced to accept an optionalfilterparameter:This would leverage the existing
_create_filter_clause()infrastructure and provide a consistent filtering API across the library.Alternative: Support both IDs and filters
The implementation could also support combining both IDs and filters:
This would provide maximum flexibility for deletion operations.
@dishaprakash commented on GitHub (Jan 21, 2026):
@yukiharada1228 Thank you for contributing to the enhancement of the library! Closing this issue as the PR is merged.
@yukiharada1228 commented on GitHub (Jan 21, 2026):
@dishaprakash
Thanks for reviewing and merging the PR!
Happy to contribute to the library’s enhancement.
Looking forward to contributing more in the future.