Skip to content

Conversation

@kumarUjjawal
Copy link
Contributor

@kumarUjjawal kumarUjjawal commented Nov 5, 2025

Pull Request

Related issue

Fixes #727

What does this PR do?

  • I noticed a typo in the .code-samples.meilisearch.yaml so fixed that as well.

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?

Thank you so much for contributing to Meilisearch!

Summary by CodeRabbit

  • New Features

    • Added ability to perform index compaction and monitor its completion as an async task.
  • Documentation

    • Added compact index code sample.
    • Fixed typos in field properties guide examples (corrected "overview" in searchable and displayed attributes).

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 5, 2025

Walkthrough

Adds index compaction support: new Index::compact() async method that posts to /indexes/{uid}/compact and returns TaskInfo; new TaskType variant and IndexCompaction details struct; code example and tests included.

Changes

Cohort / File(s) Summary
Code examples
.code-samples.meilisearch.yaml
Added compact_index_1 example showing index("INDEX_UID").compact().await.unwrap(); fixed typos in field_properties_guide_searchable_1 and field_properties_guide_displayed_1 by replacing "overvieww" with "overview".
Index API
src/indexes.rs
Added pub async fn compact(&self) -> Result<TaskInfo, Error> on Index<Http> and a test test_compact_index_succeeds that triggers compaction and awaits the resulting task.
Task types
src/tasks.rs
Added IndexCompaction struct (pub, derives Debug/Clone/Deserialize, serde rename_all = "camelCase") and new TaskType::IndexCompaction { details: Option<IndexCompaction> } variant to represent compaction tasks.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SDK
    participant MeiliServer

    User->>SDK: index.compact().await
    SDK->>MeiliServer: POST /indexes/{uid}/compact
    MeiliServer-->>SDK: 202 Accepted + TaskInfo
    SDK-->>User: Ok(TaskInfo)
    Note right of SDK: TaskInfo can be polled/tracked separately
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Inspect HTTP request construction and endpoint path in compact().
  • Verify TaskInfo parsing, test awaiting logic, and test robustness in src/indexes.rs.
  • Confirm IndexCompaction struct fields and serde attributes in src/tasks.rs match Meilisearch v1.23 spec.
  • Check example syntax in .code-samples.meilisearch.yaml.

Poem

🐰
I nibbled code beneath the moonlit stack,
Poked a hole, compacted an index back,
A TaskInfo hop, I track its little feet,
Cleaned the garden rows — tidy, swift, and neat.

Pre-merge checks and finishing touches

✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add support for compacting database indexes' clearly and accurately summarizes the main change in the PR, matching the primary objective.
Linked Issues check ✅ Passed All coding requirements from issue #727 are met: compact() method added to Index, test case included, and code sample added to .code-samples.meilisearch.yaml.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing index compaction support. Fixes to 'overvieww' typos are minimal, supporting improvements that align with the PR scope.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 23fd9c6 and ffb025f.

📒 Files selected for processing (1)
  • .code-samples.meilisearch.yaml (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: integration-tests
🔇 Additional comments (2)
.code-samples.meilisearch.yaml (2)

698-703: ✓ Code sample follows established conventions.

The new compact_index_1 example is well-formed and consistent with other index operation patterns in this file. The async/await syntax, return type (TaskInfo), and error handling are all aligned with existing examples.


707-707: ✓ Typo corrections applied.

The corrections from "overvieww" to "overview" in both field_properties_guide_searchable_1 and field_properties_guide_displayed_1 fix documentation quality issues and ensure consistency with the rest of the file.

Also applies to: 719-719


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 and usage tips.

@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.22%. Comparing base (e90a3c2) to head (ffb025f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #728      +/-   ##
==========================================
+ Coverage   86.18%   86.22%   +0.03%     
==========================================
  Files          20       20              
  Lines        6263     6285      +22     
==========================================
+ Hits         5398     5419      +21     
- Misses        865      866       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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 this pull request may close these issues.

[v1.23] Add support for compacting database indexes

1 participant