Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/honest-tips-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@langchain/community": patch
---

add support for advanced metadata filters in similarity search
69 changes: 64 additions & 5 deletions docs/core_docs/docs/integrations/vectorstores/pgvector.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -292,34 +292,93 @@
"id": "3ed9d733",
"metadata": {},
"source": [
"The above filter syntax supports exact match, but the following are also supported:\n",
"The above filter syntax supports exact match (numerics, strings or booleans), \n",
"but the following are also supported:\n",
"\n",
"#### Using the `in` operator\n",
"Support numerics, strings and booleans as values.\n",
"\n",
"```json\n",
"{\n",
" \"field\": {\n",
" \"in\": [\"value1\", \"value2\"],\n",
" }\n",
" \"in\": [\"value1\", \"value2\"]\n",
" },\n",
"}\n",
"```\n",
"\n",
"#### Using the `notIn` operator\n",
"Support numerics, strings and booleans as values.\n",
"\n",
"```json\n",
"{\n",
" \"field\": {\n",
" \"notIn\": [\"value1\", \"value2\"],\n",
" \"notIn\": [2, 3, 4]\n",
" }\n",
"}\n",
"```\n",
"\n",
"#### Using the `arrayContains` operator\n",
"Support numerics, strings and booleans as values.\n",
"\n",
"```json\n",
"{\n",
" \"field\": {\n",
" \"arrayContains\": [\"value1\", \"value2\"]\n",
" }\n",
"}\n",
"```\n",
"\n",
"#### Using the `lt` operator \n",
"Supports numerics only.\n",
"\n",
"```json\n",
"{\n",
" \"field\": {\n",
" \"lt\": 100\n",
" }\n",
"}\n",
"```\n",
"\n",
"#### Using the `lte` operator \n",
"Supports numerics only.\n",
"\n",
"```json\n",
"{\n",
" \"field\": {\n",
" \"lte\": 100\n",
" }\n",
"}\n",
"```\n",
"\n",
"#### Using the `gt` operator \n",
"Supports numerics only.\n",
"\n",
"```json\n",
"{\n",
" \"field\": {\n",
" \"gt\": 100\n",
" }\n",
"}\n",
"```\n",
"\n",
"#### Using the `gte` operator \n",
"Supports numerics only.\n",
"\n",
"```json\n",
"{\n",
" \"field\": {\n",
" \"gte\": 100\n",
" }\n",
"}\n",
"```\n",
"\n",
"#### Using the `neq` operator \n",
"Support numerics, strings and booleans as values, checks that \"field\" doesn't exist or not equal \"value1\".\n",
"\n",
"```json\n",
"{\n",
" \"field\": {\n",
" \"arrayContains\": [\"value1\", \"value2\"],\n",
" \"neq\": \"value1\"\n",
" }\n",
"}\n",
"```\n",
Expand Down
Loading
Loading