Skip to content

Commit 40cf296

Browse files
MongoDB Atlas: Two line change to make our CI builds green (#1910)
1 parent e6802a2 commit 40cf296

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

docarray/index/backends/mongodb_atlas.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,16 +563,18 @@ def _vector_search_stage(
563563
max_candidates = self._get_max_candidates(search_field)
564564
query = query.astype(np.float64).tolist()
565565

566-
return {
566+
stage = {
567567
'$vectorSearch': {
568568
'index': search_index_name,
569569
'path': search_field,
570570
'queryVector': query,
571571
'numCandidates': min(limit * oversampling_factor, max_candidates),
572572
'limit': limit,
573-
'filter': {"$and": filters} if filters else None,
574573
}
575574
}
575+
if filters:
576+
stage['$vectorSearch']['filter'] = {"$and": filters}
577+
return stage
576578

577579
def _text_search_stage(
578580
self,

tests/index/mongo_atlas/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class FlatSchema(BaseDoc):
2929
embedding2: NdArray = Field(dim=N_DIM, index_name="vector_index_2")
3030

3131

32-
def assert_when_ready(callable: Callable, tries: int = 5, interval: float = 2):
32+
def assert_when_ready(callable: Callable, tries: int = 10, interval: float = 2):
3333
"""
3434
Retry callable to account for time taken to change data on the cluster
3535
"""

0 commit comments

Comments
 (0)