mirror of
https://github.com/langchain-ai/langchain-postgres.git
synced 2026-07-10 18:43:29 -04:00
[PR #228] feat: $contains_any and $contains_none operators for array-inclusion filtering #248
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?
📋 Pull Request Information
Original PR: https://github.com/langchain-ai/langchain-postgres/pull/228
Author: @nazarpechka
Created: 6/30/2025
Status: 🔄 Open
Base:
main← Head:array_contains_filters📝 Commits (2)
8fee893feat: add $contains_any and $contains_none operators for array inclusion filteringc4ea3c7accept single/multiple values📊 Changes
6 files changed (+53 additions, -0 deletions)
View changed files
📝
examples/pg_vectorstore.ipynb(+2 -0)📝
examples/pg_vectorstore_how_to.ipynb(+2 -0)📝
langchain_postgres/v2/async_vectorstore.py(+31 -0)📝
tests/unit_tests/fixtures/metadata_filtering_data.py(+12 -0)📝
tests/unit_tests/v2/test_async_pg_vectorstore_search.py(+2 -0)📝
tests/unit_tests/v2/test_pg_vectorstore_search.py(+4 -0)📄 Description
This PR introduces two new operators for filtering on array-typed PostgreSQL columns.
$contains_any: matches rows whose array contains any of the given values$contains_none: matches rows whose array contains none of the given valuesBoth of those operators accept
List[str] | List[int] | List[float] | str | float | int.User should assure that input has the same type as the underlying PostgreSQL column.
Examples of usage:
Inspired by #146
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.