Skip to content

Commit 57e24b4

Browse files
committed
Fix IndexStats not returning attributes correctly
1 parent a90ddf8 commit 57e24b4

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

meilisearch/models/index.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(self, doc: Dict[str, Any]) -> None:
2121

2222
def __getattr__(self, attr: str) -> Any:
2323
if attr in self.__dict.keys():
24-
return attr
24+
return self.__dict[attr]
2525
raise AttributeError(f"{self.__class__.__name__} object has no attribute {attr}")
2626

2727
def __iter__(self) -> Iterator:
@@ -120,7 +120,5 @@ class UserProvidedEmbedder(CamelBase):
120120
class Embedders(CamelBase):
121121
embedders: Dict[
122122
str,
123-
Union[
124-
OpenAiEmbedder, HuggingFaceEmbedder, OllamaEmbedder, RestEmbedder, UserProvidedEmbedder
125-
],
123+
Union[OpenAiEmbedder, HuggingFaceEmbedder, OllamaEmbedder, RestEmbedder, UserProvidedEmbedder],
126124
]

tests/models/test_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
def test_getattr():
99
document = IndexStats({"field1": "test 1", "fiels2": "test 2"})
10-
assert document.__getattr__("field1") == "field1"
10+
assert document.__getattr__("field1") == "test 1"
1111

1212

1313
def test_getattr_not_found():

0 commit comments

Comments
 (0)