feat(index): add compact() method for index compaction#2133
feat(index): add compact() method for index compaction#2133mixelburg wants to merge 3 commits intomeilisearch:mainfrom
Conversation
Closes meilisearch#2066 Implements the `POST /indexes/{indexUid}/compact` endpoint introduced in Meilisearch v1.23. Compaction reorganizes the index database to reclaim space and improve read performance. Example: ```ts await client.index('movies').compact().waitTask(); ```
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a new Index.compact() API to enqueue a compaction task for an index, includes end-to-end tests for permissions, URL handling, and a new code sample demonstrating Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client as Client\n(rpc caller)
participant Index as Index.compact()\n(SDK method)
participant HTTP as HTTP Client\n(post request)
participant Server as MeiliSearch\n(API & Task queue)
Client->>Index: client.index('movies').compact()
Index->>HTTP: POST /indexes/movies/compact
HTTP->>Server: HTTP request (with API key)
Server-->>HTTP: 202 Accepted + enqueued task payload
HTTP-->>Index: EnqueuedTaskPromise
Index-->>Client: return EnqueuedTaskPromise
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Summary
Adds support for the index compaction API introduced in Meilisearch v1.23 (reference).
Changes
compact()method to theIndexclass — callsPOST /indexes/{indexUid}/compacttests/compact.test.tswith permission, auth denial, and URL construction test casescompact_index_1code sample to.code-samples.meilisearch.yamlUsage
Closes
Closes #2066
Summary by CodeRabbit
New Features
Documentation
Tests