@@ -150,27 +150,22 @@ String getRawDocuments(String uid, DocumentsQuery param) throws MeilisearchExcep
150
150
}
151
151
152
152
/**
153
- * Adds/Replaces a document at the specified index uid
153
+ * Updates documents in the specified index using a function
154
154
*
155
- * @param uid Partial index identifier for the document
156
- * @param document String containing the document to add
157
- * @param primaryKey PrimaryKey of the document
158
- * @param csvDelimiter CSV delimiter of the document
155
+ * @param uid Partial index identifier for the documents
156
+ * @param updateFunction Map containing the function to update documents
159
157
* @return Meilisearch's TaskInfo API response
160
158
* @throws MeilisearchException if the client request causes an error
161
159
*/
162
- TaskInfo addDocuments (String uid , String document , String primaryKey , String csvDelimiter )
163
- throws MeilisearchException {
164
- URLBuilder urlb = documentPath (uid );
165
- if (primaryKey != null ) {
166
- urlb .addParameter ("primaryKey" , primaryKey );
160
+ TaskInfo updateDocumentsByFunction (String uid , Map <String , Object > updateFunction ) throws MeilisearchException {
161
+ if (updateFunction == null || updateFunction .isEmpty ()) {
162
+ throw new MeilisearchException ("Update function cannot be null or empty" );
167
163
}
168
- if (csvDelimiter != null ) {
169
- urlb .addParameter ("csvDelimiter" , csvDelimiter );
170
- }
171
- return httpClient .post (urlb .getURL (), document , TaskInfo .class );
164
+ URLBuilder urlb = documentPath (uid ).addSubroute ("edit" );
165
+ return httpClient .post (urlb .getURL (), updateFunction , TaskInfo .class );
172
166
}
173
167
168
+
174
169
/**
175
170
* Replaces a document at the specified index uid
176
171
*
0 commit comments