Skip to content

Commit 0c116a1

Browse files
authored
Rename SearchBatchClient getters on SearchClient (Azure#15183)
1 parent 5e3fa77 commit 0c116a1

File tree

3 files changed

+42
-42
lines changed

3 files changed

+42
-42
lines changed

sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchAsyncClient.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -162,22 +162,22 @@ public String getEndpoint() {
162162
}
163163

164164
/**
165-
* Creates a {@link SearchBatchAsyncClient} used to index documents for the Search index associated with
166-
* this {@link SearchAsyncClient}.
165+
* Creates a {@link SearchBatchAsyncClient} used to index documents for the Search index associated with this {@link
166+
* SearchAsyncClient}.
167167
* <p>
168168
* This will use the default configuration values for {@link SearchBatchAsyncClient}, see {@link
169169
* SearchBatchClientBuilder} for more information.
170170
*
171-
* @return A {@link SearchBatchAsyncClient} used to index documents for the Search index associated with
172-
* this {@link SearchAsyncClient}.
171+
* @return A {@link SearchBatchAsyncClient} used to index documents for the Search index associated with this {@link
172+
* SearchAsyncClient}.
173173
*/
174-
public SearchBatchAsyncClient getSearchIndexDocumentBatchingAsyncClient() {
175-
return getSearchIndexDocumentBatchingAsyncClient(null, null, null, null);
174+
public SearchBatchAsyncClient getSearchBatchAsyncClient() {
175+
return getSearchBatchAsyncClient(null, null, null, null);
176176
}
177177

178178
/**
179-
* Creates a {@link SearchBatchAsyncClient} used to index documents for the Search index associated with
180-
* this {@link SearchAsyncClient}.
179+
* Creates a {@link SearchBatchAsyncClient} used to index documents for the Search index associated with this {@link
180+
* SearchAsyncClient}.
181181
*
182182
* @param autoFlush Flag determining whether the batching client will automatically flush its document batch. If
183183
* null is passed this will be set to true.
@@ -187,12 +187,12 @@ public SearchBatchAsyncClient getSearchIndexDocumentBatchingAsyncClient() {
187187
* @param batchSize The number of documents in a batch that will trigger it to be indexed. If automatic batch
188188
* sending is disabled this value is ignored. If {@code batchSize} is null a default value of 1000 is used.
189189
* @param indexingHook An implementation of {@link IndexingHook} used to handle document callback actions.
190-
* @return A {@link SearchBatchAsyncClient} used to index documents for the Search index associated with
191-
* this {@link SearchAsyncClient}.
190+
* @return A {@link SearchBatchAsyncClient} used to index documents for the Search index associated with this {@link
191+
* SearchAsyncClient}.
192192
* @throws IllegalArgumentException If {@code batchSize} is less than one.
193193
*/
194-
public SearchBatchAsyncClient getSearchIndexDocumentBatchingAsyncClient(Boolean autoFlush,
195-
Duration flushWindow, Integer batchSize, IndexingHook indexingHook) {
194+
public SearchBatchAsyncClient getSearchBatchAsyncClient(Boolean autoFlush, Duration flushWindow, Integer batchSize,
195+
IndexingHook indexingHook) {
196196
return new SearchBatchAsyncClient(this, autoFlush, flushWindow, batchSize, indexingHook);
197197
}
198198

@@ -885,7 +885,7 @@ private static SearchRequest createSearchRequest(String searchText, SearchOption
885885
if (searchOptions != null) {
886886
List<String> scoringParameters = searchOptions.getScoringParameters() == null ? null
887887
: searchOptions.getScoringParameters().stream().map(ScoringParameter::toString)
888-
.collect(Collectors.toList());
888+
.collect(Collectors.toList());
889889
searchRequest.setSearchMode(searchOptions.getSearchMode())
890890
.setFacets(searchOptions.getFacets())
891891
.setFilter(searchOptions.getFilter())

sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchClient.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,22 @@ public String getEndpoint() {
7575
}
7676

7777
/**
78-
* Creates a {@link SearchBatchClient} used to index documents for the Search index associated with this
79-
* {@link SearchClient}.
78+
* Creates a {@link SearchBatchClient} used to index documents for the Search index associated with this {@link
79+
* SearchClient}.
8080
* <p>
8181
* This will use the default configuration values for {@link SearchBatchClient}, see {@link
8282
* SearchBatchClientBuilder} for more information.
8383
*
84-
* @return A {@link SearchBatchClient} used to index documents for the Search index associated with this
85-
* {@link SearchClient}.
84+
* @return A {@link SearchBatchClient} used to index documents for the Search index associated with this {@link
85+
* SearchClient}.
8686
*/
87-
public SearchBatchClient getSearchIndexDocumentBatchingClient() {
88-
return getSearchIndexDocumentBatchingClient(null, null, null, null);
87+
public SearchBatchClient getSearchBatchClient() {
88+
return getSearchBatchClient(null, null, null, null);
8989
}
9090

9191
/**
92-
* Creates a {@link SearchBatchClient} used to index documents for the Search index associated with this
93-
* {@link SearchClient}.
92+
* Creates a {@link SearchBatchClient} used to index documents for the Search index associated with this {@link
93+
* SearchClient}.
9494
*
9595
* @param autoFlush Flag determining whether the batching client will automatically flush its document batch. If
9696
* null is passed this will be set to true.
@@ -100,14 +100,14 @@ public SearchBatchClient getSearchIndexDocumentBatchingClient() {
100100
* @param batchSize The number of documents in a batch that will trigger it to be indexed. If automatic batch
101101
* sending is disabled this value is ignored. If {@code batchSize} is null a default value of 1000 is used.
102102
* @param indexingHook An implementation of {@link IndexingHook} used to handle document callback actions.
103-
* @return A {@link SearchBatchClient} used to index documents for the Search index associated with this
104-
* {@link SearchClient}.
103+
* @return A {@link SearchBatchClient} used to index documents for the Search index associated with this {@link
104+
* SearchClient}.
105105
* @throws IllegalArgumentException If {@code batchSize} is less than one.
106106
*/
107-
public SearchBatchClient getSearchIndexDocumentBatchingClient(Boolean autoFlush, Duration flushWindow,
108-
Integer batchSize, IndexingHook indexingHook) {
107+
public SearchBatchClient getSearchBatchClient(Boolean autoFlush, Duration flushWindow, Integer batchSize,
108+
IndexingHook indexingHook) {
109109
return new SearchBatchClient(asyncClient
110-
.getSearchIndexDocumentBatchingAsyncClient(autoFlush, flushWindow, batchSize, indexingHook));
110+
.getSearchBatchAsyncClient(autoFlush, flushWindow, batchSize, indexingHook));
111111
}
112112

113113
/**

sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/SearchBatchClientTests.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ protected void afterTest() {
9292
public void clientThrowsIfBatchSizeIsLessThanOne() {
9393
assertThrows(IllegalArgumentException.class, () -> new SearchBatchClientBuilder().batchSize(0));
9494
assertThrows(IllegalArgumentException.class, () -> getSearchClientBuilder("index").buildAsyncClient()
95-
.getSearchIndexDocumentBatchingAsyncClient(null, null, 0, null));
95+
.getSearchBatchAsyncClient(null, null, 0, null));
9696
assertThrows(IllegalArgumentException.class, () -> getSearchClientBuilder("index").buildClient()
97-
.getSearchIndexDocumentBatchingClient(null, null, 0, null));
97+
.getSearchBatchClient(null, null, 0, null));
9898
}
9999

100100
/**
@@ -106,7 +106,7 @@ public void flushBatch() {
106106

107107
SearchClient client = clientBuilder.buildClient();
108108
SearchBatchClient batchingClient = client
109-
.getSearchIndexDocumentBatchingClient(false, null, null, null);
109+
.getSearchBatchClient(false, null, null, null);
110110

111111
batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON));
112112
batchingClient.flush();
@@ -126,7 +126,7 @@ public void autoFlushBatchOnSize() {
126126

127127
SearchClient client = clientBuilder.buildClient();
128128
SearchBatchClient batchingClient = client
129-
.getSearchIndexDocumentBatchingClient(true, Duration.ofMinutes(5), 10, null);
129+
.getSearchBatchClient(true, Duration.ofMinutes(5), 10, null);
130130

131131
batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON));
132132

@@ -144,7 +144,7 @@ public void autoFlushBatchOnDelay() {
144144

145145
SearchClient client = clientBuilder.buildClient();
146146
SearchBatchClient batchingClient = client
147-
.getSearchIndexDocumentBatchingClient(true, Duration.ofSeconds(3), 1000, null);
147+
.getSearchBatchClient(true, Duration.ofSeconds(3), 1000, null);
148148

149149
batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON));
150150

@@ -162,7 +162,7 @@ public void batchFlushesOnClose() {
162162

163163
SearchClient client = clientBuilder.buildClient();
164164
SearchBatchClient batchingClient = client
165-
.getSearchIndexDocumentBatchingClient(true, Duration.ofMinutes(5), 1000, null);
165+
.getSearchBatchClient(true, Duration.ofMinutes(5), 1000, null);
166166

167167
batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON));
168168
batchingClient.close();
@@ -182,7 +182,7 @@ public void batchGetsDocumentsButNeverFlushes() {
182182

183183
SearchClient client = clientBuilder.buildClient();
184184
SearchBatchClient batchingClient = client
185-
.getSearchIndexDocumentBatchingClient(true, Duration.ofMinutes(5), 1000, null);
185+
.getSearchBatchClient(true, Duration.ofMinutes(5), 1000, null);
186186

187187
batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON));
188188

@@ -197,7 +197,7 @@ public void indexManyDocuments() {
197197

198198
SearchClient client = clientBuilder.buildClient();
199199
SearchBatchAsyncClient spyClient = spy(clientBuilder.buildAsyncClient()
200-
.getSearchIndexDocumentBatchingAsyncClient(true, Duration.ofSeconds(5), 10, null));
200+
.getSearchBatchAsyncClient(true, Duration.ofSeconds(5), 10, null));
201201
SearchBatchClient batchingClient = new SearchBatchClient(spyClient);
202202

203203
List<Map<String, Object>> documents = readJsonFileToList(HOTELS_DATA_JSON);
@@ -224,7 +224,7 @@ public void indexManyDocuments() {
224224
@Test
225225
public void emptyBatchIsNeverSent() {
226226
SearchBatchAsyncClient spyClient = spy(getSearchClientBuilder("index").buildAsyncClient()
227-
.getSearchIndexDocumentBatchingAsyncClient());
227+
.getSearchBatchAsyncClient());
228228
SearchBatchClient batchingClient = new SearchBatchClient(spyClient);
229229

230230
batchingClient.flush();
@@ -241,7 +241,7 @@ public void flushTimesOut() {
241241
SearchBatchClient batchingClient = getSearchClientBuilder("index")
242242
.httpClient(request -> Mono.<HttpResponse>empty().delayElement(Duration.ofSeconds(5)))
243243
.buildClient()
244-
.getSearchIndexDocumentBatchingClient();
244+
.getSearchBatchClient();
245245

246246
batchingClient.addUploadActions(Collections.singletonList(1));
247247

@@ -259,7 +259,7 @@ public void batchHasSomeFailures() {
259259
.httpClient(request -> Mono.just(new MockHttpResponse(request, 207, new HttpHeaders(),
260260
createMockResponseData(201, 400, 201, 404, 200, 200, 404, 400, 400, 201))))
261261
.buildClient()
262-
.getSearchIndexDocumentBatchingClient(false, null, null, hook);
262+
.getSearchBatchClient(false, null, null, hook);
263263

264264
batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON));
265265

@@ -296,7 +296,7 @@ public void retryableDocumentsAreAddedBackToTheBatch() {
296296
.httpClient(request -> Mono.just(new MockHttpResponse(request, 207, new HttpHeaders(),
297297
createMockResponseData(201, 409, 201, 422, 200, 200, 503, 409, 422, 201))))
298298
.buildClient()
299-
.getSearchIndexDocumentBatchingClient(false, null, null, hook);
299+
.getSearchBatchClient(false, null, null, hook);
300300

301301
batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON));
302302

@@ -335,7 +335,7 @@ public void batchSplits() {
335335
? Mono.just(new MockHttpResponse(request, 413))
336336
: createMockBatchSplittingResponse(request, 5))
337337
.buildClient()
338-
.getSearchIndexDocumentBatchingClient(false, null, null, hook);
338+
.getSearchBatchClient(false, null, null, hook);
339339

340340
batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON));
341341

@@ -372,7 +372,7 @@ public void batchRetriesUntilLimit() {
372372
.httpClient(request -> Mono.just(new MockHttpResponse(request, 207, new HttpHeaders(),
373373
createMockResponseData(409))))
374374
.buildClient()
375-
.getSearchIndexDocumentBatchingClient(false, null, null, hook);
375+
.getSearchBatchClient(false, null, null, hook);
376376

377377
batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON).subList(0, 1));
378378

@@ -417,7 +417,7 @@ public void batchSplitsUntilOneAndFails() {
417417
SearchBatchClient batchingClient = getSearchClientBuilder("index")
418418
.httpClient(request -> Mono.just(new MockHttpResponse(request, 413)))
419419
.buildClient()
420-
.getSearchIndexDocumentBatchingClient(false, null, null, hook);
420+
.getSearchBatchClient(false, null, null, hook);
421421

422422
batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON).subList(0, 2));
423423

@@ -457,7 +457,7 @@ public void batchSplitsUntilOneAndPartiallyFails() {
457457
? Mono.just(new MockHttpResponse(request, 413))
458458
: createMockBatchSplittingResponse(request, 1))
459459
.buildClient()
460-
.getSearchIndexDocumentBatchingClient(false, null, null, hook);
460+
.getSearchBatchClient(false, null, null, hook);
461461

462462
batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON).subList(0, 2));
463463

0 commit comments

Comments
 (0)