Skip to content

Add indexSize and usedIndexSize to IndexStats - #946

Open
murilolivorato wants to merge 1 commit into
meilisearch:mainfrom
murilolivorato:feat/index-stats-size-943
Open

Add indexSize and usedIndexSize to IndexStats#946
murilolivorato wants to merge 1 commit into
meilisearch:mainfrom
murilolivorato:feat/index-stats-size-943

Conversation

@murilolivorato

@murilolivorato murilolivorato commented Aug 11, 2026

Copy link
Copy Markdown

Summary

This adds indexSize and usedIndexSize to IndexStats. I just followed the same pattern already used by the other fields (constructor param, getter, fromArray, PHPStan type), so it should feel consistent with the rest of the class.

Related issue

Refs #943

What does this PR do?

  • Adds indexSize and usedIndexSize to the RawIndexStats PHPStan type in src/Contracts/IndexStats.php
  • Adds both as constructor params, plus getIndexSize() / getUsedIndexSize() getters
  • Reads both fields in IndexStats::fromArray()
  • Updates tests/Contracts/StatsTest.php (testConstruct and testFromArray) to cover the new fields

PR checklist

  • Did you use any AI tool while implementing this PR (code, tests, docs, etc.)? If yes, disclose it in the PR description and describe what it was used for. AI usage is allowed when it is disclosed.
  • 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?

Thanks for taking a look!

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

IndexStats now includes indexSize and usedIndexSize in its data contract, constructor, array parsing, and public API. Tests now cover both values.

Changes

Index statistics size fields

Layer / File(s) Summary
Add index size fields
src/Contracts/IndexStats.php, tests/Contracts/StatsTest.php
IndexStats defines, stores, parses, and exposes indexSize and usedIndexSize. Tests update direct construction and Stats::fromArray() fixtures.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related issues

  • meilisearch/meilisearch-php#943 — Directly adds the same index size fields to IndexStats and its tests.

Possibly related PRs

Suggested labels: enhancement

Poem

A rabbit checks the index stack,
Size fields hop into the pack.
Raw data maps, getters shine,
Tests confirm each stored line.
Thump, thump—the stats are fine!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding indexSize and usedIndexSize to IndexStats.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the enhancement New feature or request label Aug 11, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
tests/Contracts/StatsTest.php (1)

28-29: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add direct assertions for the new getters.

The fixtures verify constructor and fromArray() values, but no assertion calls getIndexSize() or getUsedIndexSize(). Add assertions for both getters.

Also applies to: 55-56, 73-74

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/Contracts/StatsTest.php` around lines 28 - 29, Add direct assertions
for getIndexSize() and getUsedIndexSize() in the relevant StatsTest fixture
cases, including the constructor and fromArray() scenarios. Verify each getter
returns the expected indexSize and usedIndexSize values alongside the existing
value checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/Contracts/StatsTest.php`:
- Around line 28-29: Add direct assertions for getIndexSize() and
getUsedIndexSize() in the relevant StatsTest fixture cases, including the
constructor and fromArray() scenarios. Verify each getter returns the expected
indexSize and usedIndexSize values alongside the existing value checks.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 76106ab2-cb4b-4223-88c6-e119ed196339

📥 Commits

Reviewing files that changed from the base of the PR and between 24d6d72 and 84b3bc9.

📒 Files selected for processing (2)
  • src/Contracts/IndexStats.php
  • tests/Contracts/StatsTest.php

Adds the indexSize and usedIndexSize fields to IndexStats, following
the existing pattern (constructor param, getter, fromArray, phpstan
type).

Refs meilisearch#943
@murilolivorato
murilolivorato force-pushed the feat/index-stats-size-943 branch from 84b3bc9 to a7bd28c Compare August 11, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant