Skip to content
Closed
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
6 changes: 5 additions & 1 deletion docarray/base_doc/mixins/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,11 @@ def _get_access_paths(cls) -> List[str]:
paths = []
for field in cls.__fields__.keys():
field_type = cls._get_field_type(field)
if not is_union_type(field_type) and issubclass(field_type, BaseDoc):
if (
field != 'id'
and not is_union_type(field_type)
and issubclass(field_type, BaseDoc)
):
sub_paths = field_type._get_access_paths()
for path in sub_paths:
paths.append(f'{field}__{path}')
Expand Down
Empty file.
23 changes: 23 additions & 0 deletions tests/integrations/issues/test_1463.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from docarray import DocList, BaseDoc
from docarray.typing import NdArrayEmbedding
from docarray.utils.find import find

import numpy as np


def test_fix_max_recursion():
class Doc(BaseDoc):
text: str
embedding: NdArrayEmbedding

query = np.random.rand(128)
index = DocList[Doc](
[Doc(text=_, embedding=np.random.rand(128)) for _ in range(100)]
)
top_matches, _ = find(
index=index, query=query, search_field='embedding', metric='cosine_sim'
)
df = top_matches.to_dataframe()
assert 'id' in df.columns
assert 'embedding' in df.columns
assert 'text' in df.columns