Skip to content

Added skipCreation param to document methods#473

Open
M4dhav wants to merge 1 commit intomeilisearch:mainfrom
M4dhav:feat/add-skip-creation-param
Open

Added skipCreation param to document methods#473
M4dhav wants to merge 1 commit intomeilisearch:mainfrom
M4dhav:feat/add-skip-creation-param

Conversation

@M4dhav
Copy link
Contributor

@M4dhav M4dhav commented Mar 4, 2026

Pull Request

##ISSUE Number
Fixes #459

What does this PR do?

  • This PR adds the support for skipCreation param when using related document methods.

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?

Thank you so much for contributing to Meilisearch!

Summary by CodeRabbit

Release Notes

  • New Features

    • Added optional skipCreation parameter to document add and update operations, enabling control over automatic collection creation behavior.
  • Documentation

    • Updated code examples demonstrating usage of the new parameter.

@coderabbitai
Copy link

coderabbitai bot commented Mar 4, 2026

📝 Walkthrough

Walkthrough

This PR implements support for the skipCreation parameter from Meilisearch v1.31 across document operation methods. An optional boolean parameter is added to all addDocuments and updateDocuments method variants (including JSON, CSV, NDJSON, and batch formats), with updated code examples and test cases demonstrating usage.

Changes

Cohort / File(s) Summary
Document Operation Methods
lib/src/index.dart
Added optional bool? skipCreation parameter to 13 methods: addDocuments, addDocumentsJson, addDocumentsCsv, addDocumentsNdjson, addDocumentsInBatches, addDocumentsCsvInBatches, addDocumentsNdjsonInBatches, updateDocuments, updateDocumentsJson, updateDocumentsCsv, updateDocumentsNdjson, updateDocumentsInBatches, updateDocumentsCsvInBatches, updateDocumentsNdjsonInBatches. Parameter is threaded through to underlying API calls.
Code Examples
.code-samples.meilisearch.yaml
Updated add_or_replace_documents_1 example to use skipCreation: false with array payload. Updated add_or_update_documents_1 example to use skipCreation: true with array payload. Removed delete_one_document_1 example content.
Test Cases
test/code_samples.dart
Updated addDocuments test call to include skipCreation: false parameter. Updated updateDocuments test call to include skipCreation: true parameter.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A curious hop through parameters we go,
skipCreation flags help documents flow,
From add to update, the patterns align,
Consistent threading—a burrow so fine!
Meilisearch v1.31 now shines so bright,

🚥 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 accurately and concisely summarizes the main change: adding a skipCreation parameter to document methods.
Linked Issues check ✅ Passed All three tasks from issue #459 are completed: skipCreation parameter added to document methods, test cases updated with new parameter values, and code examples updated with skipCreation usage.
Out of Scope Changes check ✅ Passed All changes are directly related to issue #459 objectives: updating document methods, test cases, and code examples for skipCreation support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

Copy link

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

🧹 Nitpick comments (1)
lib/src/index.dart (1)

123-133: Refresh public method docs to include skipCreation.

Current doc comments mention optional primaryKey but omit the newly added option, which can confuse SDK users.

✍️ Proposed doc update
-  /// Add a list of documents by given [documents] and optional [primaryKey] parameter.
+  /// Add a list of documents by given [documents] and optional [primaryKey]
+  /// and [skipCreation] parameters.
...
-  /// Add a list of documents or update them if they already exist by given [documents] and optional [primaryKey] parameter.
+  /// Add a list of documents or update them if they already exist by given
+  /// [documents] and optional [primaryKey] and [skipCreation] parameters.

Also applies to: 288-296

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/src/index.dart` around lines 123 - 133, The public doc comments for
addDocuments (templates meili.add_docs and meili.index_upsert) are missing the
newly added skipCreation parameter; update the method documentation to describe
the skipCreation bool option (its purpose, default behavior, and effect when
true/false) alongside the existing primaryKey description, and mirror the same
documentation update for the other overloaded/related method comments referenced
in the file (the second addDocuments/doc block later in the file) so users see
skipCreation documented consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@lib/src/index.dart`:
- Around line 123-133: The public doc comments for addDocuments (templates
meili.add_docs and meili.index_upsert) are missing the newly added skipCreation
parameter; update the method documentation to describe the skipCreation bool
option (its purpose, default behavior, and effect when true/false) alongside the
existing primaryKey description, and mirror the same documentation update for
the other overloaded/related method comments referenced in the file (the second
addDocuments/doc block later in the file) so users see skipCreation documented
consistently.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 31dbb927-ce61-452e-8a5d-3a8710a01627

📥 Commits

Reviewing files that changed from the base of the PR and between c9589c6 and 751c845.

📒 Files selected for processing (3)
  • .code-samples.meilisearch.yaml
  • lib/src/index.dart
  • test/code_samples.dart

@M4dhav
Copy link
Contributor Author

M4dhav commented Mar 4, 2026

Checking why tests are failing

@M4dhav
Copy link
Contributor Author

M4dhav commented Mar 5, 2026

Hey @curquiza , looks like the tests failure is unrelated to my changes, as this test has been failing on all recent PRs ( Check https://github.com/meilisearch/meilisearch-dart/actions/workflows/tests.yml ).
Since it is a timeout issue, I will try to investigate why this is happening and potentially try to fix it.

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.

[Meilisearch v1.31] Allow skipCreation when adding/replacing documents

1 participant