Skip to content

Add support for /export API [v1.16]#696

Open
Nymuxyzo wants to merge 1 commit into
meilisearch:mainfrom
Nymuxyzo:feat/export
Open

Add support for /export API [v1.16]#696
Nymuxyzo wants to merge 1 commit into
meilisearch:mainfrom
Nymuxyzo:feat/export

Conversation

@Nymuxyzo
Copy link
Copy Markdown
Contributor

@Nymuxyzo Nymuxyzo commented May 24, 2026

Pull Request

Related issue

Fixes #639

What does this PR do?

  • Add client export command

PR checklist

Please check if your PR fulfills the following requirements:

  • 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?

Overview

Added client support for the Meilisearch /export API (v1.16), enabling users to export indexes through a new export method on the Meilisearch::Client class.

Changes

New Client Method

Added export(export_options) method to Meilisearch::Client that:

  • Accepts export options (including target URL and index configuration)
  • Sends a POST request to the /export endpoint
  • Returns a Models::Task object for tracking the export operation

Test Coverage

Added comprehensive test specification in spec/meilisearch/client/exports_spec.rb that verifies:

  • The export method creates a new export task
  • Options are correctly passed (target URL, wildcard index selection with overrideSettings: true)
  • The returned task has the correct type of 'export'

Documentation

Added code sample export_post_1 to .code-samples.meilisearch.yaml demonstrating:

  • Basic usage of the client.export method
  • Configuration with wildcard index export ("*") and settings override options

Implementation Details

  • All changes follow existing patterns in the codebase
  • The export method integrates with the existing task management infrastructure
  • Code sample aligns with Meilisearch export API documentation

Review Change Stack

Signed-off-by: Nymuxyzo <1729839+Nymuxyzo@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 24, 2026

📝 Walkthrough

Walkthrough

This PR implements /export API support for the Meilisearch Ruby client. A new export method is added to transform options and POST to the /export endpoint, returning a Models::Task. Tests and user documentation code samples accompany the implementation.

Changes

Export API Support

Layer / File(s) Summary
Export method implementation and test
lib/meilisearch/client.rb, spec/meilisearch/client/exports_spec.rb
The export(export_options) method transforms options, POSTs to /export, and returns a Models::Task. Tests verify the method with wildcard indexes configuration.
Export code sample documentation
.code-samples.meilisearch.yaml
User-facing YAML code sample demonstrating client.export call with target URL and wildcard index export options.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A new export blooms so fine,
With tests and docs aligned,
The Ruby client now can send,
All indexes to the end,
Where data journeys never end!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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 support for the /export API with version reference.
Linked Issues check ✅ Passed All coding requirements from issue #639 are met: export method added to client, test cases included, and code sample documented in .code-samples.meilisearch.yaml.
Out of Scope Changes check ✅ Passed All changes are directly aligned with implementing the /export API support as specified in issue #639; no unrelated modifications detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

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

@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (857afce) to head (363b6fe).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #696   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines          809       813    +4     
=========================================
+ Hits           809       813    +4     

☔ 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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
spec/meilisearch/client/exports_spec.rb (1)

5-5: 💤 Low value

Consider adding protocol scheme to the URL.

The URL 'localhost:7701' lacks a protocol scheme (http:// or https://). While this might be accepted by the underlying HTTP library or server, including the scheme explicitly improves clarity and follows standard URL format conventions.

🔧 Suggested improvement
-    task = client.export({ url: 'localhost:7701', indexes: { '*': { overrideSettings: true } } })
+    task = client.export({ url: 'http://localhost:7701', indexes: { '*': { overrideSettings: true } } })
🤖 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 `@spec/meilisearch/client/exports_spec.rb` at line 5, The test call to
client.export uses a URL lacking a scheme: update the argument passed to
client.export (the task assignment in exports_spec, variable task) to include an
explicit protocol (e.g. change 'localhost:7701' to 'http://localhost:7701' or
'https://localhost:7701') so the URL is fully qualified and unambiguous for the
HTTP client.
🤖 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 `@lib/meilisearch/client.rb`:
- Around line 475-483: Update the YARD comment for the /export endpoint in
lib/meilisearch/client.rb so that only :url is documented as required and both
:api_key (apiKey) and :payload_size (payloadSize) are marked optional; adjust
the `@param` lines for export_options to reflect optionality (e.g., indicate
[String, nil] or "optional") for :api_key and :payload_size, optionally add a
short note that a Bearer Authorization header with an admin key is required for
the request, and ensure the documented names match the API payload keys (apiKey,
payloadSize) and the hash keys used in the export-related method.

---

Nitpick comments:
In `@spec/meilisearch/client/exports_spec.rb`:
- Line 5: The test call to client.export uses a URL lacking a scheme: update the
argument passed to client.export (the task assignment in exports_spec, variable
task) to include an explicit protocol (e.g. change 'localhost:7701' to
'http://localhost:7701' or 'https://localhost:7701') so the URL is fully
qualified and unambiguous for the HTTP client.
🪄 Autofix (Beta)

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

Run ID: 72e90f40-3810-4760-bb68-ff2658d861d1

📥 Commits

Reviewing files that changed from the base of the PR and between 857afce and 363b6fe.

📒 Files selected for processing (3)
  • .code-samples.meilisearch.yaml
  • lib/meilisearch/client.rb
  • spec/meilisearch/client/exports_spec.rb

Comment thread lib/meilisearch/client.rb
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.16] Add support for /export API

1 participant