mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-13 16:36:06 +00:00
Substring support for similarity_search_with_score (#10746)
**Description:** Possible to filter with substrings in similarity_search_with_score, for example: filter={'user_id': {'substring': 'user'}} --------- Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
This commit is contained in:
parent
740eafe41d
commit
900dbd1cbe
@ -360,6 +360,13 @@ class PGEmbedding(VectorStore):
|
||||
value_case_insensitive[IN]
|
||||
)
|
||||
filter_clauses.append(filter_by_metadata)
|
||||
elif isinstance(value, dict) and "substring" in map(
|
||||
str.lower, value
|
||||
):
|
||||
filter_by_metadata = EmbeddingStore.cmetadata[key].astext.ilike(
|
||||
f"%{value['substring']}%"
|
||||
)
|
||||
filter_clauses.append(filter_by_metadata)
|
||||
else:
|
||||
filter_by_metadata = EmbeddingStore.cmetadata[
|
||||
key
|
||||
|
Loading…
Reference in New Issue
Block a user