File tree Expand file tree Collapse file tree 4 files changed +13
-15
lines changed
main/java/com/meilisearch/sdk
test/java/com/meilisearch/integration Expand file tree Collapse file tree 4 files changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -354,12 +354,13 @@ public Batch getBatch(int uid) throws MeilisearchException {
354354 /**
355355 * Retrieves all batches based on the provided query parameters, with exception handling.
356356 *
357- * @param uid An instance of BatchesQuery containing filtering criteria.
357+ * @param batchesQuery An instance of BatchesQuery containing filtering criteria.
358358 * @return A CursorResults object containing a list of Batch objects.
359359 * @throws MeilisearchException If an error occurs during the request.
360360 */
361- public CursorResults <Batch > getAllBatches (BatchesQuery uid ) throws MeilisearchException {
362- return this .tasksHandler .getAllBatches (uid );
361+ public CursorResults <Batch > getAllBatches (BatchesQuery batchesQuery )
362+ throws MeilisearchException {
363+ return this .tasksHandler .getAllBatches (batchesQuery );
363364 }
364365
365366 /**
Original file line number Diff line number Diff line change @@ -179,8 +179,7 @@ public Batch getBatch(int uid) {
179179 */
180180 public CursorResults <Batch > getAllBatches (BatchesQuery batchesQuery ) {
181181 String urlPath = batchPath ().addQuery (batchesQuery .toQuery ()).getURL ();
182- BatchResults batchResults = httpClient .post (urlPath , null , BatchResults .class );
183- return batchResults .getBatchCursorResults ();
182+ return (CursorResults <Batch >) httpClient .get (urlPath , CursorResults .class , Batch .class );
184183 }
185184
186185 /** Creates an URLBuilder for the constant route tasks */
Original file line number Diff line number Diff line change 33import com .meilisearch .sdk .http .URLBuilder ;
44import java .util .Date ;
55import lombok .Data ;
6+ import lombok .experimental .Accessors ;
67
78@ Data
9+ @ Accessors (chain = true )
810public class BatchesQuery {
911 private int [] uids ;
1012 private int [] batchUids ;
@@ -18,8 +20,8 @@ public class BatchesQuery {
1820 private Date afterStartedAt ;
1921 private Date beforeFinishedAt ;
2022 private Date afterFinishedAt ;
21- private int limit ;
22- private int from ;
23+ private int limit = - 1 ;
24+ private int from = - 1 ;
2325
2426 public String toQuery () {
2527 URLBuilder urlb =
Original file line number Diff line number Diff line change 1111@ Tag ("integration" )
1212public class BatchTest extends AbstractIT {
1313
14- private static final String INDEX_UID = "batch-test" ;
15-
1614 @ BeforeEach
1715 void setup () throws Exception {
1816 this .setUp ();
1917 this .setUpJacksonClient ();
20- client .createIndex (INDEX_UID );
2118 }
2219
2320 @ AfterAll
@@ -27,14 +24,13 @@ static void cleanMeilisearch() {
2724
2825 @ Test
2926 void testGetAllBatches () {
30- CursorResults <Batch > batches = client .getAllBatches (new BatchesQuery ());
31- assertNotNull (batches );
32- assertFalse (batches .getResults ().isEmpty (), "Batch results should not be empty" );
27+ CursorResults <Batch > allBatches = client .getAllBatches (new BatchesQuery ());
28+ assertNotNull (allBatches );
29+ assertFalse (allBatches .getResults ().isEmpty (), "Batch results should not be empty" );
3330 }
3431
3532 @ Test
3633 void testGetOneBatch () {
37-
3834 CursorResults <Batch > batches = client .getAllBatches (new BatchesQuery ());
3935 assertFalse (batches .getResults ().isEmpty (), "No batches found" );
4036
@@ -51,6 +47,6 @@ void testGetOneBatch() {
5147 assertNotNull (firstBatch .getDuration ());
5248 assertNotNull (firstBatch .getStartedAt ());
5349 assertNotNull (firstBatch .getFinishedAt ());
54- assertNotNull ( firstBatch . getProgress ());
50+ // TODO: Add Check for progress to be non-null, but response always provides null
5551 }
5652}
You can’t perform that action at this time.
0 commit comments