mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-06 17:57:49 +02:00
Add optoin to not index
This commit is contained in:
@@ -350,6 +350,8 @@ class BasePostgresStore(Generic[C]):
|
||||
elif text_fields is None:
|
||||
text_fields = ["__root__"]
|
||||
for op in inserts:
|
||||
if op.index is False:
|
||||
continue
|
||||
value = op.value
|
||||
ns = _namespace_to_text(op.namespace)
|
||||
k = op.key
|
||||
|
||||
@@ -307,6 +307,15 @@ async def test_vector_update_with_embedding(vector_store: AsyncPostgresStore) ->
|
||||
if r.key == "doc1":
|
||||
assert r.response_metadata["score"] > after_score
|
||||
|
||||
# Don't index this one
|
||||
await vector_store.aput(
|
||||
("test",), "doc4", {"text": "new text about dogs"}, index=False
|
||||
)
|
||||
results_new = await vector_store.asearch(
|
||||
("test",), query="new text about dogs", limit=3
|
||||
)
|
||||
assert not any(r.key == "doc4" for r in results_new)
|
||||
|
||||
|
||||
async def test_vector_search_with_filters(vector_store: AsyncPostgresStore) -> None:
|
||||
"""Test combining vector search with filters."""
|
||||
|
||||
@@ -458,6 +458,11 @@ def test_vector_update_with_embedding(vector_store: PostgresStore) -> None:
|
||||
if r.key == "doc1":
|
||||
assert r.response_metadata["score"] > after_score
|
||||
|
||||
# Don't index this one
|
||||
vector_store.put(("test",), "doc4", {"text": "new text about dogs"}, index=False)
|
||||
results_new = vector_store.search(("test",), query="new text about dogs", limit=3)
|
||||
assert not any(r.key == "doc4" for r in results_new)
|
||||
|
||||
|
||||
def test_vector_search_with_filters(vector_store: PostgresStore) -> None:
|
||||
"""Test combining vector search with filters."""
|
||||
|
||||
Reference in New Issue
Block a user