8000 MongoDB Atlas: Two line change to make our CI builds green by caseyclements · Pull Request #1910 · docarray/docarray · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8000
6 changes: 4 additions & 2 deletions docarray/index/backends/mongodb_atlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,16 +563,18 @@ def _vector_search_stage(
max_candidates = self._get_max_candidates(search_field)
query = query.astype(np.float64).tolist()

return {
stage = {
'$vectorSearch': {
'index': search_index_name,
'path': search_field,
'queryVector': query,
'numCandidates': min(limit * oversampling_factor, max_candidates),
'limit': limit,
'filter': {"$and": filters} if filters else None,
}
}
if filters:
stage['$vectorSearch']['filter'] = {"$and": filters}
return stage

def _text_search_stage(
self,
Expand Down
2 changes: 1 addition & 1 deletion tests/index/mongo_atlas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class FlatSchema(BaseDoc):
embedding2: NdArray = Field(dim=N_DIM, index_name="vector_index_2")


def assert_when_ready(callable: Callable, tries: int = 5, interval: float = 2):
def assert_when_ready(callable: Callable, tries: int = 10, interval: float = 2):
"""
Retry callable to account for time taken to change data on the cluster
"""
Expand Down
0