-
Notifications
You must be signed in to change notification settings - Fork 124
Updated Documents Function and fixed issued #772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Hello @Er-Sadiq The test does not pass. I will review once the CI is green 😊 |
@curquiza Sure ,No Problem.. |
@Er-Sadiq And/or run the test locally to ensure you push commits that pass the tests 😊 |
WalkthroughA method for adding or replacing documents in an index was removed from the Documents class. A new method was introduced to update documents using a provided update function, which performs validation and sends a POST request to a new endpoint. No other changes were made. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Documents
participant MeilisearchServer
Client->>Documents: updateDocumentsByFunction(uid, updateFunction)
Documents->>Documents: Validate updateFunction
Documents->>MeilisearchServer: POST /indexes/{uid}/documents/edit (updateFunction)
MeilisearchServer-->>Documents: TaskInfo
Documents-->>Client: TaskInfo
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Hey @Er-Sadiq are you still interested in making this move forward? Otherwise I will close this PR :) If so, please:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
src/main/java/com/meilisearch/sdk/Documents.java (1)
10-10
:⚠️ Potential issueAdd missing import for Map interface.
The method
updateDocumentsByFunction
usesMap<String, Object>
but the required import is missing.Add the missing import:
import java.util.HashMap; import java.util.List; +import java.util.Map;
🧹 Nitpick comments (1)
src/main/java/com/meilisearch/sdk/Documents.java (1)
162-162
: Fix indentation for the throw statement.The throw statement is not properly indented within the if block.
Apply this diff to fix the indentation:
if (updateFunction == null || updateFunction.isEmpty()) { - throw new MeilisearchException("Update function cannot be null or empty"); + throw new MeilisearchException("Update function cannot be null or empty"); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/java/com/meilisearch/sdk/Documents.java
(1 hunks)
🔇 Additional comments (1)
src/main/java/com/meilisearch/sdk/Documents.java (1)
153-166
:❓ Verification inconclusive
Verify the new API endpoint is correctly implemented.
The implementation looks correct for the new
/indexes/:uid/documents/edit
endpoint. The method properly validates the input, constructs the URL, and handles the POST request.Ensure this implementation aligns with the API specification by verifying:
🏁 Script executed:
#!/bin/bash # Description: Search for any existing tests or documentation for the edit endpoint. # Look for test files that might test this method fd -e java -x rg -l "updateDocumentsByFunction\|/edit" {} \; # Check for API documentation or comments about the edit endpoint rg -A 5 -B 5 "edit.*endpoint\|/edit"Length of output: 104
Confirm and document the
/indexes/:uid/documents/edit
endpointI could not find any existing tests or documentation for the new
updateDocumentsByFunction
method or the/indexes/:uid/documents/edit
route. Please:
- Verify against the official Meilisearch API specification that this endpoint and payload format are correct.
- Add corresponding unit/integration tests (e.g., in
src/test/java/com/meilisearch/sdk/…
) to coverupdateDocumentsByFunction
.- Update any JavaDoc or project documentation to include the new “edit” endpoint.
Description
This PR introduces the updateDocumentsByFunction method to the Documents class in the Meilisearch SDK. This method enables updating documents in a specified index based on a provided function.
Changes:
Added Method: Implemented the updateDocumentsByFunction method in Documents.java.
Allows updating documents using a function via the new /indexes/:uid/documents/edit API endpoint.
Includes error handling for null or empty function parameters.
Returns a TaskInfo object that provides details about the task created.
Addresses issue #769, which requests the addition of document updates via a function.
Summary by CodeRabbit
New Features
Bug Fixes