Skip to content
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

Easy way to get number of entries in index #194

Closed
adamjstewart opened this issue Sep 29, 2021 · 1 comment · Fixed by #207
Closed

Easy way to get number of entries in index #194

adamjstewart opened this issue Sep 29, 2021 · 1 comment · Fixed by #207
Milestone

Comments

@adamjstewart
Copy link
Collaborator

I would like to be able to easily query the number of entries in an index. I would expect len(index) to work. However, the __len__ attribute isn't defined. I recently discovered index.get_size(), which gives me exactly what I want, although it isn't documented. Could we rename get_size to __len__, or have __len__ call get_size? Alternatively, could we document get_size?

I'm happy to open a PR to do this, but it'll have to wait until next week.

@hobu
Copy link
Member

hobu commented Feb 4, 2022

Please make a PR providing this.

One issue IIRC with get_size on a full index is it might be a count estimate, not an actual count of the index entries inserted into the tree.

@hobu hobu added this to the 1.0.0 milestone Feb 4, 2022
@hobu hobu closed this as completed in #207 Feb 5, 2022
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.

2 participants