Skip to content

Fix incorrect document count in stats after clearing all documents #5754

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

Merged

Conversation

kametsun
Copy link
Contributor

Pull Request

Related issue

Fixes #5750

What does this PR do?

  • Fixes incorrect document count in /stats endpoint after clearing all documents
  • Adds database stats update after clearing documents in ClearDocuments::execute()
  • Enhances existing test to verify stats are correctly updated to 0
  • Ensures consistency between search results and stats endpoint

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

@Kerollmops Kerollmops added this to the v1.16.0 milestone Jul 11, 2025
@Kerollmops Kerollmops changed the base branch from main to release-v1.16.0 July 11, 2025 19:16
@Kerollmops Kerollmops added the no db change The database didn't change label Jul 11, 2025
Copy link
Member

@Kerollmops Kerollmops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @kametsun 👋

Thank you very much for your work. I just rebased on another branch, release-v1.16.0, as I would like to have it for v1.16 🎉 Can you rebase and/or cherry-pick your commits so that your PR only has your two commits, please?

Have a nice day 🌵

kametsun added 2 commits July 12, 2025 11:15
Update database stats after clearing documents to ensure
/stats endpoint returns correct numberOfDocuments: 0 instead
of stale count.
@kametsun kametsun force-pushed the fix/incorrect-stats-doc-count branch from 9133b3f to 9a9be76 Compare July 12, 2025 02:17
@kametsun
Copy link
Contributor Author

kametsun commented Jul 12, 2025

@Kerollmops
Hi!!
I rebased on release-v1.16.0 and cherry-picked my two commits.

@kametsun kametsun requested a review from Kerollmops July 12, 2025 02:20
Copy link
Member

@Kerollmops Kerollmops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for the changes 🙏

@Kerollmops Kerollmops enabled auto-merge July 15, 2025 12:26
Copy link
Member

@ManyTheFish ManyTheFish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @kametsun,

thank you for your PR, nice catch!

LGTM

@Kerollmops Kerollmops added this pull request to the merge queue Jul 17, 2025
Merged via the queue into meilisearch:release-v1.16.0 with commit fd8b245 Jul 17, 2025
27 of 29 checks passed
@meili-bot meili-bot added the v1.16.0 PRs/issues solved in v1.16.0 released on 2025-08-04 label Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no db change The database didn't change v1.16.0 PRs/issues solved in v1.16.0 released on 2025-08-04
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong number of documents
4 participants