feat(stats): add indexSize and usedIndexSize to index stats response (#988) - #990
feat(stats): add indexSize and usedIndexSize to index stats response (#988)#990krishna3006b wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthrough
ChangesIndex statistics update
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@src/main/java/com/meilisearch/sdk/model/IndexStats.java`:
- Around line 38-42: Update IndexStats to use the API’s actual size
fields—databaseSize, usedDatabaseSize, rawDocumentDbSize, and
avgDocumentSize—instead of indexSize and usedIndexSize, and support both numeric
and human-formatted string values for each. Update both stats request paths to
request/map these fields correctly, and add Gson and Jackson
serialization/deserialization coverage for numeric and formatted responses.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 52e65cbb-9e8e-46c8-9dc6-4901883699ad
📒 Files selected for processing (3)
src/main/java/com/meilisearch/sdk/model/IndexStats.javasrc/test/java/com/meilisearch/sdk/json/GsonJsonHandlerTest.javasrc/test/java/com/meilisearch/sdk/json/JacksonJsonHandlerTest.java
There was a problem hiding this comment.
Pull request overview
Updates the Java SDK’s per-index stats model to support Meilisearch v1.53.0’s new indexSize and usedIndexSize fields, and extends JSON handler tests to validate deserialization for both Jackson and Gson.
Changes:
- Extend
IndexStatswithindexSizeandusedIndexSize. - Add Jackson
@JsonPropertymappings toIndexStatsfields. - Add unit tests to validate decoding of the new fields in both Jackson and Gson handlers.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/main/java/com/meilisearch/sdk/model/IndexStats.java | Adds the new stats fields and JSON mapping annotations. |
| src/test/java/com/meilisearch/sdk/json/JacksonJsonHandlerTest.java | Adds a decoding test covering indexSize and usedIndexSize. |
| src/test/java/com/meilisearch/sdk/json/GsonJsonHandlerTest.java | Adds a decoding test covering indexSize and usedIndexSize. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…cate Jackson property
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/test/java/com/meilisearch/sdk/json/JacksonJsonHandlerTest.java (1)
196-208: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winAssert both new size fields in the Jackson serialization test.
The test currently checks only
isIndexing. It passes if Jackson omitsindexSizeorusedIndexSize. Add assertions for both serialized values.Proposed test update
assertThat( json, org.hamcrest.Matchers.not(org.hamcrest.Matchers.containsString("\"indexing\""))); + assertThat(json, org.hamcrest.Matchers.containsString("\"indexSize\":2048")); + assertThat(json, org.hamcrest.Matchers.containsString("\"usedIndexSize\":1500"));🤖 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 `@src/test/java/com/meilisearch/sdk/json/JacksonJsonHandlerTest.java` around lines 196 - 208, Update the serializeIndexStats test for IndexStats to assert that the encoded JSON contains both new size fields, indexSize with value 2048 and usedIndexSize with value 1500, while preserving the existing isIndexing assertion.
🤖 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 `@src/test/java/com/meilisearch/sdk/json/JacksonJsonHandlerTest.java`:
- Around line 196-208: Update the serializeIndexStats test for IndexStats to
assert that the encoded JSON contains both new size fields, indexSize with value
2048 and usedIndexSize with value 1500, while preserving the existing isIndexing
assertion.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 45951c97-eb7c-4831-9707-d87c29e17f05
📒 Files selected for processing (2)
src/main/java/com/meilisearch/sdk/model/IndexStats.javasrc/test/java/com/meilisearch/sdk/json/JacksonJsonHandlerTest.java
🚧 Files skipped from review as they are similar to previous changes (1)
- src/main/java/com/meilisearch/sdk/model/IndexStats.java
|
@Strift Please review this |
Description
Resolves #988.
Updated \IndexStats\ model in \meilisearch-java\ SDK to include:
Added @JsonProperty\ annotations and unit tests for both \GsonJsonHandlerTest\ and \JacksonJsonHandlerTest.
Related Issue
Fixes #988
Tests
Summary by CodeRabbit
New Features
Bug Fixes
isIndexingstatus handling.Tests