diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml index 891d637a644d..1a88861759f3 100755 --- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml +++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml @@ -491,4 +491,12 @@ + + + + + + diff --git a/sdk/search/azure-search-documents/CHANGELOG.md b/sdk/search/azure-search-documents/CHANGELOG.md index 21c771d16e24..70b572b66079 100644 --- a/sdk/search/azure-search-documents/CHANGELOG.md +++ b/sdk/search/azure-search-documents/CHANGELOG.md @@ -1,10 +1,24 @@ # Release History -## 11.0.0 (Unreleased) +## 11.0.0 (2020-07-10) + - Changed version to 11.0.0. -- Removed preview version `SearchClientOptions.ServiceVersion.V2019_05_06_Preview` - and added version `SearchClientOptions.ServiceVersion.V2020_06_30`. -- Added value constructors for required parameters. +- Removed preview version `SearchClientOptions.ServiceVersion.V2019_05_06_Preview` and added version `SearchClientOptions.ServiceVersion.V2020_06_30`. + +### New Features + +- Added `IndexDocumentsOptions` used to configure document operations. + +### Breaking Changes + +- Moved search result metadata to `SearchPagedFlux` and `SearchPagedIterable` from `SearchPagedResponse`. +- Changed many model classes from fluent setter pattern to immutable constructor pattern. +- Removed `RequestOptions` from APIs, instead use pipeline context to pass per method contextual information. +- Removed strongly type GeoJSON classes. + +### Bug Fixes + +- Removed `implementation` classes from APIs. ## 1.0.0-beta.4 (2020-06-09) - Split `SearchServiceClient` into two clients `SearchIndexClient`, `SearchIndexerClient`. diff --git a/sdk/search/azure-search-documents/README.md b/sdk/search/azure-search-documents/README.md index 3c03e0a53da1..9f1a519d1448 100644 --- a/sdk/search/azure-search-documents/README.md +++ b/sdk/search/azure-search-documents/README.md @@ -21,7 +21,7 @@ The Azure Cognitive Search service is well suited for the following * In a search client application, implement query logic and user experiences similar to commercial web search engines. -Use the Azure Search client library to: +Use the Azure Cognitive Search client library to: * Submit queries for simple and advanced query forms that include fuzzy search, wildcard search, regular expressions. diff --git a/sdk/search/azure-search-documents/pom.xml b/sdk/search/azure-search-documents/pom.xml index 41d86df154d4..b82c30ad3bd6 100644 --- a/sdk/search/azure-search-documents/pom.xml +++ b/sdk/search/azure-search-documents/pom.xml @@ -11,8 +11,8 @@ ../../parents/azure-client-sdk-parent - Microsoft Azure Search client for Java - This package contains client functionality for Microsoft Azure Search + Microsoft Azure Cognitive Search client for Java + This package contains client functionality for Microsoft Azure Cognitive Search com.azure azure-search-documents diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchAsyncClient.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchAsyncClient.java index 66950b98e0b9..4320fc63a350 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchAsyncClient.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchAsyncClient.java @@ -69,7 +69,10 @@ import static com.azure.core.util.FluxUtil.withContext; /** - * Cognitive Search Asynchronous Client to query an index and upload, merge, or delete documents + * This class provides a client that contains the operations for querying an index and uploading, merging, or deleting + * documents in an Azure Cognitive Search service. + * + * @see SearchClientBuilder */ @ServiceClient(builder = SearchClientBuilder.class, isAsync = true) public final class SearchAsyncClient { @@ -213,8 +216,7 @@ public Mono> uploadDocumentsWithResponse(Iterable Mono> uploadDocumentsWithResponse(Iterable documents, IndexDocumentsOptions options, Context context) { - return indexDocumentsWithResponse(buildIndexBatch(documents, IndexActionType.UPLOAD), options, - context); + return indexDocumentsWithResponse(buildIndexBatch(documents, IndexActionType.UPLOAD), options, context); } /** @@ -283,8 +285,7 @@ public Mono> mergeDocumentsWithResponse(Iterable< Mono> mergeDocumentsWithResponse(Iterable documents, IndexDocumentsOptions options, Context context) { - return indexDocumentsWithResponse(buildIndexBatch(documents, IndexActionType.MERGE), options, - context); + return indexDocumentsWithResponse(buildIndexBatch(documents, IndexActionType.MERGE), options, context); } /** @@ -411,8 +412,7 @@ public Mono> deleteDocumentsWithResponse(Iterable Mono> deleteDocumentsWithResponse(Iterable documents, IndexDocumentsOptions options, Context context) { - return indexDocumentsWithResponse(buildIndexBatch(documents, IndexActionType.DELETE), options, - context); + return indexDocumentsWithResponse(buildIndexBatch(documents, IndexActionType.DELETE), options, context); } /** @@ -468,11 +468,9 @@ public Mono> indexDocumentsWithResponse(IndexDocu Mono> indexDocumentsWithResponse(IndexDocumentsBatch batch, IndexDocumentsOptions options, Context context) { try { - IndexDocumentsOptions documentsOptions = (options == null) - ? new IndexDocumentsOptions() : options; + IndexDocumentsOptions documentsOptions = (options == null) ? new IndexDocumentsOptions() : options; return restClient.getDocuments() - .indexWithResponseAsync(IndexBatchBaseConverter.map(batch), null, - context) + .indexWithResponseAsync(IndexBatchBaseConverter.map(batch), null, context) .onErrorMap(MappingUtils::exceptionMapper) .flatMap(response -> (response.getStatusCode() == MULTI_STATUS_CODE && documentsOptions.throwOnAnyError()) @@ -527,22 +525,21 @@ public Mono getDocument(String key, Class modelClass) { * @see Lookup document */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDocumentWithResponse(String key, Class modelClass, - List selectedFields) { - return withContext(context -> getDocumentWithResponse(key, modelClass, - selectedFields, context)); + public Mono> getDocumentWithResponse(String key, Class modelClass, List selectedFields) { + return withContext(context -> getDocumentWithResponse(key, modelClass, selectedFields, context)); } @SuppressWarnings("unchecked") - Mono> getDocumentWithResponse(String key, Class modelClass, - List selectedFields, Context context) { + Mono> getDocumentWithResponse(String key, Class modelClass, List selectedFields, + Context context) { try { return restClient.getDocuments() .getWithResponseAsync(key, selectedFields, null, context) .onErrorMap(DocumentResponseConversions::exceptionMapper) .map(res -> { if (SearchDocument.class == modelClass) { - TypeReference> typeReference = new TypeReference>() { }; + TypeReference> typeReference = new TypeReference>() { + }; SearchDocument doc = new SearchDocument(MAPPER.convertValue(res.getValue(), typeReference)); return new SimpleResponse(res, (T) doc); } @@ -603,7 +600,7 @@ Mono> getDocumentCountWithResponse(Context context) { *

* If {@code searchText} is set to {@code null} or {@code "*"} all documents will be matched, see * simple query - * syntax in Azure Search for more information about search query syntax. + * syntax in Azure Cognitive Search for more information about search query syntax. * *

Code Sample

* @@ -617,8 +614,9 @@ Mono> getDocumentCountWithResponse(Context context) { * information. * @see Search documents */ + @ServiceMethod(returns = ReturnType.COLLECTION) public SearchPagedFlux search(String searchText) { - return this.search(searchText, null, null); + return this.search(searchText, null); } /** @@ -626,7 +624,7 @@ public SearchPagedFlux search(String searchText) { *

* If {@code searchText} is set to {@code null} or {@code "*"} all documents will be matched, see * simple query - * syntax in Azure Search for more information about search query syntax. + * syntax in Azure Cognitive Search for more information about search query syntax. * *

Code Sample

* @@ -641,6 +639,7 @@ public SearchPagedFlux search(String searchText) { * information. * @see Search documents */ + @ServiceMethod(returns = ReturnType.COLLECTION) public SearchPagedFlux search(String searchText, SearchOptions searchOptions) { SearchRequest request = createSearchRequest(searchText, searchOptions); // The firstPageResponse shared among all fucntional calls below. @@ -661,16 +660,16 @@ SearchPagedFlux search(String searchText, SearchOptions searchOptions, Context c return new SearchPagedFlux(() -> func.apply(null), func); } - private Mono search(SearchRequest request, - String continuationToken, SearchFirstPageResponseWrapper firstPageResponseWrapper, Context context) { + private Mono search(SearchRequest request, String continuationToken, + SearchFirstPageResponseWrapper firstPageResponseWrapper, Context context) { if (continuationToken == null && firstPageResponseWrapper.getFirstPageResponse() != null) { return Mono.just(firstPageResponseWrapper.getFirstPageResponse()); } - SearchRequest requestToUse = (continuationToken == null) ? request + SearchRequest requestToUse = (continuationToken == null) + ? request : SearchContinuationToken.deserializeToken(serviceVersion.getVersion(), continuationToken); - return restClient.getDocuments().searchPostWithResponseAsync(requestToUse, - null, context) + return restClient.getDocuments().searchPostWithResponseAsync(requestToUse, null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(response -> { SearchDocumentsResult result = response.getValue(); @@ -726,6 +725,7 @@ private static Map> getFacets(SearchDocumentsResult re * {@link SuggestPagedResponse} object for each page containing HTTP response and coverage information. * @see Suggestions */ + @ServiceMethod(returns = ReturnType.COLLECTION) public SuggestPagedFlux suggest(String searchText, String suggesterName) { return suggest(searchText, suggesterName, null); } @@ -747,6 +747,7 @@ public SuggestPagedFlux suggest(String searchText, String suggesterName) { * {@link SuggestPagedResponse} object for each page containing HTTP response and coverage information. * @see Suggestions */ + @ServiceMethod(returns = ReturnType.COLLECTION) public SuggestPagedFlux suggest(String searchText, String suggesterName, SuggestOptions suggestOptions) { SuggestRequest suggestRequest = createSuggestRequest(searchText, suggesterName, SuggestOptionsHandler.ensureSuggestOptions(suggestOptions)); @@ -762,8 +763,7 @@ SuggestPagedFlux suggest(String searchText, String suggesterName, SuggestOptions } private Mono suggest(SuggestRequest suggestRequest, Context context) { - return restClient.getDocuments().suggestPostWithResponseAsync(suggestRequest, - null, context) + return restClient.getDocuments().suggestPostWithResponseAsync(suggestRequest, null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(response -> { SuggestDocumentsResult result = response.getValue(); @@ -792,8 +792,9 @@ private static List getSuggestResults(SuggestDocumentsResult resu * @param suggesterName suggester name * @return auto complete result. */ + @ServiceMethod(returns = ReturnType.COLLECTION) public AutocompletePagedFlux autocomplete(String searchText, String suggesterName) { - return autocomplete(searchText, suggesterName, null, null); + return autocomplete(searchText, suggesterName, null); } /** @@ -825,8 +826,7 @@ AutocompletePagedFlux autocomplete(String searchText, String suggesterName, Auto } private Mono autocomplete(AutocompleteRequest request, Context context) { - return restClient.getDocuments().autocompletePostWithResponseAsync(request, - null, context) + return restClient.getDocuments().autocompletePostWithResponseAsync(request, null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(MappingUtils::mappingAutocompleteResponse); } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchClient.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchClient.java index 52964b5a4aba..7e776fa2993e 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchClient.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchClient.java @@ -27,7 +27,10 @@ import java.util.List; /** - * Cognitive Search Synchronous Client to query an index and upload, merge, or delete documents + * This class provides a client that contains the operations for querying an index and uploading, merging, or deleting + * documents in an Azure Cognitive Search service. + * + * @see SearchClientBuilder */ @ServiceClient(builder = SearchClientBuilder.class) public final class SearchClient { @@ -182,7 +185,7 @@ public IndexDocumentsResult mergeDocuments(Iterable documents) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response mergeDocumentsWithResponse(Iterable documents, - IndexDocumentsOptions options, Context context) { + IndexDocumentsOptions options, Context context) { return asyncClient.mergeDocumentsWithResponse(documents, options, context).block(); } @@ -249,7 +252,7 @@ public IndexDocumentsResult mergeOrUploadDocuments(Iterable documents) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response mergeOrUploadDocumentsWithResponse(Iterable documents, - IndexDocumentsOptions options, Context context) { + IndexDocumentsOptions options, Context context) { return asyncClient.mergeOrUploadDocumentsWithResponse(documents, options, context).block(); } @@ -443,7 +446,7 @@ public Response getDocumentCountWithResponse(Context context) { *

* If {@code searchText} is set to {@code null} or {@code "*"} all documents will be matched, see * simple query - * syntax in Azure Search for more information about search query syntax. + * syntax in Azure Cognitive Search for more information about search query syntax. * *

Code Sample

* @@ -457,6 +460,7 @@ public Response getDocumentCountWithResponse(Context context) { * information. * @see Search documents */ + @ServiceMethod(returns = ReturnType.COLLECTION) public SearchPagedIterable search(String searchText) { return search(searchText, null, Context.NONE); } @@ -466,7 +470,7 @@ public SearchPagedIterable search(String searchText) { *

* If {@code searchText} is set to {@code null} or {@code "*"} all documents will be matched, see * simple query - * syntax in Azure Search for more information about search query syntax. + * syntax in Azure Cognitive Search for more information about search query syntax. * *

Code Sample

* @@ -482,6 +486,7 @@ public SearchPagedIterable search(String searchText) { * information. * @see Search documents */ + @ServiceMethod(returns = ReturnType.COLLECTION) public SearchPagedIterable search(String searchText, SearchOptions searchOptions, Context context) { return new SearchPagedIterable(asyncClient.search(searchText, searchOptions, context)); } @@ -502,6 +507,7 @@ public SearchPagedIterable search(String searchText, SearchOptions searchOptions * the {@link SuggestPagedResponse} object for each page containing HTTP response and coverage information. * @see Suggestions */ + @ServiceMethod(returns = ReturnType.COLLECTION) public SuggestPagedIterable suggest(String searchText, String suggesterName) { return suggest(searchText, suggesterName, null, Context.NONE); } @@ -524,10 +530,10 @@ public SuggestPagedIterable suggest(String searchText, String suggesterName) { * the {@link SuggestPagedResponse} object for each page containing HTTP response and coverage information. * @see Suggestions */ + @ServiceMethod(returns = ReturnType.COLLECTION) public SuggestPagedIterable suggest(String searchText, String suggesterName, SuggestOptions suggestOptions, Context context) { - return new SuggestPagedIterable(asyncClient.suggest(searchText, suggesterName, suggestOptions, - context)); + return new SuggestPagedIterable(asyncClient.suggest(searchText, suggesterName, suggestOptions, context)); } /** @@ -543,6 +549,7 @@ public SuggestPagedIterable suggest(String searchText, String suggesterName, Sug * @param suggesterName suggester name * @return auto complete result. */ + @ServiceMethod(returns = ReturnType.COLLECTION) public AutocompletePagedIterable autocomplete(String searchText, String suggesterName) { return autocomplete(searchText, suggesterName, null, Context.NONE); } @@ -562,6 +569,7 @@ public AutocompletePagedIterable autocomplete(String searchText, String suggeste * @param context additional context that is passed through the HTTP pipeline during the service call * @return auto complete result. */ + @ServiceMethod(returns = ReturnType.COLLECTION) public AutocompletePagedIterable autocomplete(String searchText, String suggesterName, AutocompleteOptions autocompleteOptions, Context context) { return new AutocompletePagedIterable(asyncClient.autocomplete(searchText, suggesterName, autocompleteOptions, diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchClientBuilder.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchClientBuilder.java index 17056e6cd6f6..50421a2b514a 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchClientBuilder.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchClientBuilder.java @@ -33,15 +33,13 @@ /** * This class provides a fluent builder API to help aid the configuration and instantiation of {@link SearchClient - * SearchClients} and {@link SearchAsyncClient SearchAsyncClients}. Call {@link #buildClient() - * buildClient} and {@link #buildAsyncClient() buildAsyncClient} respectively to construct an instance of the desired - * client. + * SearchClients} and {@link SearchAsyncClient SearchAsyncClients}. Call {@link #buildClient() buildClient} and {@link + * #buildAsyncClient() buildAsyncClient} respectively to construct an instance of the desired client. *

- * The client needs to at least provide the following required fields - *

+ * The following must be provided to construct a client instance. *
    - *
  • the service endpoint of the Azure Cognitive Search to access the resource service.
  • - *
  • {@link #credential(AzureKeyCredential)} gives the builder access credential.
  • + *
  • The Azure Cognitive Search service URL.
  • + *
  • An {@link AzureKeyCredential} that grants access to the Azure Cognitive Search service.
  • *
  • The search index name.
  • *
* @@ -89,8 +87,8 @@ public final class SearchClientBuilder { /** - * Creates a builder instance that is able to configure and construct {@link SearchClient SearchClients} - * and {@link SearchAsyncClient SearchAsyncClients}. + * Creates a builder instance that is able to configure and construct {@link SearchClient SearchClients} and {@link + * SearchAsyncClient SearchAsyncClients}. */ public SearchClientBuilder() { Map properties = CoreUtils.getProperties(SEARCH_PROPERTIES); @@ -99,12 +97,12 @@ public SearchClientBuilder() { } /** - * Creates a {@link SearchClient} based on options set in the Builder. Every time {@code buildClient()} is - * called a new instance of {@link SearchClient} is created. + * Creates a {@link SearchClient} based on options set in the builder. Every time {@code buildClient()} is called a + * new instance of {@link SearchClient} is created. *

* If {@link #pipeline(HttpPipeline) pipeline} is set, then only the {@code pipeline}, {@link #endpoint(String) - * endpoint}, and {@link #indexName(String) indexName} are used to create the {@link SearchClient client}. - * All other builder settings are ignored. + * endpoint}, and {@link #indexName(String) indexName} are used to create the {@link SearchClient client}. All other + * builder settings are ignored. * * @return A SearchClient with the options set from the builder. * @throws NullPointerException If {@code indexName} or {@code endpoint} are {@code null}. @@ -114,12 +112,12 @@ public SearchClient buildClient() { } /** - * Creates a {@link SearchAsyncClient} based on options set in the Builder. Every time - * {@code buildAsyncClient()} is called a new instance of {@link SearchAsyncClient} is created. + * Creates a {@link SearchAsyncClient} based on options set in the builder. Every time {@code buildAsyncClient()} is + * called a new instance of {@link SearchAsyncClient} is created. *

* If {@link #pipeline(HttpPipeline) pipeline} is set, then only the {@code pipeline}, {@link #endpoint(String) - * endpoint}, and {@link #indexName(String) indexName} are used to create the {@link SearchAsyncClient client}. - * All other builder settings are ignored. + * endpoint}, and {@link #indexName(String) indexName} are used to create the {@link SearchAsyncClient client}. All + * other builder settings are ignored. * * @return A SearchClient with the options set from the builder. * @throws NullPointerException If {@code indexName} or {@code endpoint} are {@code null}. @@ -170,9 +168,9 @@ public SearchAsyncClient buildAsyncClient() { } /** - * Sets the service endpoint for the Azure Search instance. + * Sets the service endpoint for the Azure Cognitive Search instance. * - * @param endpoint The URL of the Azure Search instance. + * @param endpoint The URL of the Azure Cognitive Search instance. * @return The updated SearchClientBuilder object. * @throws IllegalArgumentException If {@code endpoint} is null or it cannot be parsed into a valid URL. */ @@ -307,7 +305,7 @@ public SearchClientBuilder retryPolicy(RetryPolicy retryPolicy) { * Sets the {@link SearchServiceVersion} that is used when making API requests. *

* If a service version is not provided, {@link SearchServiceVersion#getLatest()} will be used as a default. When - * this default is used updating to a newer client library may result in a newer version of the service being used. + * the default is used, updating to a newer client library may implicitly use a newer version of the service. * * @param serviceVersion The version of the service to be used when making requests. * @return The updated SearchClientBuilder object. diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchDocument.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchDocument.java index c15e2b4b3b18..39a92ae538ab 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchDocument.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchDocument.java @@ -7,26 +7,22 @@ import java.util.Map; /** - * Represents a document - *

- * A property bag is used for scenarios where the index schema is only known at run-time - *

- * If the schema is known, user can convert the properties to a specific object type + * Represents an untyped document returned from a search or document lookup. */ public final class SearchDocument extends HashMap { private static final long serialVersionUID = 1L; /** - * Default empty constructor + * Initializes a new instance of the SearchDocument class. */ public SearchDocument() { super(); } /** - * Constructs a new {@code Document} with the same mappings as the specified {@code Map}. + * Initializes a new instance of the SearchDocument class with initial values. * - * @param propertyMap the map whose mappings are to be placed in this map + * @param propertyMap Initial values of the document. */ public SearchDocument(Map propertyMap) { super(propertyMap); diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchServiceVersion.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchServiceVersion.java index 0751e21c93a6..bc33b3df930d 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchServiceVersion.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchServiceVersion.java @@ -6,7 +6,7 @@ import com.azure.core.util.ServiceVersion; /** - * The versions of Azure Search supported by this client library. + * The versions of Azure Cognitive Search supported by this client library. */ public enum SearchServiceVersion implements ServiceVersion { V2020_06_30("2020-06-30"); @@ -26,9 +26,9 @@ public String getVersion() { } /** - * Gets the latest service version supported by this client library + * Gets the latest service version supported by this client library. * - * @return the latest {@link SearchServiceVersion} + * @return The latest version supported by this client library. */ public static SearchServiceVersion getLatest() { return V2020_06_30; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexAsyncClient.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexAsyncClient.java index c35dd69c612d..a2e67069e3bf 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexAsyncClient.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexAsyncClient.java @@ -38,7 +38,10 @@ import static com.azure.core.util.FluxUtil.withContext; /** - * Asynchronous Client to manage and query indexes, as well as Synonym Map, on a Cognitive Search service + * This class provides a client that contains the operations for creating, getting, listing, updating, or deleting + * indexes or synonym map and analyzing text in an Azure Cognitive Search service. + * + * @see SearchIndexClientBuilder */ @ServiceClient(builder = SearchIndexClientBuilder.class, isAsync = true) public final class SearchIndexAsyncClient { @@ -75,7 +78,7 @@ public final class SearchIndexAsyncClient { this.restClient = new SearchServiceClientImplBuilder() .endpoint(endpoint) - // .apiVersion(serviceVersion.getVersion()) + // .apiVersion(serviceVersion.getVersion()) .pipeline(httpPipeline) .buildClient(); } @@ -308,8 +311,7 @@ public PagedFlux listIndexNames() { PagedFlux listIndexNames(Context context) { try { return new PagedFlux<>(() -> this.listIndexesWithResponse("name", context) - .map(MappingUtils::mappingPagingSearchIndexNames) - ); + .map(MappingUtils::mappingPagingSearchIndexNames)); } catch (RuntimeException ex) { return pagedFluxError(logger, ex); } @@ -371,8 +373,7 @@ Mono> createOrUpdateIndexWithResponse(SearchIndex index, b String ifMatch = onlyIfUnchanged ? index.getETag() : null; return restClient.getIndexes() .createOrUpdateWithResponseAsync(index.getName(), SearchIndexConverter.map(index), - allowIndexDowntime, ifMatch, null, - null, context) + allowIndexDowntime, ifMatch, null, null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(MappingUtils::mappingExternalSearchIndex); } catch (RuntimeException ex) { @@ -421,8 +422,7 @@ public Mono> deleteIndexWithResponse(SearchIndex index, boolean o Mono> deleteIndexWithResponse(String indexName, String etag, Context context) { try { return restClient.getIndexes() - .deleteWithResponseAsync(indexName, etag, null, - null, context) + .deleteWithResponseAsync(indexName, etag, null, null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(Function.identity()); } catch (RuntimeException ex) { @@ -465,8 +465,7 @@ PagedFlux analyzeText(String indexName, AnalyzeTextOptions an private Mono> analyzeTextWithResponse(String indexName, AnalyzeTextOptions analyzeTextOptions, Context context) { return restClient.getIndexes() - .analyzeWithResponseAsync(indexName, AnalyzeRequestConverter.map(analyzeTextOptions), - null, context) + .analyzeWithResponseAsync(indexName, AnalyzeRequestConverter.map(analyzeTextOptions), null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(MappingUtils::mappingTokenInfo); } @@ -510,8 +509,7 @@ Mono> createSynonymMapWithResponse(SynonymMap synonymMap, Objects.requireNonNull(synonymMap, "'SynonymMap' cannot be null."); try { return restClient.getSynonymMaps() - .createWithResponseAsync(SynonymMapConverter.map(synonymMap), - null, context) + .createWithResponseAsync(SynonymMapConverter.map(synonymMap), null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(MappingUtils::mappingExternalSynonymMap); } catch (RuntimeException ex) { @@ -553,8 +551,7 @@ public Mono> getSynonymMapWithResponse(String synonymMapNam return withContext(context -> getSynonymMapWithResponse(synonymMapName, context)); } - Mono> getSynonymMapWithResponse(String synonymMapName, - Context context) { + Mono> getSynonymMapWithResponse(String synonymMapName, Context context) { try { return restClient.getSynonymMaps() .getWithResponseAsync(synonymMapName, null, context) @@ -627,8 +624,7 @@ PagedFlux listSynonymMapNames(Context context) { } } - private Mono> listSynonymMapsWithResponse(String select, - Context context) { + private Mono> listSynonymMapsWithResponse(String select, Context context) { return restClient.getSynonymMaps() .listWithResponseAsync(select, null, context) .onErrorMap(MappingUtils::exceptionMapper); @@ -679,9 +675,7 @@ Mono> createOrUpdateSynonymMapWithResponse(SynonymMap synon try { return restClient.getSynonymMaps() .createOrUpdateWithResponseAsync(synonymMap.getName(), SynonymMapConverter.map(synonymMap), - ifMatch, null, - null, - context) + ifMatch, null, null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(MappingUtils::mappingExternalSynonymMap); } catch (RuntimeException ex) { @@ -725,16 +719,14 @@ public Mono deleteSynonymMap(String synonymMapName) { public Mono> deleteSynonymMapWithResponse(SynonymMap synonymMap, boolean onlyIfUnchanged) { Objects.requireNonNull(synonymMap, "'SynonymMap' cannot be null"); String etag = onlyIfUnchanged ? synonymMap.getETag() : null; - return withContext(context -> - deleteSynonymMapWithResponse(synonymMap.getName(), etag, context)); + return withContext(context -> deleteSynonymMapWithResponse(synonymMap.getName(), etag, context)); } Mono> deleteSynonymMapWithResponse(String synonymMapName, String etag, Context context) { try { return restClient.getSynonymMaps() - .deleteWithResponseAsync(synonymMapName, etag, null, - null, context) + .deleteWithResponseAsync(synonymMapName, etag, null, null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(Function.identity()); } catch (RuntimeException ex) { diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexClient.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexClient.java index 7988efe02473..e5fde4706f60 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexClient.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexClient.java @@ -20,7 +20,10 @@ import com.azure.search.documents.indexes.models.SynonymMap; /** - * Synchronous Client to manage and query indexes, as well as manage Synonym Map, on a Cognitive Search service + * This class provides a client that contains the operations for creating, getting, listing, updating, or deleting + * indexes or synonym map and analyzing text in an Azure Cognitive Search service. + * + * @see SearchIndexClientBuilder */ @ServiceClient(builder = SearchIndexClientBuilder.class) public final class SearchIndexClient { diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexClientBuilder.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexClientBuilder.java index c7bcd43d5b1e..a5b20e7ee701 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexClientBuilder.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexClientBuilder.java @@ -32,16 +32,15 @@ import java.util.Objects; /** - * This class provides a fluent builder API to help aid the configuration and instantiation of {@link - * SearchIndexClient SearchIndexClients} and {@link SearchIndexAsyncClient SearchIndexAsyncClients}. Call {@link - * #buildClient() buildClient} and {@link #buildAsyncClient() buildAsyncClient} respectively to construct an instance of - * the desired client. + * This class provides a fluent builder API to help aid the configuration and instantiation of {@link SearchIndexClient + * SearchIndexClients} and {@link SearchIndexAsyncClient SearchIndexAsyncClients}. Call {@link #buildClient() + * buildClient} and {@link #buildAsyncClient() buildAsyncClient} respectively to construct an instance of the desired + * client. *

- * The client needs to at least provide the following required fields - *

+ * The following must be provided to construct a client instance. *
    - *
  • the service endpoint of the Azure Cognitive Search to access the resource service.
  • - *
  • {@link #credential(AzureKeyCredential)} gives the builder access credential.
  • + *
  • The Azure Cognitive Search service URL.
  • + *
  • An {@link AzureKeyCredential} that grants access to the Azure Cognitive Search service.
  • *
* *

Instantiating an asynchronous Search Index Client

@@ -86,8 +85,8 @@ public final class SearchIndexClientBuilder { private RetryPolicy retryPolicy; /** - * Creates a builder instance that is able to configure and construct {@link SearchIndexClient - * SearchIndexClients} and {@link SearchIndexAsyncClient SearchIndexAsyncClients}. + * Creates a builder instance that is able to configure and construct {@link SearchIndexClient SearchIndexClients} + * and {@link SearchIndexAsyncClient SearchIndexAsyncClients}. */ public SearchIndexClientBuilder() { Map properties = CoreUtils.getProperties(SEARCH_PROPERTIES); @@ -114,8 +113,7 @@ public SearchIndexClient buildClient() { * buildAsyncClient()} is called a new instance of {@link SearchIndexAsyncClient} is created. *

* If {@link #pipeline(HttpPipeline) pipeline} is set, then only the {@code pipeline} and {@link #endpoint(String) - * endpoint} are used to create the {@link SearchIndexAsyncClient client}. All other builder settings are - * ignored. + * endpoint} are used to create the {@link SearchIndexAsyncClient client}. All other builder settings are ignored. * * @return A SearchIndexAsyncClient with the options set from the builder. * @throws NullPointerException If {@code endpoint} are {@code null}. @@ -165,9 +163,9 @@ public SearchIndexAsyncClient buildAsyncClient() { } /** - * Sets the service endpoint for the Azure Search instance. + * Sets the service endpoint for the Azure Cognitive Search instance. * - * @param endpoint The URL of the Azure Search instance. + * @param endpoint The URL of the Azure Cognitive Search instance. * @return The updated SearchIndexClientBuilder object. * @throws IllegalArgumentException If {@code endpoint} is null or it cannot be parsed into a valid URL. */ diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexerAsyncClient.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexerAsyncClient.java index 141f6096f4f6..ad4d89e99dc8 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexerAsyncClient.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexerAsyncClient.java @@ -4,6 +4,7 @@ package com.azure.search.documents.indexes; import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.HttpPipeline; import com.azure.core.http.rest.PagedFlux; @@ -35,8 +36,12 @@ import static com.azure.core.util.FluxUtil.withContext; /** - * Asynchronous Client to manage and query indexers, as well as manage other resources, on a Cognitive Search service + * This class provides a client that contains the operations for creating, getting, listing, updating, or deleting data + * source connections, indexers, or skillsets and running or resetting indexers in an Azure Cognitive Search service. + * + * @see SearchIndexerClientBuilder */ +@ServiceClient(builder = SearchIndexerClientBuilder.class, isAsync = true) public class SearchIndexerAsyncClient { /** * Search REST API Version @@ -70,7 +75,7 @@ public class SearchIndexerAsyncClient { this.restClient = new SearchServiceClientImplBuilder() .endpoint(endpoint) - // .apiVersion(serviceVersion.getVersion()) + // .apiVersion(serviceVersion.getVersion()) .pipeline(httpPipeline) .buildClient(); } @@ -133,8 +138,7 @@ public Mono> createOrUpdateDataSourc } Mono> createOrUpdateDataSourceConnectionWithResponse( - SearchIndexerDataSourceConnection dataSource, - boolean onlyIfUnchanged, Context context) { + SearchIndexerDataSourceConnection dataSource, boolean onlyIfUnchanged, Context context) { Objects.requireNonNull(dataSource, "'DataSource' cannot be null."); String ifMatch = onlyIfUnchanged ? dataSource.getETag() : null; if (dataSource.getConnectionString() == null) { @@ -143,9 +147,8 @@ Mono> createOrUpdateDataSourceConnec try { return restClient .getDataSources() - .createOrUpdateWithResponseAsync(dataSource.getName(), - SearchIndexerDataSourceConverter.map(dataSource), ifMatch, null, - null, context) + .createOrUpdateWithResponseAsync(dataSource.getName(), SearchIndexerDataSourceConverter.map(dataSource), + ifMatch, null, null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(MappingUtils::mappingExternalDataSource); } catch (RuntimeException ex) { @@ -193,8 +196,7 @@ Mono> createDataSourceConnectionWith SearchIndexerDataSourceConnection dataSource, Context context) { try { return restClient.getDataSources() - .createWithResponseAsync(SearchIndexerDataSourceConverter.map(dataSource), - null, context) + .createWithResponseAsync(SearchIndexerDataSourceConverter.map(dataSource), null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(MappingUtils::mappingExternalDataSource); } catch (RuntimeException ex) { @@ -237,7 +239,6 @@ public Mono> getDataSourceConnection return withContext(context -> getDataSourceConnectionWithResponse(dataSourceName, context)); } - @ServiceMethod(returns = ReturnType.SINGLE) Mono> getDataSourceConnectionWithResponse(String dataSourceName, Context context) { try { @@ -292,6 +293,7 @@ PagedFlux listDataSourceConnections(Context c * * @return a list of DataSource names */ + @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listDataSourceConnectionNames() { try { return new PagedFlux<>(() -> @@ -332,8 +334,8 @@ private Mono> listDataSourceConnectionsWithRespo */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteDataSourceConnection(String dataSourceName) { - return withContext(context -> - deleteDataSourceConnectionWithResponse(dataSourceName, null, context).flatMap(FluxUtil::toMono)); + return withContext(context -> deleteDataSourceConnectionWithResponse(dataSourceName, null, context) + .flatMap(FluxUtil::toMono)); } /** @@ -355,19 +357,13 @@ public Mono> deleteDataSourceConnectionWithResponse(SearchIndexer boolean onlyIfUnchanged) { Objects.requireNonNull(dataSource, "'DataSource' cannot be null"); String etag = onlyIfUnchanged ? dataSource.getETag() : null; - return withContext(context -> - deleteDataSourceConnectionWithResponse(dataSource.getName(), etag, context)); + return withContext(context -> deleteDataSourceConnectionWithResponse(dataSource.getName(), etag, context)); } - Mono> deleteDataSourceConnectionWithResponse(String dataSourceName, String etag, - Context context) { + Mono> deleteDataSourceConnectionWithResponse(String dataSourceName, String etag, Context context) { try { return restClient.getDataSources() - .deleteWithResponseAsync( - dataSourceName, - etag, null, - null, - context) + .deleteWithResponseAsync(dataSourceName, etag, null, null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(Function.identity()); } catch (RuntimeException ex) { @@ -409,12 +405,10 @@ public Mono> createIndexerWithResponse(SearchIndexer ind return withContext(context -> createIndexerWithResponse(indexer, context)); } - Mono> createIndexerWithResponse(SearchIndexer indexer, - Context context) { + Mono> createIndexerWithResponse(SearchIndexer indexer, Context context) { try { return restClient.getIndexers() - .createWithResponseAsync(SearchIndexerConverter.map(indexer), - null, context) + .createWithResponseAsync(SearchIndexerConverter.map(indexer), null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(MappingUtils::mappingExternalSearchIndexer); } catch (RuntimeException ex) { @@ -456,8 +450,7 @@ public Mono createOrUpdateIndexer(SearchIndexer indexer) { @ServiceMethod(returns = ReturnType.SINGLE) public Mono> createOrUpdateIndexerWithResponse(SearchIndexer indexer, boolean onlyIfUnchanged) { - return withContext(context -> - createOrUpdateIndexerWithResponse(indexer, onlyIfUnchanged, context)); + return withContext(context -> createOrUpdateIndexerWithResponse(indexer, onlyIfUnchanged, context)); } Mono> createOrUpdateIndexerWithResponse(SearchIndexer indexer, boolean onlyIfUnchanged, @@ -466,10 +459,8 @@ Mono> createOrUpdateIndexerWithResponse(SearchIndexer in String ifMatch = onlyIfUnchanged ? indexer.getETag() : null; try { return restClient.getIndexers() - .createOrUpdateWithResponseAsync(indexer.getName(), SearchIndexerConverter.map(indexer), ifMatch, - null, - null, - context) + .createOrUpdateWithResponseAsync(indexer.getName(), SearchIndexerConverter.map(indexer), ifMatch, null, + null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(MappingUtils::mappingExternalSearchIndexer); } catch (RuntimeException ex) { @@ -511,8 +502,7 @@ public Mono> getIndexerWithResponse(String indexerName) return withContext(context -> getIndexerWithResponse(indexerName, context)); } - Mono> getIndexerWithResponse(String indexerName, - Context context) { + Mono> getIndexerWithResponse(String indexerName, Context context) { try { return restClient.getIndexers() .getWithResponseAsync(indexerName, null, context) @@ -585,8 +575,7 @@ PagedFlux listIndexerNames(Context context) { } } - private Mono> listIndexersWithResponse(String select, - Context context) { + private Mono> listIndexersWithResponse(String select, Context context) { return restClient.getIndexers() .listWithResponseAsync(select, null, context) .onErrorMap(MappingUtils::exceptionMapper); @@ -639,12 +628,10 @@ public Mono> deleteIndexerWithResponse(SearchIndexer indexer, boo * @param context the context * @return a response signalling completion. */ - Mono> deleteIndexerWithResponse(String indexerName, String etag, - Context context) { + Mono> deleteIndexerWithResponse(String indexerName, String etag, Context context) { try { return restClient.getIndexers() - .deleteWithResponseAsync(indexerName, etag, null, - null, context) + .deleteWithResponseAsync(indexerName, etag, null, null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(Function.identity()); } catch (RuntimeException ex) { @@ -733,8 +720,7 @@ public Mono> runIndexerWithResponse(String indexerName) { Mono> runIndexerWithResponse(String indexerName, Context context) { try { - return restClient.getIndexers().runWithResponseAsync(indexerName, - null, context) + return restClient.getIndexers().runWithResponseAsync(indexerName, null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(Function.identity()); } catch (RuntimeException ex) { @@ -776,12 +762,10 @@ public Mono> getIndexerStatusWithResponse(String i return withContext(context -> getIndexerStatusWithResponse(indexerName, context)); } - Mono> getIndexerStatusWithResponse(String indexerName, - Context context) { + Mono> getIndexerStatusWithResponse(String indexerName, Context context) { try { return restClient.getIndexers() - .getStatusWithResponseAsync(indexerName, null, - context) + .getStatusWithResponseAsync(indexerName, null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(MappingUtils::mappingIndexerStatus); } catch (RuntimeException ex) { @@ -823,13 +807,11 @@ public Mono> createSkillsetWithResponse(SearchIn return withContext(context -> createSkillsetWithResponse(skillset, context)); } - Mono> createSkillsetWithResponse(SearchIndexerSkillset skillset, - Context context) { + Mono> createSkillsetWithResponse(SearchIndexerSkillset skillset, Context context) { Objects.requireNonNull(skillset, "'Skillset' cannot be null."); try { return restClient.getSkillsets() - .createWithResponseAsync(SearchIndexerSkillsetConverter.map(skillset), - null, context) + .createWithResponseAsync(SearchIndexerSkillsetConverter.map(skillset), null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(MappingUtils::mappingExternalSkillset); } catch (RuntimeException ex) { @@ -871,8 +853,7 @@ public Mono> getSkillsetWithResponse(String skil return withContext(context -> getSkillsetWithResponse(skillsetName, context)); } - Mono> getSkillsetWithResponse(String skillsetName, - Context context) { + Mono> getSkillsetWithResponse(String skillsetName, Context context) { try { return this.restClient.getSkillsets() .getWithResponseAsync(skillsetName, null, context) @@ -985,8 +966,7 @@ public Mono createOrUpdateSkillset(SearchIndexerSkillset @ServiceMethod(returns = ReturnType.SINGLE) public Mono> createOrUpdateSkillsetWithResponse(SearchIndexerSkillset skillset, boolean onlyIfUnchanged) { - return withContext(context -> - createOrUpdateSkillsetWithResponse(skillset, onlyIfUnchanged, context)); + return withContext(context -> createOrUpdateSkillsetWithResponse(skillset, onlyIfUnchanged, context)); } Mono> createOrUpdateSkillsetWithResponse(SearchIndexerSkillset skillset, @@ -996,9 +976,7 @@ Mono> createOrUpdateSkillsetWithResponse(SearchI try { return restClient.getSkillsets() .createOrUpdateWithResponseAsync(skillset.getName(), SearchIndexerSkillsetConverter.map(skillset), - ifMatch, null, - null, - context) + ifMatch, null, null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(MappingUtils::mappingExternalSkillset); } catch (RuntimeException ex) { @@ -1042,16 +1020,13 @@ public Mono deleteSkillset(String skillsetName) { public Mono> deleteSkillsetWithResponse(SearchIndexerSkillset skillset, boolean onlyIfUnchanged) { Objects.requireNonNull(skillset, "'Skillset' cannot be null."); String etag = onlyIfUnchanged ? skillset.getETag() : null; - return withContext(context -> - deleteSkillsetWithResponse(skillset.getName(), etag, context)); + return withContext(context -> deleteSkillsetWithResponse(skillset.getName(), etag, context)); } - Mono> deleteSkillsetWithResponse(String skillsetName, String etag, - Context context) { + Mono> deleteSkillsetWithResponse(String skillsetName, String etag, Context context) { try { return restClient.getSkillsets() - .deleteWithResponseAsync(skillsetName, etag, null, - null, context) + .deleteWithResponseAsync(skillsetName, etag, null, null, context) .onErrorMap(MappingUtils::exceptionMapper) .map(Function.identity()); } catch (RuntimeException ex) { diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexerClient.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexerClient.java index 819cdf381f3c..c04749b1389a 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexerClient.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexerClient.java @@ -4,6 +4,7 @@ package com.azure.search.documents.indexes; import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.HttpPipeline; import com.azure.core.http.rest.PagedIterable; @@ -15,8 +16,12 @@ import com.azure.search.documents.indexes.models.SearchIndexerStatus; /** - * Synchronous Client to manage and query indexers, as well as manage other resources, on a Cognitive Search service + * This class provides a client that contains the operations for creating, getting, listing, updating, or deleting data + * source connections, indexers, or skillsets and running or resetting indexers in an Azure Cognitive Search service. + * + * @see SearchIndexerClientBuilder */ +@ServiceClient(builder = SearchIndexerClientBuilder.class) public class SearchIndexerClient { private final SearchIndexerAsyncClient asyncClient; @@ -57,8 +62,7 @@ public String getEndpoint() { @ServiceMethod(returns = ReturnType.SINGLE) public SearchIndexerDataSourceConnection createOrUpdateDataSourceConnection( SearchIndexerDataSourceConnection dataSourceConnection) { - return createOrUpdateDataSourceConnectionWithResponse(dataSourceConnection, false, - Context.NONE).getValue(); + return createOrUpdateDataSourceConnectionWithResponse(dataSourceConnection, false, Context.NONE).getValue(); } /** @@ -236,7 +240,7 @@ public PagedIterable listDataSourceConnectionNames(Context context) { * * @param dataSourceConnectionName the name of the data source to be deleted */ - @ServiceMethod(returns = ReturnType.COLLECTION) + @ServiceMethod(returns = ReturnType.SINGLE) public void deleteDataSourceConnection(String dataSourceConnectionName) { deleteDataSourceConnectionWithResponse(new SearchIndexerDataSourceConnection(dataSourceConnectionName), false, Context.NONE); @@ -262,8 +266,8 @@ public void deleteDataSourceConnection(String dataSourceConnectionName) { public Response deleteDataSourceConnectionWithResponse(SearchIndexerDataSourceConnection dataSourceConnection, boolean onlyIfUnchanged, Context context) { String etag = onlyIfUnchanged ? dataSourceConnection.getETag() : null; - return asyncClient.deleteDataSourceConnectionWithResponse(dataSourceConnection.getName(), etag, - context).block(); + return asyncClient.deleteDataSourceConnectionWithResponse(dataSourceConnection.getName(), etag, context) + .block(); } /** @@ -297,8 +301,7 @@ public SearchIndexer createIndexer(SearchIndexer indexer) { * @return a response containing the created Indexer. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response createIndexerWithResponse(SearchIndexer indexer, - Context context) { + public Response createIndexerWithResponse(SearchIndexer indexer, Context context) { return asyncClient.createIndexerWithResponse(indexer, context).block(); } @@ -437,8 +440,7 @@ public SearchIndexer getIndexer(String indexerName) { * @return a response containing the indexer. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getIndexerWithResponse(String indexerName, - Context context) { + public Response getIndexerWithResponse(String indexerName, Context context) { return asyncClient.getIndexerWithResponse(indexerName, context).block(); } @@ -474,8 +476,7 @@ public void deleteIndexer(String indexerName) { * @return a response signalling completion. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteIndexerWithResponse(SearchIndexer indexer, boolean onlyIfUnchanged, - Context context) { + public Response deleteIndexerWithResponse(SearchIndexer indexer, boolean onlyIfUnchanged, Context context) { String etag = onlyIfUnchanged ? indexer.getETag() : null; return asyncClient.deleteIndexerWithResponse(indexer.getName(), etag, context).block(); } @@ -579,8 +580,7 @@ public SearchIndexerStatus getIndexerStatus(String indexerName) { * @return a response with the indexer execution info. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getIndexerStatusWithResponse(String indexerName, - Context context) { + public Response getIndexerStatusWithResponse(String indexerName, Context context) { return asyncClient.getIndexerStatusWithResponse(indexerName, context).block(); } @@ -616,8 +616,7 @@ public SearchIndexerSkillset createSkillset(SearchIndexerSkillset skillset) { * @return a response containing the created SearchIndexerSkillset. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response createSkillsetWithResponse(SearchIndexerSkillset skillset, - Context context) { + public Response createSkillsetWithResponse(SearchIndexerSkillset skillset, Context context) { return asyncClient.createSkillsetWithResponse(skillset, context).block(); } @@ -652,8 +651,7 @@ public SearchIndexerSkillset getSkillset(String skillsetName) { * @return a response containing the SearchIndexerSkillset. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getSkillsetWithResponse(String skillsetName, - Context context) { + public Response getSkillsetWithResponse(String skillsetName, Context context) { return asyncClient.getSkillsetWithResponse(skillsetName, context).block(); } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexerClientBuilder.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexerClientBuilder.java index 7874238e497f..f83a3f743d97 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexerClientBuilder.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexerClientBuilder.java @@ -38,11 +38,10 @@ * #buildClient() buildClient} and {@link #buildAsyncClient() buildAsyncClient} respectively to construct an instance of * the desired client. *

- * The client needs to at least provide the following required fields - *

+ * The following must be provided to construct a client instance. *
    - *
  • the service endpoint of the Azure Cognitive Search to access the resource service.
  • - *
  • {@link #credential(AzureKeyCredential)} gives the builder access credential.
  • + *
  • The Azure Cognitive Search service URL.
  • + *
  • An {@link AzureKeyCredential} that grants access to the Azure Cognitive Search service.
  • *
* *

Instantiating an asynchronous Search Indexer Client

@@ -166,9 +165,9 @@ public SearchIndexerAsyncClient buildAsyncClient() { } /** - * Sets the service endpoint for the Azure Search instance. + * Sets the service endpoint for the Azure Cognitive Search instance. * - * @param endpoint The URL of the Azure Search instance. + * @param endpoint The URL of the Azure Cognitive Search instance. * @return The updated SearchIndexerClientBuilder object. * @throws IllegalArgumentException If {@code endpoint} is null or it cannot be parsed into a valid URL. */ diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexerDataSources.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexerDataSources.java index 82b6746da476..92a35395bdf1 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexerDataSources.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexerDataSources.java @@ -12,7 +12,8 @@ import com.azure.search.documents.indexes.models.SearchIndexerDataSourceType; /** - * Utility class that aids in the creation of {@link SearchIndexerDataSourceConnection SearchIndexerDataSources}. + * Utility class that aids in the creation of {@link SearchIndexerDataSourceConnection + * SearchIndexerDataSourceConnections}. */ public final class SearchIndexerDataSources { diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/package-info.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/package-info.java index a95b4570dd2c..cf1d4ff54de3 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/package-info.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/package-info.java @@ -2,8 +2,7 @@ // Licensed under the MIT License. /** - * Package containing the data models for SearchServiceRestClient. - * Client that can be used to manage and query indexes and documents, as well - * as manage other resources, on a search service. + * Package containing classes used for resource management operations that are being sent-to and received-from an + * Azure Cognitive Search service. */ package com.azure.search.documents.indexes.models; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/package-info.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/package-info.java index f3976eff94c2..d970f63ef906 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/package-info.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/package-info.java @@ -2,7 +2,10 @@ // Licensed under the MIT License. /** - * Package containing the annotations used by FieldBuilder which help convert - * model class to a list of Field classes for building Index. + * Package containing classes for creating {@link com.azure.search.documents.indexes.SearchIndexClient}, + * {@link com.azure.search.documents.indexes.SearchIndexAsyncClient}, + * {@link com.azure.search.documents.indexes.SearchIndexerClient}, or + * {@link com.azure.search.documents.indexes.SearchIndexerAsyncClient} used to perform resource management operations + * on an Azure Cognitive Search service. */ package com.azure.search.documents.indexes; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/package-info.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/package-info.java new file mode 100644 index 000000000000..a052f26e2a17 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * Package containing classes used for document management, autocomplete, search, or suggestion operations that are + * being sent-to and received-from an Azure Cognitive Search service index. + */ +package com.azure.search.documents.models; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/package-info.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/package-info.java index 11f33ee1ee8c..38b8b14ef0e8 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/package-info.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/package-info.java @@ -5,7 +5,8 @@ // regenerated. /** - * Package containing the classes for SearchIndexRestClient. Client that can be used to query an index and upload, - * merge, or delete documents. + * Package containing classes for creating {@link com.azure.search.documents.SearchClient} or + * {@link com.azure.search.documents.SearchAsyncClient} used to perform document management, autocomplete, search, or + * suggestion operations using an Azure Cognitive Search service index. */ package com.azure.search.documents; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/util/package-info.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/util/package-info.java index a60d24405cd5..800c51a81b69 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/util/package-info.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/util/package-info.java @@ -2,6 +2,6 @@ // Licensed under the MIT License. /** - * Package containing Search utility classes. + * Package containing Azure Cognitive Search paged response classes. */ package com.azure.search.documents.util; diff --git a/sdk/search/azure-search-documents/src/main/java/module-info.java b/sdk/search/azure-search-documents/src/main/java/module-info.java index a25a9e84ecf5..44e0917971da 100644 --- a/sdk/search/azure-search-documents/src/main/java/module-info.java +++ b/sdk/search/azure-search-documents/src/main/java/module-info.java @@ -17,6 +17,7 @@ opens com.azure.search.documents.implementation.util to com.fasterxml.jackson.databind; exports com.azure.search.documents; + exports com.azure.search.documents.indexes; exports com.azure.search.documents.indexes.models; exports com.azure.search.documents.models; exports com.azure.search.documents.util; diff --git a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/RefineSearchCapabilitiesExample.java b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/RefineSearchCapabilitiesExample.java index 88ce4b28826b..b830c0748fa3 100644 --- a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/RefineSearchCapabilitiesExample.java +++ b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/RefineSearchCapabilitiesExample.java @@ -31,7 +31,7 @@ /** * This scenario assumes an existing search solution, with index and an indexer setup (see LifecycleSetupExample) - * For more information visit Azure Search Sample Data + * For more information visit Azure Cognitive Search Sample Data * https://docs.microsoft.com/en-us/samples/azure-samples/azure-search-sample-data/azure-search-sample-data/ */ public class RefineSearchCapabilitiesExample { diff --git a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/RunningSearchSolutionExample.java b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/RunningSearchSolutionExample.java index 259ba3ab0fd2..9e5fe4c57710 100644 --- a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/RunningSearchSolutionExample.java +++ b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/RunningSearchSolutionExample.java @@ -27,7 +27,7 @@ /** * This scenario assumes an existing search solution, with index and an indexer setup (see LifecycleSetupExample) - * Azure Search Sample Data + * Azure Cognitive Search Sample Data * https://docs.microsoft.com/en-us/samples/azure-samples/azure-search-sample-data/azure-search-sample-data/ */ public class RunningSearchSolutionExample { diff --git a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/indexes/LifecycleSetupExample.java b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/indexes/LifecycleSetupExample.java index c6acd454d1b8..eff3c0a9775d 100644 --- a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/indexes/LifecycleSetupExample.java +++ b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/indexes/LifecycleSetupExample.java @@ -29,7 +29,7 @@ /** * This scenario assumes an existing search solution and uses a pre-population data source with sample data set - * For more information visit Azure Search Sample Data: + * For more information visit Azure Cognitive Search Sample Data: * https://docs.microsoft.com/en-us/samples/azure-samples/azure-search-sample-data/azure-search-sample-data/ */ public class LifecycleSetupExample { diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/TestHelpers.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/TestHelpers.java index da20ef304172..d31986de974c 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/TestHelpers.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/TestHelpers.java @@ -39,7 +39,7 @@ import static org.junit.jupiter.api.Assertions.fail; /** - * This class contains helper methods for running Azure Search tests. + * This class contains helper methods for running Azure Cognitive Search tests. */ public final class TestHelpers { private static final TestMode TEST_MODE = setupTestMode();