Skip to content

Add skipCreation to document updates - #993

Open
Ishubhammohole wants to merge 2 commits into
meilisearch:mainfrom
Ishubhammohole:feature-919-skip-creation
Open

Ishubhammohole wants to merge 2 commits into
meilisearch:mainfrom
Ishubhammohole:feature-919-skip-creation

Conversation

@Ishubhammohole

@Ishubhammohole Ishubhammohole commented Sep 14, 2026

Copy link
Copy Markdown

Summary

  • Added backward-compatible skipCreation overloads for add/replace and add/update document calls
  • Forwarded the boolean as the skipCreation query parameter while preserving existing request URLs
  • Added request-level regression tests and updated the documentation code samples

Testing

  • ./gradlew test --tests com.meilisearch.sdk.DocumentsSkipCreationTest -x jacocoTestCoverageVerification — passed (3 tests)
  • ./gradlew spotlessCheck — passed
  • bash ./scripts/lint.sh — passed
  • docker compose run --rm -v gradle-cache:/root/.gradle package ./gradlew test — 115/116 passed; SettingsHandlerTest dictionary reset timed out
  • docker compose run --rm -v gradle-cache:/root/.gradle package ./gradlew test --tests com.meilisearch.sdk.SettingsHandlerTest -x jacocoTestCoverageVerification — passed on immediate rerun (3 tests), confirming the timeout was transient

AI-assisted development was used to inspect the existing overload and URL-building patterns, implement the scoped change, and draft focused tests. The final diff and test results were reviewed before submission.

Fixes #919

Summary by CodeRabbit

  • New Features

    • Added an option to skip document creation when adding or updating documents.
    • The option is available for both index-level operations and requests with advanced formatting and metadata settings.
    • When enabled, requests include the corresponding server-side setting; existing methods continue to work without it.
  • Documentation

    • Updated code samples to demonstrate using the new option with document add and update operations.

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 31b30d0b-2d0e-4a22-9223-2a48b0c49030

📥 Commits

Reviewing files that changed from the base of the PR and between 0d82598 and 95e049c.

📒 Files selected for processing (2)
  • src/main/java/com/meilisearch/sdk/Documents.java
  • src/test/java/com/meilisearch/sdk/DocumentsSkipCreationTest.java
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/test/java/com/meilisearch/sdk/DocumentsSkipCreationTest.java
  • src/main/java/com/meilisearch/sdk/Documents.java

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The SDK adds skipCreation overloads for document add and update operations. Index forwards the flag to request builders. Tests verify query parameters and legacy behavior. The document examples now pass the flag.

Changes

skipCreation document operations

Layer / File(s) Summary
Document request overloads
src/main/java/com/meilisearch/sdk/Documents.java
Documents adds skipCreation overloads for add and update requests. Shared helpers build the POST and PUT requests.
Index API wiring
src/main/java/com/meilisearch/sdk/Index.java
Index adds short and full overloads for addDocuments and updateDocuments, then forwards skipCreation to Documents.
Request validation and examples
src/test/java/com/meilisearch/sdk/DocumentsSkipCreationTest.java, .code-samples.meilisearch.yaml
MockWebServer tests verify skipCreation=true, skipCreation=false with existing parameters, and omission for legacy calls. The examples pass true to both operations.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Index
  participant Documents
  participant Meilisearch
  Client->>Index: Call addDocuments or updateDocuments with skipCreation
  Index->>Documents: Forward document data and skipCreation
  Documents->>Meilisearch: Send POST or PUT request with skipCreation
  Meilisearch-->>Documents: Return task response
  Documents-->>Index: Return TaskInfo
  Index-->>Client: Return TaskInfo
Loading
🚥 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 identifies the addition of the skipCreation parameter, but it mentions only document updates. The changes also support document additions and replacements.
Linked Issues check ✅ Passed The PR satisfies the coding requirements in issue #919. Index exposes skipCreation overloads for add/replace and add/update operations. Documents forwards the Boolean value to the skipCreation
Out of Scope Changes check ✅ Passed The changes remain within issue #919. The implementation, request-level regression tests, Javadocs, and updates to add_or_replace_documents_1 and add_or_update_documents_1 directly support the req…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 3 files.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@Ishubhammohole

Copy link
Copy Markdown
Author

Added Javadocs for both request helpers and all five regression-test lifecycle/test methods, covering the missing documentation in this diff. Java 17: ./gradlew spotlessApply test --tests com.meilisearch.sdk.DocumentsSkipCreationTest javadoc spotlessCheck -x jacocoTestReport -x jacocoTestCoverageVerification --no-daemon passed (3 focused tests). Docker Compose could not run because the Docker daemon is unavailable. The full local test run had 3 existing SettingsHandlerTest failures (integration-style tests requiring a Meilisearch instance); an initial Java 21 attempt also encountered the existing Byte Buddy version limitation. This follow-up only changes comments and was prepared with Codex assistance.

This branch has not been deployed

No deployments
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