mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
community: Fix AWS DocumentDB similarity_search when filter is None (#24777)
**Description** Fixes DocumentDBVectorSearch similarity_search when no filter is used; it defaults to None but $match does not accept None, so changed default to empty {} before pipeline is created. **Issue** AWS DocumentDB similarity search does not work when no filter is used. Error msg: "the match filter must be an expression in an object" #24775 **Dependencies** No dependencies **Twitter handle** https://x.com/perepasamonte --------- Co-authored-by: Chester Curme <chester.curme@gmail.com>
This commit is contained in:
parent
7da0597ecb
commit
98175860ad
@ -327,6 +327,10 @@ class DocumentDBVectorSearch(VectorStore):
|
||||
Returns:
|
||||
A list of documents closest to the query vector
|
||||
"""
|
||||
# $match can't be null, so intializes to {} when None to avoid
|
||||
# "the match filter must be an expression in an object"
|
||||
if not filter:
|
||||
filter = {}
|
||||
pipeline: List[dict[str, Any]] = [
|
||||
{"$match": filter},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user