Skip to content

Stats of IndexStats Class not Accessible #1094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2mal3 opened this issue Apr 7, 2025 · 0 comments · May be fixed by #1095
Open

Stats of IndexStats Class not Accessible #1094

2mal3 opened this issue Apr 7, 2025 · 0 comments · May be fixed by #1095

Comments

@2mal3
Copy link

2mal3 commented Apr 7, 2025

Description
If you want to get the statistics of an index with index.get_stats() like here, you get the corresponding data class (IndexStats), but you can't get any values from it with __getattr__, even though it is implemented in the class. Instead, you get the name of the attribute you wanted to access.

Expected behavior
A call to __getattr__ of the IndexStats class returns the value of the attribute (if it exists).

Current behavior
A call to __getattr__ of the IndexStats class returns the name of the attribute, not the value.

Example

import meilisearch as ms
ms_client = ms.Client(<host>, <master key>)
foo_index = ms_client.index("foo")

stats = foo_index.get_stats()
print(stats.numberOfDocuments)	# prints "numberOfDocuments" instead of the actual number of Documents

Environment (please complete the following information):

  • meilisearch-python version: v0.34.1
@2mal3 2mal3 linked a pull request Apr 9, 2025 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant