[Community]: FIxed the DocumentDBVectorSearch _similarity_search_without_score (#22970)

- **Description:** The PR #22777 introduced a bug in
`_similarity_search_without_score` which was raising the
`OperationFailure` error. The mistake was syntax error for MongoDB
pipeline which has been corrected now.
    - **Issue:** #22770
This commit is contained in:
Mohammad Mohtashim 2024-06-18 08:08:42 +05:00 committed by GitHub
parent f01f12ce1e
commit bf839676c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -328,8 +328,8 @@ class DocumentDBVectorSearch(VectorStore):
A list of documents closest to the query vector A list of documents closest to the query vector
""" """
pipeline: List[dict[str, Any]] = [ pipeline: List[dict[str, Any]] = [
{"$match": filter},
{ {
"$match": filter,
"$search": { "$search": {
"vectorSearch": { "vectorSearch": {
"vector": embeddings, "vector": embeddings,
@ -339,7 +339,7 @@ class DocumentDBVectorSearch(VectorStore):
"efSearch": ef_search, "efSearch": ef_search,
} }
}, },
} },
] ]
cursor = self._collection.aggregate(pipeline) cursor = self._collection.aggregate(pipeline)