@@ -224,13 +224,21 @@ public GetApiKeyResponse waitForApiKey(ApiKeyOperation operation, String key) {
224
224
return this.waitForApiKey(operation, key, null, TaskUtils.DEFAULT_MAX_RETRIES, TaskUtils.DEFAULT_TIMEOUT, null);
225
225
}
226
226
227
- public <T> Iterable<T> browseObjects(String indexName, BrowseParams browseParams, Class<T> innerType) {
227
+ /**
228
+ * Helper: Returns an iterator on top of the `browse` method.
229
+ *
230
+ * @summary Returns an iterator on `browse`.
231
+ * @param indexName The index in which to perform the request.
232
+ * @param params The `browse` parameters.
233
+ * @param innerType The class held by the index, could be your custom class or {@link Object}.
234
+ * @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions. (optional)
235
+ */
236
+ public <T> Iterable<T> browseObjects(String indexName, BrowseParamsObject params, Class<T> innerType, RequestOptions requestOptions) {
228
237
final Holder<String> currentCursor = new Holder<>();
229
- final BrowseParamsObject params = (BrowseParamsObject)browseParams.getInsideValue();
230
238
231
239
return AlgoliaIterableHelper.createIterable(
232
240
() -> {
233
- BrowseResponse<T> response = this.browse(indexName, BrowseParams.of(params), innerType);
241
+ BrowseResponse<T> response = this.browse(indexName, BrowseParams.of(params), innerType, requestOptions );
234
242
params.setCursor(response.getCursor());
235
243
currentCursor.value = response.getCursor();
236
244
return response.getHits().iterator();
@@ -241,13 +249,34 @@ public <T> Iterable<T> browseObjects(String indexName, BrowseParams browseParams
241
249
);
242
250
}
243
251
244
- public Iterable<SynonymHit> browseSynonyms(String indexName) {
252
+ /**
253
+ * Helper: Returns an iterator on top of the `browse` method.
254
+ *
255
+ * @summary Returns an iterator on `browse`.
256
+ * @param indexName The index in which to perform the request.
257
+ * @param params The `browse` parameters.
258
+ * @param innerType The class held by the index, could be your custom class or {@link Object}.
259
+ */
260
+ public <T> Iterable<T> browseObjects(String indexName, BrowseParamsObject params, Class<T> innerType) {
261
+ return browseObjects(indexName, params, innerType, null);
262
+ }
263
+
264
+ /**
265
+ * Helper: Returns an iterator on top of the `searchSynonyms` method.
266
+ *
267
+ * @summary Returns an iterator on `searchSynonyms`.
268
+ * @param indexName The index in which to perform the request.
269
+ * @param type The synonym type. (optional)
270
+ * @param params The `searchSynonyms` parameters. (optional)
271
+ * @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions. (optional)
272
+ */
273
+ public Iterable<SynonymHit> browseSynonyms(String indexName, SynonymType type, SearchSynonymsParams params, RequestOptions requestOptions) {
245
274
final Holder<Integer> currentPage = new Holder<>(0);
246
275
final int hitsPerPage = 1000;
247
276
248
277
return AlgoliaIterableHelper.createIterable(
249
278
() -> {
250
- SearchSynonymsResponse response = this.searchSynonyms(indexName, null , currentPage.value, hitsPerPage, null );
279
+ SearchSynonymsResponse response = this.searchSynonyms(indexName, type , currentPage.value, hitsPerPage, params, requestOptions );
251
280
currentPage.value = response.getNbHits() < hitsPerPage ? null : currentPage.value + 1;
252
281
return response.getHits().iterator();
253
282
},
@@ -257,14 +286,45 @@ public Iterable<SynonymHit> browseSynonyms(String indexName) {
257
286
);
258
287
}
259
288
260
- public Iterable<Rule> browseRules(String indexName, SearchRulesParams params) {
289
+ /**
290
+ * Helper: Returns an iterator on top of the `searchSynonyms` method.
291
+ *
292
+ * @summary Returns an iterator on `searchSynonyms`.
293
+ * @param indexName The index in which to perform the request.
294
+ * @param type The synonym type. (optional)
295
+ * @param params The `searchSynonyms` parameters .(optional)
296
+ */
297
+ public Iterable<SynonymHit> browseSynonyms(String indexName, SynonymType type, SearchSynonymsParams params) {
298
+ return browseSynonyms(indexName, type, params, null);
299
+ }
300
+
301
+
302
+ /**
303
+ * Helper: Returns an iterator on top of the `searchSynonyms` method.
304
+ *
305
+ * @summary Returns an iterator on `searchSynonyms`.
306
+ * @param indexName The index in which to perform the request.
307
+ */
308
+ public Iterable<SynonymHit> browseSynonyms(String indexName) {
309
+ return browseSynonyms(indexName, null, null, null);
310
+ }
311
+
312
+ /**
313
+ * Helper: Returns an iterator on top of the `searchRules` method.
314
+ *
315
+ * @summary Returns an iterator on `searchRules`.
316
+ * @param indexName The index in which to perform the request.
317
+ * @param params The `searchRules` parameters. (optional)
318
+ * @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions. (optional)
319
+ */
320
+ public Iterable<Rule> browseRules(String indexName, SearchRulesParams params, RequestOptions requestOptions) {
261
321
final Holder<Integer> currentPage = new Holder<>(0);
262
322
final int hitsPerPage = 1000;
263
323
params.setHitsPerPage(hitsPerPage);
264
324
265
325
return AlgoliaIterableHelper.createIterable(
266
326
() -> {
267
- SearchRulesResponse response = this.searchRules(indexName, params.setPage(currentPage.value));
327
+ SearchRulesResponse response = this.searchRules(indexName, params.setPage(currentPage.value), requestOptions );
268
328
currentPage.value = response.getNbHits() < hitsPerPage ? null : currentPage.value + 1;
269
329
return response.getHits().iterator();
270
330
},
@@ -273,4 +333,25 @@ public Iterable<Rule> browseRules(String indexName, SearchRulesParams params) {
273
333
}
274
334
);
275
335
}
336
+
337
+ /**
338
+ * Helper: Returns an iterator on top of the `searchRules` method.
339
+ *
340
+ * @summary Returns an iterator on `searchRules`.
341
+ * @param indexName The index in which to perform the request.
342
+ * @param params The `searchRules` parameters. (optional)
343
+ */
344
+ public Iterable<Rule> browseRules(String indexName, SearchRulesParams params) {
345
+ return browseRules(indexName, params, null);
346
+ }
347
+
348
+ /**
349
+ * Helper: Returns an iterator on top of the `searchRules` method.
350
+ *
351
+ * @summary Returns an iterator on `searchRules`.
352
+ * @param indexName The index in which to perform the request.
353
+ */
354
+ public Iterable<Rule> browseRules(String indexName) {
355
+ return browseRules(indexName, null, null);
356
+ }
276
357
{{/isSearchClient}}
0 commit comments