mirror of
https://github.com/langchain-ai/langchain-postgres.git
synced 2026-07-16 01:33:18 -04:00
Filtering on nested metadata not allowed #40
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 @jadendick on GitHub (Sep 6, 2024).
When trying to filter by metadata that contains nested JSON objects, the field name is rejected since it contains '.'. For example:
Metadata:
{"common": {"source": "confluence"}}Filter:
{"common.source": "confluence"}This does not work because of the '.' which is currently not allowed but is a valid JsonPath.
I believe this can be fixed by changing the check here, perhaps to a simple regex function that allows '.': https://github.com/langchain-ai/langchain-postgres/blob/6d4f6f36d56db1e784c690d27a915e36a23ed4d9/langchain_postgres/vectorstores.py#L103
Thank you