Skip to content

Commit 01027af

Browse files
authored
Regenerate azure-search-documents to Include Indexer Caching (Azure#23374)
1 parent 7e890f5 commit 01027af

File tree

13 files changed

+173
-17
lines changed

13 files changed

+173
-17
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ private static String createSearchRequestAnswers(SearchOptions searchOptions) {
861861
}
862862

863863
// Answer and count, format it as the service expects.
864-
return String.format("%s|count-%d", answer, answersCount);
864+
return answer + "|count-" + answersCount;
865865
}
866866

867867
/**

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public SearchAsyncClient buildAsyncClient() {
138138

139139
HttpPipeline pipeline = getHttpPipeline();
140140
return new SearchAsyncClient(endpoint, indexName, buildVersion, pipeline, jsonSerializer,
141-
Utility.buildRestClient(endpoint, indexName, pipeline, getDefaultSerializerAdapter()));
141+
Utility.buildRestClient(buildVersion, endpoint, indexName, pipeline, getDefaultSerializerAdapter()));
142142
}
143143

144144
/**
@@ -420,9 +420,14 @@ public SearchIndexingBufferedSender<T> buildSender() {
420420
public SearchIndexingBufferedAsyncSender<T> buildAsyncSender() {
421421
validateIndexNameAndEndpoint();
422422
Objects.requireNonNull(documentKeyRetriever, "'documentKeyRetriever' cannot be null");
423-
return new SearchIndexingBufferedAsyncSender<>(buildRestClient(endpoint, indexName, getHttpPipeline(),
424-
getDefaultSerializerAdapter()), jsonSerializer, documentKeyRetriever, autoFlush, autoFlushInterval,
425-
initialBatchActionCount, maxRetriesPerAction, throttlingDelay, maxThrottlingDelay,
423+
424+
SearchServiceVersion buildVersion = (serviceVersion == null)
425+
? SearchServiceVersion.getLatest()
426+
: serviceVersion;
427+
428+
return new SearchIndexingBufferedAsyncSender<>(buildRestClient(buildVersion, endpoint, indexName,
429+
getHttpPipeline(), getDefaultSerializerAdapter()), jsonSerializer, documentKeyRetriever, autoFlush,
430+
autoFlushInterval, initialBatchActionCount, maxRetriesPerAction, throttlingDelay, maxThrottlingDelay,
426431
onActionAddedConsumer, onActionSucceededConsumer, onActionErrorConsumer, onActionSentConsumer);
427432
}
428433

sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/SearchIndexerConverter.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public static SearchIndexer map(com.azure.search.documents.indexes.implementatio
3838

3939
searchIndexer.setOutputFieldMappings(obj.getOutputFieldMappings());
4040
searchIndexer.setEncryptionKey(obj.getEncryptionKey());
41+
searchIndexer.setCache(obj.getCache());
4142

4243
return searchIndexer;
4344
}
@@ -71,6 +72,7 @@ public static com.azure.search.documents.indexes.implementation.models.SearchInd
7172

7273
searchIndexer.setOutputFieldMappings(obj.getOutputFieldMappings());
7374
searchIndexer.setEncryptionKey(obj.getEncryptionKey());
75+
searchIndexer.setCache(obj.getCache());
7476

7577
return searchIndexer;
7678
}

sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/util/Utility.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import com.azure.core.util.serializer.JacksonAdapter;
3131
import com.azure.core.util.serializer.SerializerAdapter;
3232
import com.azure.core.util.serializer.TypeReference;
33+
import com.azure.search.documents.SearchServiceVersion;
3334
import com.azure.search.documents.implementation.SearchIndexClientImpl;
3435
import com.azure.search.documents.implementation.SearchIndexClientImplBuilder;
3536
import com.azure.search.documents.implementation.converters.IndexDocumentsResultConverter;
@@ -174,9 +175,10 @@ public static Mono<Response<IndexDocumentsResult>> indexDocumentsWithResponse(Se
174175
}
175176
}
176177

177-
public static SearchIndexClientImpl buildRestClient(String endpoint, String indexName, HttpPipeline httpPipeline,
178-
SerializerAdapter adapter) {
178+
public static SearchIndexClientImpl buildRestClient(SearchServiceVersion serviceVersion, String endpoint,
179+
String indexName, HttpPipeline httpPipeline, SerializerAdapter adapter) {
179180
return new SearchIndexClientImplBuilder()
181+
.apiVersion(serviceVersion.getVersion())
180182
.endpoint(endpoint)
181183
.indexName(indexName)
182184
.pipeline(httpPipeline)

sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexAsyncClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public final class SearchIndexAsyncClient {
8888

8989
this.restClient = new SearchServiceClientImplBuilder()
9090
.endpoint(endpoint)
91-
// .apiVersion(serviceVersion.getVersion())
91+
.apiVersion(serviceVersion.getVersion())
9292
.pipeline(httpPipeline)
9393
.buildClient();
9494
}

sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexerAsyncClient.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public class SearchIndexerAsyncClient {
7474

7575
this.restClient = new SearchServiceClientImplBuilder()
7676
.endpoint(endpoint)
77-
// .apiVersion(serviceVersion.getVersion())
77+
.apiVersion(serviceVersion.getVersion())
7878
.pipeline(httpPipeline)
7979
.buildClient();
8080
}
@@ -144,10 +144,9 @@ Mono<Response<SearchIndexerDataSourceConnection>> createOrUpdateDataSourceConnec
144144
dataSource.setConnectionString("<unchanged>");
145145
}
146146
try {
147-
return restClient
148-
.getDataSources()
147+
return restClient.getDataSources()
149148
.createOrUpdateWithResponseAsync(dataSource.getName(), SearchIndexerDataSourceConverter.map(dataSource),
150-
ifMatch, null, null, context)
149+
ifMatch, null, null, null, context)
151150
.onErrorMap(MappingUtils::exceptionMapper)
152151
.map(MappingUtils::mappingExternalDataSource);
153152
} catch (RuntimeException ex) {
@@ -459,7 +458,7 @@ Mono<Response<SearchIndexer>> createOrUpdateIndexerWithResponse(SearchIndexer in
459458
try {
460459
return restClient.getIndexers()
461460
.createOrUpdateWithResponseAsync(indexer.getName(), SearchIndexerConverter.map(indexer), ifMatch, null,
462-
null, context)
461+
null, null, null, context)
463462
.onErrorMap(MappingUtils::exceptionMapper)
464463
.map(MappingUtils::mappingExternalSearchIndexer);
465464
} catch (RuntimeException ex) {
@@ -971,7 +970,7 @@ Mono<Response<SearchIndexerSkillset>> createOrUpdateSkillsetWithResponse(SearchI
971970
String ifMatch = onlyIfUnchanged ? skillset.getETag() : null;
972971
try {
973972
return restClient.getSkillsets()
974-
.createOrUpdateWithResponseAsync(skillset.getName(), skillset, ifMatch, null, null, context)
973+
.createOrUpdateWithResponseAsync(skillset.getName(), skillset, ifMatch, null, null, null, null, context)
975974
.onErrorMap(MappingUtils::exceptionMapper);
976975
} catch (RuntimeException ex) {
977976
return monoError(logger, ex);

sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/DataSourcesImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Mono<Response<SearchIndexerDataSource>> createOrUpdate(
6868
@HeaderParam("If-None-Match") String ifNoneMatch,
6969
@HeaderParam("Prefer") String prefer,
7070
@QueryParam("api-version") String apiVersion,
71+
@QueryParam("ignoreResetRequirements") Boolean ignoreResetRequirements,
7172
@HeaderParam("Accept") String accept,
7273
@BodyParam("application/json") SearchIndexerDataSource dataSource,
7374
Context context);
@@ -128,6 +129,7 @@ Mono<Response<SearchIndexerDataSource>> create(
128129
* matches this value.
129130
* @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the
130131
* server does not match this value.
132+
* @param ignoreResetRequirements Ignores cache reset requirements.
131133
* @param requestOptions Parameter group.
132134
* @param context The context to associate with this operation.
133135
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -141,6 +143,7 @@ public Mono<Response<SearchIndexerDataSource>> createOrUpdateWithResponseAsync(
141143
SearchIndexerDataSource dataSource,
142144
String ifMatch,
143145
String ifNoneMatch,
146+
Boolean ignoreResetRequirements,
144147
RequestOptions requestOptions,
145148
Context context) {
146149
final String prefer = "return=representation";
@@ -158,6 +161,7 @@ public Mono<Response<SearchIndexerDataSource>> createOrUpdateWithResponseAsync(
158161
ifNoneMatch,
159162
prefer,
160163
this.client.getApiVersion(),
164+
ignoreResetRequirements,
161165
accept,
162166
dataSource,
163167
context);

sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/IndexersImpl.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ Mono<Response<SearchIndexer>> createOrUpdate(
9090
@HeaderParam("If-None-Match") String ifNoneMatch,
9191
@HeaderParam("Prefer") String prefer,
9292
@QueryParam("api-version") String apiVersion,
93+
@QueryParam("disableCacheReprocessingChangeDetection") Boolean disableCacheReprocessingChangeDetection,
94+
@QueryParam("ignoreResetRequirements") Boolean ignoreResetRequirements,
9395
@HeaderParam("Accept") String accept,
9496
@BodyParam("application/json") SearchIndexer indexer,
9597
Context context);
@@ -219,6 +221,8 @@ public Mono<Response<Void>> runWithResponseAsync(
219221
* matches this value.
220222
* @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the
221223
* server does not match this value.
224+
* @param disableCacheReprocessingChangeDetection Disables cache reprocessing change detection.
225+
* @param ignoreResetRequirements Ignores cache reset requirements.
222226
* @param requestOptions Parameter group.
223227
* @param context The context to associate with this operation.
224228
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -232,6 +236,8 @@ public Mono<Response<SearchIndexer>> createOrUpdateWithResponseAsync(
232236
SearchIndexer indexer,
233237
String ifMatch,
234238
String ifNoneMatch,
239+
Boolean disableCacheReprocessingChangeDetection,
240+
Boolean ignoreResetRequirements,
235241
RequestOptions requestOptions,
236242
Context context) {
237243
final String prefer = "return=representation";
@@ -249,6 +255,8 @@ public Mono<Response<SearchIndexer>> createOrUpdateWithResponseAsync(
249255
ifNoneMatch,
250256
prefer,
251257
this.client.getApiVersion(),
258+
disableCacheReprocessingChangeDetection,
259+
ignoreResetRequirements,
252260
accept,
253261
indexer,
254262
context);

sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/SkillsetsImpl.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ Mono<Response<SearchIndexerSkillset>> createOrUpdate(
6868
@HeaderParam("If-None-Match") String ifNoneMatch,
6969
@HeaderParam("Prefer") String prefer,
7070
@QueryParam("api-version") String apiVersion,
71+
@QueryParam("disableCacheReprocessingChangeDetection") Boolean disableCacheReprocessingChangeDetection,
72+
@QueryParam("ignoreResetRequirements") Boolean ignoreResetRequirements,
7173
@HeaderParam("Accept") String accept,
7274
@BodyParam("application/json") SearchIndexerSkillset skillset,
7375
Context context);
@@ -128,6 +130,8 @@ Mono<Response<SearchIndexerSkillset>> create(
128130
* matches this value.
129131
* @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the
130132
* server does not match this value.
133+
* @param disableCacheReprocessingChangeDetection Disables cache reprocessing change detection.
134+
* @param ignoreResetRequirements Ignores cache reset requirements.
131135
* @param requestOptions Parameter group.
132136
* @param context The context to associate with this operation.
133137
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -141,6 +145,8 @@ public Mono<Response<SearchIndexerSkillset>> createOrUpdateWithResponseAsync(
141145
SearchIndexerSkillset skillset,
142146
String ifMatch,
143147
String ifNoneMatch,
148+
Boolean disableCacheReprocessingChangeDetection,
149+
Boolean ignoreResetRequirements,
144150
RequestOptions requestOptions,
145151
Context context) {
146152
final String prefer = "return=representation";
@@ -158,6 +164,8 @@ public Mono<Response<SearchIndexerSkillset>> createOrUpdateWithResponseAsync(
158164
ifNoneMatch,
159165
prefer,
160166
this.client.getApiVersion(),
167+
disableCacheReprocessingChangeDetection,
168+
ignoreResetRequirements,
161169
accept,
162170
skillset,
163171
context);

sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/models/SearchIndexer.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.azure.core.annotation.Fluent;
1010
import com.azure.search.documents.indexes.models.FieldMapping;
1111
import com.azure.search.documents.indexes.models.IndexingSchedule;
12+
import com.azure.search.documents.indexes.models.SearchIndexerCache;
1213
import com.azure.search.documents.indexes.models.SearchResourceEncryptionKey;
1314
import com.fasterxml.jackson.annotation.JsonProperty;
1415
import java.util.List;
@@ -101,6 +102,13 @@ public final class SearchIndexer {
101102
@JsonProperty(value = "encryptionKey")
102103
private SearchResourceEncryptionKey encryptionKey;
103104

105+
/*
106+
* Adds caching to an enrichment pipeline to allow for incremental
107+
* modification steps without having to rebuild the index every time.
108+
*/
109+
@JsonProperty(value = "cache")
110+
private SearchIndexerCache cache;
111+
104112
/**
105113
* Get the name property: The name of the indexer.
106114
*
@@ -358,4 +366,26 @@ public SearchIndexer setEncryptionKey(SearchResourceEncryptionKey encryptionKey)
358366
this.encryptionKey = encryptionKey;
359367
return this;
360368
}
369+
370+
/**
371+
* Get the cache property: Adds caching to an enrichment pipeline to allow for incremental modification steps
372+
* without having to rebuild the index every time.
373+
*
374+
* @return the cache value.
375+
*/
376+
public SearchIndexerCache getCache() {
377+
return this.cache;
378+
}
379+
380+
/**
381+
* Set the cache property: Adds caching to an enrichment pipeline to allow for incremental modification steps
382+
* without having to rebuild the index every time.
383+
*
384+
* @param cache the cache value to set.
385+
* @return the SearchIndexer object itself.
386+
*/
387+
public SearchIndexer setCache(SearchIndexerCache cache) {
388+
this.cache = cache;
389+
return this;
390+
}
361391
}

0 commit comments

Comments
 (0)