diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 0cd66eb96aaa5..306bb72079c1b 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -494,7 +494,10 @@ "AICLIP", "TLARGE", "TBASE", - "TGIANT" + "TGIANT", + "tiktoken", + "AITOKENS", + "Matryoshka" ] }, { diff --git a/sdk/search/azure-search-documents/CHANGELOG.md b/sdk/search/azure-search-documents/CHANGELOG.md index be4f7354bd5a7..19d38a1f9b6da 100644 --- a/sdk/search/azure-search-documents/CHANGELOG.md +++ b/sdk/search/azure-search-documents/CHANGELOG.md @@ -1,17 +1,26 @@ # Release History -## 11.8.0-beta.1 (Unreleased) +## 11.8.0-beta.1 (2024-09-23) ### Features Added -### Breaking Changes - -### Bugs Fixed +- `VectorSearchCompression` now supports `truncationDimension` which allows for specifying the number of dimensions to + truncate vectors to. +- `SplitSkill` now supports tokenization. +- `VectorQuery` now supports `filterOverride` which allow for vector queries to override the broader SearchRequest.filter to allow for vector queries to have more specific configurations +- `DocumentDebugInfo` is extended with vector scores for the result. ### Other Changes - Migrate Search test from local auth to Microsoft Entra authentication. +#### Dependency Updates + +- Upgraded `azure-core` from `1.51.0` to version `1.52.0`. +- Upgraded `azure-core-http-netty` from `1.15.3` to version `1.15.4`. +- Upgraded `azure-core-serializer-json-jackson` from `1.5.` to version `1.5.1`. +- Upgraded `azure-json` from `1.2.0` to version `1.3.0`. + ## 11.7.0 (2024-07-17) ### Features Added diff --git a/sdk/search/azure-search-documents/README.md b/sdk/search/azure-search-documents/README.md index eeccdccb073ec..5c92ba6b41f8f 100644 --- a/sdk/search/azure-search-documents/README.md +++ b/sdk/search/azure-search-documents/README.md @@ -75,7 +75,7 @@ add the direct dependency to your project as follows. com.azure azure-search-documents - 11.7.0 + 11.8.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/search/azure-search-documents/assets.json b/sdk/search/azure-search-documents/assets.json index 2516f4a6b1bbb..18c5f2dfc1b25 100644 --- a/sdk/search/azure-search-documents/assets.json +++ b/sdk/search/azure-search-documents/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/search/azure-search-documents", - "Tag": "java/search/azure-search-documents_e37eaecdb9" + "Tag": "java/search/azure-search-documents_4ebd7ccc1a" } diff --git a/sdk/search/azure-search-documents/checkstyle-suppressions.xml b/sdk/search/azure-search-documents/checkstyle-suppressions.xml index fb1bee270dccb..c4c1ae64c7b3f 100644 --- a/sdk/search/azure-search-documents/checkstyle-suppressions.xml +++ b/sdk/search/azure-search-documents/checkstyle-suppressions.xml @@ -48,4 +48,21 @@ + + + + + + + + + + + + + + + + + diff --git a/sdk/search/azure-search-documents/pom.xml b/sdk/search/azure-search-documents/pom.xml index 20128cba7de9a..213a6cac218e7 100644 --- a/sdk/search/azure-search-documents/pom.xml +++ b/sdk/search/azure-search-documents/pom.xml @@ -24,8 +24,8 @@ UTF-8 - 0.56 - 0.47 + 0.55 + 0.46 --add-exports com.azure.core/com.azure.core.implementation.http=ALL-UNNAMED diff --git a/sdk/search/azure-search-documents/spotbugs-exclude.xml b/sdk/search/azure-search-documents/spotbugs-exclude.xml index da741065a3099..3f2db5e6f0b95 100644 --- a/sdk/search/azure-search-documents/spotbugs-exclude.xml +++ b/sdk/search/azure-search-documents/spotbugs-exclude.xml @@ -9,6 +9,15 @@ + + + + + + + + + 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 7159572bd3d80..0dfd7da103976 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 @@ -22,7 +22,12 @@ public enum SearchServiceVersion implements ServiceVersion { /** * {@code 2024-07-01} service version. */ - V2024_07_01("2024-07-01"); + V2024_07_01("2024-07-01"), + + /** + * {@code 2024-09-01-preview} service version. + */ + V2024_09_01_PREVIEW("2024-09-01-preview"); private final String version; @@ -44,6 +49,6 @@ public String getVersion() { * @return The latest version supported by this client library. */ public static SearchServiceVersion getLatest() { - return V2024_07_01; + return V2024_09_01_PREVIEW; } } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/models/SearchOptions.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/models/SearchOptions.java index 82bd6d02d97b2..3125a89f00cda 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/models/SearchOptions.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/models/SearchOptions.java @@ -6,6 +6,9 @@ package com.azure.search.documents.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.search.documents.models.QueryDebugMode; +import com.azure.search.documents.models.QueryLanguage; +import com.azure.search.documents.models.QuerySpellerType; import com.azure.search.documents.models.QueryType; import com.azure.search.documents.models.ScoringStatistics; import com.azure.search.documents.models.SearchMode; @@ -174,6 +177,26 @@ public final class SearchOptions { */ private String semanticQuery; + /* + * Enables a debugging tool that can be used to further explore your search results. + */ + private QueryDebugMode debug; + + /* + * The language of the query. + */ + private QueryLanguage queryLanguage; + + /* + * Improve search recall by spell-correcting individual search query terms. + */ + private QuerySpellerType speller; + + /* + * The list of field names used for semantic ranking. + */ + private List semanticFields; + /** * Creates an instance of SearchOptions class. */ @@ -744,6 +767,86 @@ public SearchOptions setSemanticQuery(String semanticQuery) { return this; } + /** + * Get the debug property: Enables a debugging tool that can be used to further explore your search results. + * + * @return the debug value. + */ + public QueryDebugMode getDebug() { + return this.debug; + } + + /** + * Set the debug property: Enables a debugging tool that can be used to further explore your search results. + * + * @param debug the debug value to set. + * @return the SearchOptions object itself. + */ + public SearchOptions setDebug(QueryDebugMode debug) { + this.debug = debug; + return this; + } + + /** + * Get the queryLanguage property: The language of the query. + * + * @return the queryLanguage value. + */ + public QueryLanguage getQueryLanguage() { + return this.queryLanguage; + } + + /** + * Set the queryLanguage property: The language of the query. + * + * @param queryLanguage the queryLanguage value to set. + * @return the SearchOptions object itself. + */ + public SearchOptions setQueryLanguage(QueryLanguage queryLanguage) { + this.queryLanguage = queryLanguage; + return this; + } + + /** + * Get the speller property: Improve search recall by spell-correcting individual search query terms. + * + * @return the speller value. + */ + public QuerySpellerType getSpeller() { + return this.speller; + } + + /** + * Set the speller property: Improve search recall by spell-correcting individual search query terms. + * + * @param speller the speller value to set. + * @return the SearchOptions object itself. + */ + public SearchOptions setSpeller(QuerySpellerType speller) { + this.speller = speller; + return this; + } + + /** + * Get the semanticFields property: The list of field names used for semantic ranking. + * + * @return the semanticFields value. + */ + public List getSemanticFields() { + return this.semanticFields; + } + + /** + * Set the semanticFields property: The list of field names used for semantic ranking. + * + * @param semanticFields the semanticFields value to set. + * @return the SearchOptions object itself. + */ + public SearchOptions setSemanticFields(List semanticFields) { + this.semanticFields = semanticFields; + return this; + } + /** * Set the facets property: The list of facet expressions to apply to the search query. Each facet expression * contains a field name, optionally followed by a comma-separated list of name:value pairs. diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/models/SearchRequest.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/models/SearchRequest.java index c554691a581e6..98a6a1bd7dbd2 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/models/SearchRequest.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/models/SearchRequest.java @@ -11,6 +11,10 @@ import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.search.documents.models.HybridSearch; +import com.azure.search.documents.models.QueryDebugMode; +import com.azure.search.documents.models.QueryLanguage; +import com.azure.search.documents.models.QuerySpellerType; import com.azure.search.documents.models.QueryType; import com.azure.search.documents.models.ScoringStatistics; import com.azure.search.documents.models.SearchMode; @@ -108,6 +112,11 @@ public final class SearchRequest implements JsonSerializable { */ private String scoringProfile; + /* + * Enables a debugging tool that can be used to further explore your reranked results. + */ + private QueryDebugMode debug; + /* * A full-text search query expression; Use "*" or omit this parameter to match all documents. */ @@ -126,6 +135,16 @@ public final class SearchRequest implements JsonSerializable { */ private SearchMode searchMode; + /* + * A value that specifies the language of the search query. + */ + private QueryLanguage queryLanguage; + + /* + * A value that specified the type of the speller to use to spell-correct individual search query terms. + */ + private QuerySpellerType speller; + /* * The comma-separated list of fields to retrieve. If unspecified, all fields marked as retrievable in the schema * are included. @@ -188,6 +207,11 @@ public final class SearchRequest implements JsonSerializable { */ private String captions; + /* + * The comma-separated list of field names used for semantic ranking. + */ + private String semanticFields; + /* * The query parameters for vector and hybrid search queries. */ @@ -199,6 +223,11 @@ public final class SearchRequest implements JsonSerializable { */ private VectorFilterMode vectorFilterMode; + /* + * The query parameters to configure hybrid search behaviors. + */ + private HybridSearch hybridSearch; + /** * Creates an instance of SearchRequest class. */ @@ -511,6 +540,26 @@ public SearchRequest setScoringProfile(String scoringProfile) { return this; } + /** + * Get the debug property: Enables a debugging tool that can be used to further explore your reranked results. + * + * @return the debug value. + */ + public QueryDebugMode getDebug() { + return this.debug; + } + + /** + * Set the debug property: Enables a debugging tool that can be used to further explore your reranked results. + * + * @param debug the debug value to set. + * @return the SearchRequest object itself. + */ + public SearchRequest setDebug(QueryDebugMode debug) { + this.debug = debug; + return this; + } + /** * Get the searchText property: A full-text search query expression; Use "*" or omit this parameter to match all * documents. @@ -579,6 +628,48 @@ public SearchRequest setSearchMode(SearchMode searchMode) { return this; } + /** + * Get the queryLanguage property: A value that specifies the language of the search query. + * + * @return the queryLanguage value. + */ + public QueryLanguage getQueryLanguage() { + return this.queryLanguage; + } + + /** + * Set the queryLanguage property: A value that specifies the language of the search query. + * + * @param queryLanguage the queryLanguage value to set. + * @return the SearchRequest object itself. + */ + public SearchRequest setQueryLanguage(QueryLanguage queryLanguage) { + this.queryLanguage = queryLanguage; + return this; + } + + /** + * Get the speller property: A value that specified the type of the speller to use to spell-correct individual + * search query terms. + * + * @return the speller value. + */ + public QuerySpellerType getSpeller() { + return this.speller; + } + + /** + * Set the speller property: A value that specified the type of the speller to use to spell-correct individual + * search query terms. + * + * @param speller the speller value to set. + * @return the SearchRequest object itself. + */ + public SearchRequest setSpeller(QuerySpellerType speller) { + this.speller = speller; + return this; + } + /** * Get the select property: The comma-separated list of fields to retrieve. If unspecified, all fields marked as * retrievable in the schema are included. @@ -795,6 +886,26 @@ public SearchRequest setCaptions(String captions) { return this; } + /** + * Get the semanticFields property: The comma-separated list of field names used for semantic ranking. + * + * @return the semanticFields value. + */ + public String getSemanticFields() { + return this.semanticFields; + } + + /** + * Set the semanticFields property: The comma-separated list of field names used for semantic ranking. + * + * @param semanticFields the semanticFields value to set. + * @return the SearchRequest object itself. + */ + public SearchRequest setSemanticFields(String semanticFields) { + this.semanticFields = semanticFields; + return this; + } + /** * Get the vectorQueries property: The query parameters for vector and hybrid search queries. * @@ -837,6 +948,26 @@ public SearchRequest setVectorFilterMode(VectorFilterMode vectorFilterMode) { return this; } + /** + * Get the hybridSearch property: The query parameters to configure hybrid search behaviors. + * + * @return the hybridSearch value. + */ + public HybridSearch getHybridSearch() { + return this.hybridSearch; + } + + /** + * Set the hybridSearch property: The query parameters to configure hybrid search behaviors. + * + * @param hybridSearch the hybridSearch value to set. + * @return the SearchRequest object itself. + */ + public SearchRequest setHybridSearch(HybridSearch hybridSearch) { + this.hybridSearch = hybridSearch; + return this; + } + /** * {@inheritDoc} */ @@ -858,9 +989,12 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeArrayField("scoringParameters", this.scoringParameters, (writer, element) -> writer.writeString(element)); jsonWriter.writeStringField("scoringProfile", this.scoringProfile); + jsonWriter.writeStringField("debug", this.debug == null ? null : this.debug.toString()); jsonWriter.writeStringField("search", this.searchText); jsonWriter.writeStringField("searchFields", this.searchFields); jsonWriter.writeStringField("searchMode", this.searchMode == null ? null : this.searchMode.toString()); + jsonWriter.writeStringField("queryLanguage", this.queryLanguage == null ? null : this.queryLanguage.toString()); + jsonWriter.writeStringField("speller", this.speller == null ? null : this.speller.toString()); jsonWriter.writeStringField("select", this.select); jsonWriter.writeNumberField("skip", this.skip); jsonWriter.writeNumberField("top", this.top); @@ -871,9 +1005,11 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStringField("semanticQuery", this.semanticQuery); jsonWriter.writeStringField("answers", this.answers); jsonWriter.writeStringField("captions", this.captions); + jsonWriter.writeStringField("semanticFields", this.semanticFields); jsonWriter.writeArrayField("vectorQueries", this.vectorQueries, (writer, element) -> writer.writeJson(element)); jsonWriter.writeStringField("vectorFilterMode", this.vectorFilterMode == null ? null : this.vectorFilterMode.toString()); + jsonWriter.writeJsonField("hybridSearch", this.hybridSearch); return jsonWriter.writeEndObject(); } @@ -920,12 +1056,18 @@ public static SearchRequest fromJson(JsonReader jsonReader) throws IOException { deserializedSearchRequest.scoringParameters = scoringParameters; } else if ("scoringProfile".equals(fieldName)) { deserializedSearchRequest.scoringProfile = reader.getString(); + } else if ("debug".equals(fieldName)) { + deserializedSearchRequest.debug = QueryDebugMode.fromString(reader.getString()); } else if ("search".equals(fieldName)) { deserializedSearchRequest.searchText = reader.getString(); } else if ("searchFields".equals(fieldName)) { deserializedSearchRequest.searchFields = reader.getString(); } else if ("searchMode".equals(fieldName)) { deserializedSearchRequest.searchMode = SearchMode.fromString(reader.getString()); + } else if ("queryLanguage".equals(fieldName)) { + deserializedSearchRequest.queryLanguage = QueryLanguage.fromString(reader.getString()); + } else if ("speller".equals(fieldName)) { + deserializedSearchRequest.speller = QuerySpellerType.fromString(reader.getString()); } else if ("select".equals(fieldName)) { deserializedSearchRequest.select = reader.getString(); } else if ("skip".equals(fieldName)) { @@ -944,11 +1086,15 @@ public static SearchRequest fromJson(JsonReader jsonReader) throws IOException { deserializedSearchRequest.answers = reader.getString(); } else if ("captions".equals(fieldName)) { deserializedSearchRequest.captions = reader.getString(); + } else if ("semanticFields".equals(fieldName)) { + deserializedSearchRequest.semanticFields = reader.getString(); } else if ("vectorQueries".equals(fieldName)) { List vectorQueries = reader.readArray(reader1 -> VectorQuery.fromJson(reader1)); deserializedSearchRequest.vectorQueries = vectorQueries; } else if ("vectorFilterMode".equals(fieldName)) { deserializedSearchRequest.vectorFilterMode = VectorFilterMode.fromString(reader.getString()); + } else if ("hybridSearch".equals(fieldName)) { + deserializedSearchRequest.hybridSearch = HybridSearch.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/models/SearchResult.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/models/SearchResult.java index bf9ed27e9dc7c..ec86365449f3d 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/models/SearchResult.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/models/SearchResult.java @@ -11,6 +11,7 @@ import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.search.documents.models.DocumentDebugInfo; import com.azure.search.documents.models.QueryCaptionResult; import java.io.IOException; import java.util.LinkedHashMap; @@ -45,6 +46,11 @@ public final class SearchResult implements JsonSerializable { */ private List captions; + /* + * Contains debugging information that can be used to further explore your search results. + */ + private List documentDebugInfo; + /* * Contains a document found by a search query, plus associated metadata. */ @@ -99,6 +105,16 @@ public List getCaptions() { return this.captions; } + /** + * Get the documentDebugInfo property: Contains debugging information that can be used to further explore your + * search results. + * + * @return the documentDebugInfo value. + */ + public List getDocumentDebugInfo() { + return this.documentDebugInfo; + } + /** * Get the additionalProperties property: Contains a document found by a search query, plus associated metadata. * @@ -149,6 +165,7 @@ public static SearchResult fromJson(JsonReader jsonReader) throws IOException { Double rerankerScore = null; Map> highlights = null; List captions = null; + List documentDebugInfo = null; Map additionalProperties = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); @@ -163,6 +180,8 @@ public static SearchResult fromJson(JsonReader jsonReader) throws IOException { highlights = reader.readMap(reader1 -> reader1.readArray(reader2 -> reader2.getString())); } else if ("@search.captions".equals(fieldName)) { captions = reader.readArray(reader1 -> QueryCaptionResult.fromJson(reader1)); + } else if ("@search.documentDebugInfo".equals(fieldName)) { + documentDebugInfo = reader.readArray(reader1 -> DocumentDebugInfo.fromJson(reader1)); } else { if (additionalProperties == null) { additionalProperties = new LinkedHashMap<>(); @@ -176,6 +195,7 @@ public static SearchResult fromJson(JsonReader jsonReader) throws IOException { deserializedSearchResult.rerankerScore = rerankerScore; deserializedSearchResult.highlights = highlights; deserializedSearchResult.captions = captions; + deserializedSearchResult.documentDebugInfo = documentDebugInfo; deserializedSearchResult.additionalProperties = additionalProperties; return deserializedSearchResult; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/models/Speller.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/models/Speller.java new file mode 100644 index 0000000000000..c489094f84f2c --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/models/Speller.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.implementation.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for Speller. + */ +public final class Speller extends ExpandableStringEnum { + /** + * Speller not enabled. + */ + public static final Speller NONE = fromString("none"); + + /** + * Speller corrects individual query terms using a static lexicon for the language specified by the queryLanguage + * parameter. + */ + public static final Speller LEXICON = fromString("lexicon"); + + /** + * Creates a new instance of Speller value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Speller() { + } + + /** + * Creates or finds a Speller from its string representation. + * + * @param name a name to look for. + * @return the corresponding Speller. + */ + public static Speller fromString(String name) { + return fromString(name, Speller.class); + } + + /** + * Gets known Speller values. + * + * @return known Speller values. + */ + public static Collection values() { + return values(Speller.class); + } +} 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 488ff945f6471..036e413bd62ff 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 @@ -509,7 +509,7 @@ Mono> createOrUpdateDataSourceConnec } try { return restClient.getDataSources() - .createOrUpdateWithResponseAsync(dataSource.getName(), dataSource, ifMatch, null, null, context).onErrorMap(MappingUtils::exceptionMapper); + .createOrUpdateWithResponseAsync(dataSource.getName(), dataSource, ifMatch, null, ignoreResetRequirements, null, context).onErrorMap(MappingUtils::exceptionMapper); } catch (RuntimeException ex) { return monoError(LOGGER, ex); } @@ -915,7 +915,8 @@ Mono> createOrUpdateIndexerWithResponse(SearchIndexer in } String ifMatch = onlyIfUnchanged ? indexer.getETag() : null; try { - return restClient.getIndexers().createOrUpdateWithResponseAsync(indexer.getName(), indexer, ifMatch, null, null, context) + return restClient.getIndexers().createOrUpdateWithResponseAsync(indexer.getName(), indexer, ifMatch, + null, ignoreResetRequirements, disableCacheReprocessingChangeDetection, null, context) .onErrorMap(MappingUtils::exceptionMapper); } catch (RuntimeException ex) { return monoError(LOGGER, ex); @@ -1567,7 +1568,8 @@ Mono> createOrUpdateSkillsetWithResponse(SearchI String ifMatch = onlyIfUnchanged ? skillset.getETag() : null; try { return restClient.getSkillsets() - .createOrUpdateWithResponseAsync(skillset.getName(), skillset, ifMatch, null, null, context) + .createOrUpdateWithResponseAsync(skillset.getName(), skillset, ifMatch, null, + ignoreResetRequirements, disableCacheReprocessingChangeDetection, null, context) .onErrorMap(MappingUtils::exceptionMapper); } catch (RuntimeException ex) { return monoError(LOGGER, 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 07a3a67b229c5..3bd7fdcbc1a82 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 @@ -476,7 +476,7 @@ Response createOrUpdateDataSourceConnectionWi } return Utility.executeRestCallWithExceptionHandling(() -> restClient.getDataSources() .createOrUpdateWithResponse(dataSource.getName(), dataSource, ifMatch, null, - null, context), LOGGER); + ignoreResetRequirements, null, context), LOGGER); } /** @@ -882,8 +882,8 @@ Response createOrUpdateIndexerWithResponse(SearchIndexer indexer, } String ifMatch = onlyIfUnchanged ? indexer.getETag() : null; return Utility.executeRestCallWithExceptionHandling(() -> restClient.getIndexers() - .createOrUpdateWithResponse(indexer.getName(), indexer, ifMatch, null, null, - context), LOGGER); + .createOrUpdateWithResponse(indexer.getName(), indexer, ifMatch, null, ignoreResetRequirements, + disableCacheReprocessingChangeDetection, null, context), LOGGER); } @@ -1560,8 +1560,8 @@ Response createOrUpdateSkillsetWithResponse(SearchIndexer } String ifMatch = onlyIfUnchanged ? skillset.getETag() : null; return Utility.executeRestCallWithExceptionHandling(() -> restClient.getSkillsets() - .createOrUpdateWithResponse(skillset.getName(), skillset, ifMatch, null, null, - context), LOGGER); + .createOrUpdateWithResponse(skillset.getName(), skillset, ifMatch, null, + ignoreResetRequirements, disableCacheReprocessingChangeDetection, null, context), LOGGER); } /** diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/AliasesImpl.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/AliasesImpl.java new file mode 100644 index 0000000000000..1bf78ff580549 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/AliasesImpl.java @@ -0,0 +1,853 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.search.documents.indexes.implementation.models.ErrorResponseException; +import com.azure.search.documents.indexes.implementation.models.ListAliasesResult; +import com.azure.search.documents.indexes.implementation.models.RequestOptions; +import com.azure.search.documents.indexes.models.SearchAlias; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Aliases. + */ +public final class AliasesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final AliasesService service; + + /** + * The service client containing this operation class. + */ + private final SearchServiceClientImpl client; + + /** + * Initializes an instance of AliasesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AliasesImpl(SearchServiceClientImpl client) { + this.service = RestProxy.create(AliasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchServiceClientAliases to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SearchServiceClientA") + public interface AliasesService { + @Post("/aliases") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SearchAlias alias, Context context); + + @Post("/aliases") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SearchAlias alias, Context context); + + @Get("/aliases") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Get("/aliases") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Put("/aliases('{aliasName}')") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @PathParam("aliasName") String aliasName, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("Prefer") String prefer, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SearchAlias alias, Context context); + + @Put("/aliases('{aliasName}')") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @PathParam("aliasName") String aliasName, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("Prefer") String prefer, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SearchAlias alias, Context context); + + @Delete("/aliases('{aliasName}')") + @ExpectedResponses({ 204, 404 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> delete(@HostParam("endpoint") String endpoint, @PathParam("aliasName") String aliasName, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, @HeaderParam("If-Match") String ifMatch, + @HeaderParam("If-None-Match") String ifNoneMatch, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Delete("/aliases('{aliasName}')") + @ExpectedResponses({ 204, 404 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @PathParam("aliasName") String aliasName, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, @HeaderParam("If-Match") String ifMatch, + @HeaderParam("If-None-Match") String ifNoneMatch, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Get("/aliases('{aliasName}')") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @PathParam("aliasName") String aliasName, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Get("/aliases('{aliasName}')") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @PathParam("aliasName") String aliasName, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Creates a new search alias. + * + * @param alias The definition of the alias to create. + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an index alias, which describes a mapping from the alias name to an index along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(SearchAlias alias, RequestOptions requestOptions) { + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return FluxUtil.withContext(context -> service.create(this.client.getEndpoint(), xMsClientRequestId, + this.client.getApiVersion(), accept, alias, context)); + } + + /** + * Creates a new search alias. + * + * @param alias The definition of the alias to create. + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an index alias, which describes a mapping from the alias name to an index along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(SearchAlias alias, RequestOptions requestOptions, + Context context) { + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.create(this.client.getEndpoint(), xMsClientRequestId, this.client.getApiVersion(), accept, alias, + context); + } + + /** + * Creates a new search alias. + * + * @param alias The definition of the alias to create. + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an index alias, which describes a mapping from the alias name to an index on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync(SearchAlias alias, RequestOptions requestOptions) { + return createWithResponseAsync(alias, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new search alias. + * + * @param alias The definition of the alias to create. + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an index alias, which describes a mapping from the alias name to an index on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync(SearchAlias alias, RequestOptions requestOptions, Context context) { + return createWithResponseAsync(alias, requestOptions, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new search alias. + * + * @param alias The definition of the alias to create. + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an index alias, which describes a mapping from the alias name to an index along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(SearchAlias alias, RequestOptions requestOptions, Context context) { + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.createSync(this.client.getEndpoint(), xMsClientRequestId, this.client.getApiVersion(), accept, + alias, context); + } + + /** + * Creates a new search alias. + * + * @param alias The definition of the alias to create. + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an index alias, which describes a mapping from the alias name to an index. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SearchAlias create(SearchAlias alias, RequestOptions requestOptions) { + return createWithResponse(alias, requestOptions, Context.NONE).getValue(); + } + + /** + * Lists all aliases available for a search service. + * + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response from a List Aliases request along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), xMsClientRequestId, + this.client.getApiVersion(), accept, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getAliases(), null, null)); + } + + /** + * Lists all aliases available for a search service. + * + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response from a List Aliases request along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listSinglePageAsync(RequestOptions requestOptions, Context context) { + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.list(this.client.getEndpoint(), xMsClientRequestId, this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getAliases(), null, null)); + } + + /** + * Lists all aliases available for a search service. + * + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response from a List Aliases request as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(RequestOptions requestOptions) { + return new PagedFlux<>(() -> listSinglePageAsync(requestOptions)); + } + + /** + * Lists all aliases available for a search service. + * + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response from a List Aliases request as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(RequestOptions requestOptions, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(requestOptions, context)); + } + + /** + * Lists all aliases available for a search service. + * + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response from a List Aliases request along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PagedResponse listSinglePage(RequestOptions requestOptions) { + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + Response res = service.listSync(this.client.getEndpoint(), xMsClientRequestId, + this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getAliases(), null, null); + } + + /** + * Lists all aliases available for a search service. + * + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response from a List Aliases request along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PagedResponse listSinglePage(RequestOptions requestOptions, Context context) { + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + Response res = service.listSync(this.client.getEndpoint(), xMsClientRequestId, + this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getAliases(), null, null); + } + + /** + * Lists all aliases available for a search service. + * + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response from a List Aliases request as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(RequestOptions requestOptions) { + return new PagedIterable<>(() -> listSinglePage(requestOptions, Context.NONE)); + } + + /** + * Lists all aliases available for a search service. + * + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response from a List Aliases request as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(RequestOptions requestOptions, Context context) { + return new PagedIterable<>(() -> listSinglePage(requestOptions, context)); + } + + /** + * Creates a new search alias or updates an alias if it already exists. + * + * @param aliasName The definition of the alias to create or update. + * @param alias The definition of the alias to create or update. + * @param ifMatch Defines the If-Match condition. The operation will be performed only if the ETag on the server + * matches this value. + * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the + * server does not match this value. + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an index alias, which describes a mapping from the alias name to an index along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync(String aliasName, SearchAlias alias, + String ifMatch, String ifNoneMatch, RequestOptions requestOptions) { + final String prefer = "return=representation"; + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return FluxUtil.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), aliasName, + xMsClientRequestId, ifMatch, ifNoneMatch, prefer, this.client.getApiVersion(), accept, alias, context)); + } + + /** + * Creates a new search alias or updates an alias if it already exists. + * + * @param aliasName The definition of the alias to create or update. + * @param alias The definition of the alias to create or update. + * @param ifMatch Defines the If-Match condition. The operation will be performed only if the ETag on the server + * matches this value. + * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the + * server does not match this value. + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an index alias, which describes a mapping from the alias name to an index along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync(String aliasName, SearchAlias alias, + String ifMatch, String ifNoneMatch, RequestOptions requestOptions, Context context) { + final String prefer = "return=representation"; + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.createOrUpdate(this.client.getEndpoint(), aliasName, xMsClientRequestId, ifMatch, ifNoneMatch, + prefer, this.client.getApiVersion(), accept, alias, context); + } + + /** + * Creates a new search alias or updates an alias if it already exists. + * + * @param aliasName The definition of the alias to create or update. + * @param alias The definition of the alias to create or update. + * @param ifMatch Defines the If-Match condition. The operation will be performed only if the ETag on the server + * matches this value. + * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the + * server does not match this value. + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an index alias, which describes a mapping from the alias name to an index on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String aliasName, SearchAlias alias, String ifMatch, + String ifNoneMatch, RequestOptions requestOptions) { + return createOrUpdateWithResponseAsync(aliasName, alias, ifMatch, ifNoneMatch, requestOptions) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new search alias or updates an alias if it already exists. + * + * @param aliasName The definition of the alias to create or update. + * @param alias The definition of the alias to create or update. + * @param ifMatch Defines the If-Match condition. The operation will be performed only if the ETag on the server + * matches this value. + * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the + * server does not match this value. + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an index alias, which describes a mapping from the alias name to an index on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String aliasName, SearchAlias alias, String ifMatch, + String ifNoneMatch, RequestOptions requestOptions, Context context) { + return createOrUpdateWithResponseAsync(aliasName, alias, ifMatch, ifNoneMatch, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new search alias or updates an alias if it already exists. + * + * @param aliasName The definition of the alias to create or update. + * @param alias The definition of the alias to create or update. + * @param ifMatch Defines the If-Match condition. The operation will be performed only if the ETag on the server + * matches this value. + * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the + * server does not match this value. + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an index alias, which describes a mapping from the alias name to an index along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String aliasName, SearchAlias alias, String ifMatch, + String ifNoneMatch, RequestOptions requestOptions, Context context) { + final String prefer = "return=representation"; + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.createOrUpdateSync(this.client.getEndpoint(), aliasName, xMsClientRequestId, ifMatch, + ifNoneMatch, prefer, this.client.getApiVersion(), accept, alias, context); + } + + /** + * Creates a new search alias or updates an alias if it already exists. + * + * @param aliasName The definition of the alias to create or update. + * @param alias The definition of the alias to create or update. + * @param ifMatch Defines the If-Match condition. The operation will be performed only if the ETag on the server + * matches this value. + * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the + * server does not match this value. + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an index alias, which describes a mapping from the alias name to an index. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SearchAlias createOrUpdate(String aliasName, SearchAlias alias, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions) { + return createOrUpdateWithResponse(aliasName, alias, ifMatch, ifNoneMatch, requestOptions, Context.NONE) + .getValue(); + } + + /** + * Deletes a search alias and its associated mapping to an index. This operation is permanent, with no recovery + * option. The mapped index is untouched by this operation. + * + * @param aliasName The name of the alias to delete. + * @param ifMatch Defines the If-Match condition. The operation will be performed only if the ETag on the server + * matches this value. + * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the + * server does not match this value. + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync(String aliasName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions) { + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), aliasName, xMsClientRequestId, + ifMatch, ifNoneMatch, this.client.getApiVersion(), accept, context)); + } + + /** + * Deletes a search alias and its associated mapping to an index. This operation is permanent, with no recovery + * option. The mapped index is untouched by this operation. + * + * @param aliasName The name of the alias to delete. + * @param ifMatch Defines the If-Match condition. The operation will be performed only if the ETag on the server + * matches this value. + * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the + * server does not match this value. + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync(String aliasName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions, Context context) { + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.delete(this.client.getEndpoint(), aliasName, xMsClientRequestId, ifMatch, ifNoneMatch, + this.client.getApiVersion(), accept, context); + } + + /** + * Deletes a search alias and its associated mapping to an index. This operation is permanent, with no recovery + * option. The mapped index is untouched by this operation. + * + * @param aliasName The name of the alias to delete. + * @param ifMatch Defines the If-Match condition. The operation will be performed only if the ETag on the server + * matches this value. + * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the + * server does not match this value. + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String aliasName, String ifMatch, String ifNoneMatch, RequestOptions requestOptions) { + return deleteWithResponseAsync(aliasName, ifMatch, ifNoneMatch, requestOptions) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a search alias and its associated mapping to an index. This operation is permanent, with no recovery + * option. The mapped index is untouched by this operation. + * + * @param aliasName The name of the alias to delete. + * @param ifMatch Defines the If-Match condition. The operation will be performed only if the ETag on the server + * matches this value. + * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the + * server does not match this value. + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String aliasName, String ifMatch, String ifNoneMatch, RequestOptions requestOptions, + Context context) { + return deleteWithResponseAsync(aliasName, ifMatch, ifNoneMatch, requestOptions, context) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a search alias and its associated mapping to an index. This operation is permanent, with no recovery + * option. The mapped index is untouched by this operation. + * + * @param aliasName The name of the alias to delete. + * @param ifMatch Defines the If-Match condition. The operation will be performed only if the ETag on the server + * matches this value. + * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the + * server does not match this value. + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String aliasName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions, Context context) { + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.deleteSync(this.client.getEndpoint(), aliasName, xMsClientRequestId, ifMatch, ifNoneMatch, + this.client.getApiVersion(), accept, context); + } + + /** + * Deletes a search alias and its associated mapping to an index. This operation is permanent, with no recovery + * option. The mapped index is untouched by this operation. + * + * @param aliasName The name of the alias to delete. + * @param ifMatch Defines the If-Match condition. The operation will be performed only if the ETag on the server + * matches this value. + * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the + * server does not match this value. + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String aliasName, String ifMatch, String ifNoneMatch, RequestOptions requestOptions) { + deleteWithResponse(aliasName, ifMatch, ifNoneMatch, requestOptions, Context.NONE); + } + + /** + * Retrieves an alias definition. + * + * @param aliasName The name of the alias to retrieve. + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an index alias, which describes a mapping from the alias name to an index along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String aliasName, RequestOptions requestOptions) { + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), aliasName, xMsClientRequestId, + this.client.getApiVersion(), accept, context)); + } + + /** + * Retrieves an alias definition. + * + * @param aliasName The name of the alias to retrieve. + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an index alias, which describes a mapping from the alias name to an index along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String aliasName, RequestOptions requestOptions, + Context context) { + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.get(this.client.getEndpoint(), aliasName, xMsClientRequestId, this.client.getApiVersion(), + accept, context); + } + + /** + * Retrieves an alias definition. + * + * @param aliasName The name of the alias to retrieve. + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an index alias, which describes a mapping from the alias name to an index on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String aliasName, RequestOptions requestOptions) { + return getWithResponseAsync(aliasName, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves an alias definition. + * + * @param aliasName The name of the alias to retrieve. + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an index alias, which describes a mapping from the alias name to an index on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String aliasName, RequestOptions requestOptions, Context context) { + return getWithResponseAsync(aliasName, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves an alias definition. + * + * @param aliasName The name of the alias to retrieve. + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an index alias, which describes a mapping from the alias name to an index along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String aliasName, RequestOptions requestOptions, Context context) { + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.getSync(this.client.getEndpoint(), aliasName, xMsClientRequestId, this.client.getApiVersion(), + accept, context); + } + + /** + * Retrieves an alias definition. + * + * @param aliasName The name of the alias to retrieve. + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an index alias, which describes a mapping from the alias name to an index. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SearchAlias get(String aliasName, RequestOptions requestOptions) { + return getWithResponse(aliasName, requestOptions, Context.NONE).getValue(); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/DataSourcesImpl.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/DataSourcesImpl.java index 6c7a00f9ffea4..3682f3a8c14af 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/DataSourcesImpl.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/DataSourcesImpl.java @@ -71,7 +71,9 @@ Mono> createOrUpdate(@HostParam("end @PathParam("dataSourceName") String dataSourceName, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("Prefer") String prefer, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + @QueryParam("api-version") String apiVersion, + @QueryParam("ignoreResetRequirements") Boolean skipIndexerResetRequirementForCache, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SearchIndexerDataSourceConnection dataSource, Context context); @Put("/datasources('{dataSourceName}')") @@ -81,7 +83,9 @@ Response createOrUpdateSync(@HostParam("endpo @PathParam("dataSourceName") String dataSourceName, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("Prefer") String prefer, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + @QueryParam("api-version") String apiVersion, + @QueryParam("ignoreResetRequirements") Boolean skipIndexerResetRequirementForCache, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SearchIndexerDataSourceConnection dataSource, Context context); @Delete("/datasources('{dataSourceName}')") @@ -158,6 +162,7 @@ Response createSync(@HostParam("endpoint") St * matches this value. * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the * server does not match this value. + * @param skipIndexerResetRequirementForCache Ignores cache reset requirements. * @param requestOptions Parameter group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorResponseException thrown if the request is rejected by server. @@ -168,7 +173,7 @@ Response createSync(@HostParam("endpoint") St @ServiceMethod(returns = ReturnType.SINGLE) public Mono> createOrUpdateWithResponseAsync(String dataSourceName, SearchIndexerDataSourceConnection dataSource, String ifMatch, String ifNoneMatch, - RequestOptions requestOptions) { + Boolean skipIndexerResetRequirementForCache, RequestOptions requestOptions) { final String prefer = "return=representation"; final String accept = "application/json; odata.metadata=minimal"; UUID xMsClientRequestIdInternal = null; @@ -176,9 +181,9 @@ public Mono> createOrUpdateWithRespo xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); } UUID xMsClientRequestId = xMsClientRequestIdInternal; - return FluxUtil.withContext( - context -> service.createOrUpdate(this.client.getEndpoint(), dataSourceName, xMsClientRequestId, ifMatch, - ifNoneMatch, prefer, this.client.getApiVersion(), accept, dataSource, context)); + return FluxUtil.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), dataSourceName, + xMsClientRequestId, ifMatch, ifNoneMatch, prefer, this.client.getApiVersion(), + skipIndexerResetRequirementForCache, accept, dataSource, context)); } /** @@ -190,6 +195,7 @@ public Mono> createOrUpdateWithRespo * matches this value. * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the * server does not match this value. + * @param skipIndexerResetRequirementForCache Ignores cache reset requirements. * @param requestOptions Parameter group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -200,8 +206,8 @@ public Mono> createOrUpdateWithRespo */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> createOrUpdateWithResponseAsync(String dataSourceName, - SearchIndexerDataSourceConnection dataSource, String ifMatch, String ifNoneMatch, RequestOptions requestOptions, - Context context) { + SearchIndexerDataSourceConnection dataSource, String ifMatch, String ifNoneMatch, + Boolean skipIndexerResetRequirementForCache, RequestOptions requestOptions, Context context) { final String prefer = "return=representation"; final String accept = "application/json; odata.metadata=minimal"; UUID xMsClientRequestIdInternal = null; @@ -210,7 +216,8 @@ public Mono> createOrUpdateWithRespo } UUID xMsClientRequestId = xMsClientRequestIdInternal; return service.createOrUpdate(this.client.getEndpoint(), dataSourceName, xMsClientRequestId, ifMatch, - ifNoneMatch, prefer, this.client.getApiVersion(), accept, dataSource, context); + ifNoneMatch, prefer, this.client.getApiVersion(), skipIndexerResetRequirementForCache, accept, dataSource, + context); } /** @@ -222,6 +229,7 @@ public Mono> createOrUpdateWithRespo * matches this value. * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the * server does not match this value. + * @param skipIndexerResetRequirementForCache Ignores cache reset requirements. * @param requestOptions Parameter group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorResponseException thrown if the request is rejected by server. @@ -232,9 +240,9 @@ public Mono> createOrUpdateWithRespo @ServiceMethod(returns = ReturnType.SINGLE) public Mono createOrUpdateAsync(String dataSourceName, SearchIndexerDataSourceConnection dataSource, String ifMatch, String ifNoneMatch, - RequestOptions requestOptions) { - return createOrUpdateWithResponseAsync(dataSourceName, dataSource, ifMatch, ifNoneMatch, requestOptions) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + Boolean skipIndexerResetRequirementForCache, RequestOptions requestOptions) { + return createOrUpdateWithResponseAsync(dataSourceName, dataSource, ifMatch, ifNoneMatch, + skipIndexerResetRequirementForCache, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** @@ -246,6 +254,7 @@ public Mono createOrUpdateAsync(String dataSo * matches this value. * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the * server does not match this value. + * @param skipIndexerResetRequirementForCache Ignores cache reset requirements. * @param requestOptions Parameter group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -256,10 +265,11 @@ public Mono createOrUpdateAsync(String dataSo */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono createOrUpdateAsync(String dataSourceName, - SearchIndexerDataSourceConnection dataSource, String ifMatch, String ifNoneMatch, RequestOptions requestOptions, - Context context) { - return createOrUpdateWithResponseAsync(dataSourceName, dataSource, ifMatch, ifNoneMatch, requestOptions, - context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + SearchIndexerDataSourceConnection dataSource, String ifMatch, String ifNoneMatch, + Boolean skipIndexerResetRequirementForCache, RequestOptions requestOptions, Context context) { + return createOrUpdateWithResponseAsync(dataSourceName, dataSource, ifMatch, ifNoneMatch, + skipIndexerResetRequirementForCache, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** @@ -271,6 +281,7 @@ public Mono createOrUpdateAsync(String dataSo * matches this value. * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the * server does not match this value. + * @param skipIndexerResetRequirementForCache Ignores cache reset requirements. * @param requestOptions Parameter group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -281,8 +292,8 @@ public Mono createOrUpdateAsync(String dataSo */ @ServiceMethod(returns = ReturnType.SINGLE) public Response createOrUpdateWithResponse(String dataSourceName, - SearchIndexerDataSourceConnection dataSource, String ifMatch, String ifNoneMatch, RequestOptions requestOptions, - Context context) { + SearchIndexerDataSourceConnection dataSource, String ifMatch, String ifNoneMatch, + Boolean skipIndexerResetRequirementForCache, RequestOptions requestOptions, Context context) { final String prefer = "return=representation"; final String accept = "application/json; odata.metadata=minimal"; UUID xMsClientRequestIdInternal = null; @@ -291,7 +302,8 @@ public Response createOrUpdateWithResponse(St } UUID xMsClientRequestId = xMsClientRequestIdInternal; return service.createOrUpdateSync(this.client.getEndpoint(), dataSourceName, xMsClientRequestId, ifMatch, - ifNoneMatch, prefer, this.client.getApiVersion(), accept, dataSource, context); + ifNoneMatch, prefer, this.client.getApiVersion(), skipIndexerResetRequirementForCache, accept, dataSource, + context); } /** @@ -303,6 +315,7 @@ public Response createOrUpdateWithResponse(St * matches this value. * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the * server does not match this value. + * @param skipIndexerResetRequirementForCache Ignores cache reset requirements. * @param requestOptions Parameter group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorResponseException thrown if the request is rejected by server. @@ -312,9 +325,9 @@ public Response createOrUpdateWithResponse(St @ServiceMethod(returns = ReturnType.SINGLE) public SearchIndexerDataSourceConnection createOrUpdate(String dataSourceName, SearchIndexerDataSourceConnection dataSource, String ifMatch, String ifNoneMatch, - RequestOptions requestOptions) { - return createOrUpdateWithResponse(dataSourceName, dataSource, ifMatch, ifNoneMatch, requestOptions, - Context.NONE).getValue(); + Boolean skipIndexerResetRequirementForCache, RequestOptions requestOptions) { + return createOrUpdateWithResponse(dataSourceName, dataSource, ifMatch, ifNoneMatch, + skipIndexerResetRequirementForCache, requestOptions, Context.NONE).getValue(); } /** diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/IndexersImpl.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/IndexersImpl.java index 58c3aa21e8526..04fafc51b6b28 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/IndexersImpl.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/IndexersImpl.java @@ -25,6 +25,7 @@ import com.azure.core.http.rest.RestProxy; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.search.documents.indexes.implementation.models.DocumentKeysOrIds; import com.azure.search.documents.indexes.implementation.models.ErrorResponseException; import com.azure.search.documents.indexes.implementation.models.ListIndexersResult; import com.azure.search.documents.indexes.implementation.models.RequestOptions; @@ -78,6 +79,24 @@ Response resetSync(@HostParam("endpoint") String endpoint, @PathParam("ind @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Post("/indexers('{indexerName}')/search.resetdocs") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> resetDocs(@HostParam("endpoint") String endpoint, + @PathParam("indexerName") String indexerName, @QueryParam("overwrite") Boolean overwrite, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + @BodyParam("application/json") DocumentKeysOrIds keysOrIds, Context context); + + @Post("/indexers('{indexerName}')/search.resetdocs") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Response resetDocsSync(@HostParam("endpoint") String endpoint, + @PathParam("indexerName") String indexerName, @QueryParam("overwrite") Boolean overwrite, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + @BodyParam("application/json") DocumentKeysOrIds keysOrIds, Context context); + @Post("/indexers('{indexerName}')/search.run") @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(ErrorResponseException.class) @@ -99,8 +118,11 @@ Mono> createOrUpdate(@HostParam("endpoint") String endpo @PathParam("indexerName") String indexerName, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("Prefer") String prefer, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - @BodyParam("application/json") SearchIndexer indexer, Context context); + @QueryParam("api-version") String apiVersion, + @QueryParam("ignoreResetRequirements") Boolean skipIndexerResetRequirementForCache, + @QueryParam("disableCacheReprocessingChangeDetection") Boolean disableCacheReprocessingChangeDetection, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SearchIndexer indexer, + Context context); @Put("/indexers('{indexerName}')") @ExpectedResponses({ 200, 201 }) @@ -109,8 +131,11 @@ Response createOrUpdateSync(@HostParam("endpoint") String endpoin @PathParam("indexerName") String indexerName, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("Prefer") String prefer, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - @BodyParam("application/json") SearchIndexer indexer, Context context); + @QueryParam("api-version") String apiVersion, + @QueryParam("ignoreResetRequirements") Boolean skipIndexerResetRequirementForCache, + @QueryParam("disableCacheReprocessingChangeDetection") Boolean disableCacheReprocessingChangeDetection, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SearchIndexer indexer, + Context context); @Delete("/indexers('{indexerName}')") @ExpectedResponses({ 204, 404 }) @@ -306,6 +331,145 @@ public void reset(String indexerName, RequestOptions requestOptions) { resetWithResponse(indexerName, requestOptions, Context.NONE); } + /** + * Resets specific documents in the datasource to be selectively re-ingested by the indexer. + * + * @param indexerName The name of the indexer to reset documents for. + * @param overwrite If false, keys or ids will be appended to existing ones. If true, only the keys or ids in this + * payload will be queued to be re-ingested. + * @param keysOrIds The keysOrIds parameter. + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> resetDocsWithResponseAsync(String indexerName, Boolean overwrite, + DocumentKeysOrIds keysOrIds, RequestOptions requestOptions) { + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return FluxUtil.withContext(context -> service.resetDocs(this.client.getEndpoint(), indexerName, overwrite, + xMsClientRequestId, this.client.getApiVersion(), accept, keysOrIds, context)); + } + + /** + * Resets specific documents in the datasource to be selectively re-ingested by the indexer. + * + * @param indexerName The name of the indexer to reset documents for. + * @param overwrite If false, keys or ids will be appended to existing ones. If true, only the keys or ids in this + * payload will be queued to be re-ingested. + * @param keysOrIds The keysOrIds parameter. + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> resetDocsWithResponseAsync(String indexerName, Boolean overwrite, + DocumentKeysOrIds keysOrIds, RequestOptions requestOptions, Context context) { + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.resetDocs(this.client.getEndpoint(), indexerName, overwrite, xMsClientRequestId, + this.client.getApiVersion(), accept, keysOrIds, context); + } + + /** + * Resets specific documents in the datasource to be selectively re-ingested by the indexer. + * + * @param indexerName The name of the indexer to reset documents for. + * @param overwrite If false, keys or ids will be appended to existing ones. If true, only the keys or ids in this + * payload will be queued to be re-ingested. + * @param keysOrIds The keysOrIds parameter. + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono resetDocsAsync(String indexerName, Boolean overwrite, DocumentKeysOrIds keysOrIds, + RequestOptions requestOptions) { + return resetDocsWithResponseAsync(indexerName, overwrite, keysOrIds, requestOptions) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Resets specific documents in the datasource to be selectively re-ingested by the indexer. + * + * @param indexerName The name of the indexer to reset documents for. + * @param overwrite If false, keys or ids will be appended to existing ones. If true, only the keys or ids in this + * payload will be queued to be re-ingested. + * @param keysOrIds The keysOrIds parameter. + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono resetDocsAsync(String indexerName, Boolean overwrite, DocumentKeysOrIds keysOrIds, + RequestOptions requestOptions, Context context) { + return resetDocsWithResponseAsync(indexerName, overwrite, keysOrIds, requestOptions, context) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Resets specific documents in the datasource to be selectively re-ingested by the indexer. + * + * @param indexerName The name of the indexer to reset documents for. + * @param overwrite If false, keys or ids will be appended to existing ones. If true, only the keys or ids in this + * payload will be queued to be re-ingested. + * @param keysOrIds The keysOrIds parameter. + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response resetDocsWithResponse(String indexerName, Boolean overwrite, DocumentKeysOrIds keysOrIds, + RequestOptions requestOptions, Context context) { + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.resetDocsSync(this.client.getEndpoint(), indexerName, overwrite, xMsClientRequestId, + this.client.getApiVersion(), accept, keysOrIds, context); + } + + /** + * Resets specific documents in the datasource to be selectively re-ingested by the indexer. + * + * @param indexerName The name of the indexer to reset documents for. + * @param overwrite If false, keys or ids will be appended to existing ones. If true, only the keys or ids in this + * payload will be queued to be re-ingested. + * @param keysOrIds The keysOrIds parameter. + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void resetDocs(String indexerName, Boolean overwrite, DocumentKeysOrIds keysOrIds, + RequestOptions requestOptions) { + resetDocsWithResponse(indexerName, overwrite, keysOrIds, requestOptions, Context.NONE); + } + /** * Runs an indexer on-demand. * @@ -429,6 +593,8 @@ public void run(String indexerName, RequestOptions requestOptions) { * matches this value. * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the * server does not match this value. + * @param skipIndexerResetRequirementForCache Ignores cache reset requirements. + * @param disableCacheReprocessingChangeDetection Disables cache reprocessing change detection. * @param requestOptions Parameter group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorResponseException thrown if the request is rejected by server. @@ -437,7 +603,8 @@ public void run(String indexerName, RequestOptions requestOptions) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> createOrUpdateWithResponseAsync(String indexerName, SearchIndexer indexer, - String ifMatch, String ifNoneMatch, RequestOptions requestOptions) { + String ifMatch, String ifNoneMatch, Boolean skipIndexerResetRequirementForCache, + Boolean disableCacheReprocessingChangeDetection, RequestOptions requestOptions) { final String prefer = "return=representation"; final String accept = "application/json; odata.metadata=minimal"; UUID xMsClientRequestIdInternal = null; @@ -446,7 +613,8 @@ public Mono> createOrUpdateWithResponseAsync(String inde } UUID xMsClientRequestId = xMsClientRequestIdInternal; return FluxUtil.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), indexerName, - xMsClientRequestId, ifMatch, ifNoneMatch, prefer, this.client.getApiVersion(), accept, indexer, context)); + xMsClientRequestId, ifMatch, ifNoneMatch, prefer, this.client.getApiVersion(), + skipIndexerResetRequirementForCache, disableCacheReprocessingChangeDetection, accept, indexer, context)); } /** @@ -458,6 +626,8 @@ public Mono> createOrUpdateWithResponseAsync(String inde * matches this value. * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the * server does not match this value. + * @param skipIndexerResetRequirementForCache Ignores cache reset requirements. + * @param disableCacheReprocessingChangeDetection Disables cache reprocessing change detection. * @param requestOptions Parameter group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -467,7 +637,8 @@ public Mono> createOrUpdateWithResponseAsync(String inde */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> createOrUpdateWithResponseAsync(String indexerName, SearchIndexer indexer, - String ifMatch, String ifNoneMatch, RequestOptions requestOptions, Context context) { + String ifMatch, String ifNoneMatch, Boolean skipIndexerResetRequirementForCache, + Boolean disableCacheReprocessingChangeDetection, RequestOptions requestOptions, Context context) { final String prefer = "return=representation"; final String accept = "application/json; odata.metadata=minimal"; UUID xMsClientRequestIdInternal = null; @@ -476,7 +647,8 @@ public Mono> createOrUpdateWithResponseAsync(String inde } UUID xMsClientRequestId = xMsClientRequestIdInternal; return service.createOrUpdate(this.client.getEndpoint(), indexerName, xMsClientRequestId, ifMatch, ifNoneMatch, - prefer, this.client.getApiVersion(), accept, indexer, context); + prefer, this.client.getApiVersion(), skipIndexerResetRequirementForCache, + disableCacheReprocessingChangeDetection, accept, indexer, context); } /** @@ -488,6 +660,8 @@ public Mono> createOrUpdateWithResponseAsync(String inde * matches this value. * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the * server does not match this value. + * @param skipIndexerResetRequirementForCache Ignores cache reset requirements. + * @param disableCacheReprocessingChangeDetection Disables cache reprocessing change detection. * @param requestOptions Parameter group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorResponseException thrown if the request is rejected by server. @@ -496,8 +670,10 @@ public Mono> createOrUpdateWithResponseAsync(String inde */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono createOrUpdateAsync(String indexerName, SearchIndexer indexer, String ifMatch, - String ifNoneMatch, RequestOptions requestOptions) { - return createOrUpdateWithResponseAsync(indexerName, indexer, ifMatch, ifNoneMatch, requestOptions) + String ifNoneMatch, Boolean skipIndexerResetRequirementForCache, + Boolean disableCacheReprocessingChangeDetection, RequestOptions requestOptions) { + return createOrUpdateWithResponseAsync(indexerName, indexer, ifMatch, ifNoneMatch, + skipIndexerResetRequirementForCache, disableCacheReprocessingChangeDetection, requestOptions) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } @@ -510,6 +686,8 @@ public Mono createOrUpdateAsync(String indexerName, SearchIndexer * matches this value. * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the * server does not match this value. + * @param skipIndexerResetRequirementForCache Ignores cache reset requirements. + * @param disableCacheReprocessingChangeDetection Disables cache reprocessing change detection. * @param requestOptions Parameter group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -519,8 +697,10 @@ public Mono createOrUpdateAsync(String indexerName, SearchIndexer */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono createOrUpdateAsync(String indexerName, SearchIndexer indexer, String ifMatch, - String ifNoneMatch, RequestOptions requestOptions, Context context) { - return createOrUpdateWithResponseAsync(indexerName, indexer, ifMatch, ifNoneMatch, requestOptions, context) + String ifNoneMatch, Boolean skipIndexerResetRequirementForCache, + Boolean disableCacheReprocessingChangeDetection, RequestOptions requestOptions, Context context) { + return createOrUpdateWithResponseAsync(indexerName, indexer, ifMatch, ifNoneMatch, + skipIndexerResetRequirementForCache, disableCacheReprocessingChangeDetection, requestOptions, context) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } @@ -533,6 +713,8 @@ public Mono createOrUpdateAsync(String indexerName, SearchIndexer * matches this value. * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the * server does not match this value. + * @param skipIndexerResetRequirementForCache Ignores cache reset requirements. + * @param disableCacheReprocessingChangeDetection Disables cache reprocessing change detection. * @param requestOptions Parameter group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -542,7 +724,8 @@ public Mono createOrUpdateAsync(String indexerName, SearchIndexer */ @ServiceMethod(returns = ReturnType.SINGLE) public Response createOrUpdateWithResponse(String indexerName, SearchIndexer indexer, String ifMatch, - String ifNoneMatch, RequestOptions requestOptions, Context context) { + String ifNoneMatch, Boolean skipIndexerResetRequirementForCache, + Boolean disableCacheReprocessingChangeDetection, RequestOptions requestOptions, Context context) { final String prefer = "return=representation"; final String accept = "application/json; odata.metadata=minimal"; UUID xMsClientRequestIdInternal = null; @@ -551,7 +734,8 @@ public Response createOrUpdateWithResponse(String indexerName, Se } UUID xMsClientRequestId = xMsClientRequestIdInternal; return service.createOrUpdateSync(this.client.getEndpoint(), indexerName, xMsClientRequestId, ifMatch, - ifNoneMatch, prefer, this.client.getApiVersion(), accept, indexer, context); + ifNoneMatch, prefer, this.client.getApiVersion(), skipIndexerResetRequirementForCache, + disableCacheReprocessingChangeDetection, accept, indexer, context); } /** @@ -563,6 +747,8 @@ public Response createOrUpdateWithResponse(String indexerName, Se * matches this value. * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the * server does not match this value. + * @param skipIndexerResetRequirementForCache Ignores cache reset requirements. + * @param disableCacheReprocessingChangeDetection Disables cache reprocessing change detection. * @param requestOptions Parameter group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorResponseException thrown if the request is rejected by server. @@ -571,8 +757,10 @@ public Response createOrUpdateWithResponse(String indexerName, Se */ @ServiceMethod(returns = ReturnType.SINGLE) public SearchIndexer createOrUpdate(String indexerName, SearchIndexer indexer, String ifMatch, String ifNoneMatch, + Boolean skipIndexerResetRequirementForCache, Boolean disableCacheReprocessingChangeDetection, RequestOptions requestOptions) { - return createOrUpdateWithResponse(indexerName, indexer, ifMatch, ifNoneMatch, requestOptions, Context.NONE) + return createOrUpdateWithResponse(indexerName, indexer, ifMatch, ifNoneMatch, + skipIndexerResetRequirementForCache, disableCacheReprocessingChangeDetection, requestOptions, Context.NONE) .getValue(); } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/SearchServiceClientImpl.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/SearchServiceClientImpl.java index e272236b6350c..f42a582510bb0 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/SearchServiceClientImpl.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/SearchServiceClientImpl.java @@ -167,6 +167,20 @@ public IndexesImpl getIndexes() { return this.indexes; } + /** + * The AliasesImpl object to access its operations. + */ + private final AliasesImpl aliases; + + /** + * Gets the AliasesImpl object to access its operations. + * + * @return the AliasesImpl object. + */ + public AliasesImpl getAliases() { + return this.aliases; + } + /** * Initializes an instance of SearchServiceClient client. * @@ -208,6 +222,7 @@ public SearchServiceClientImpl(HttpPipeline httpPipeline, SerializerAdapter seri this.skillsets = new SkillsetsImpl(this); this.synonymMaps = new SynonymMapsImpl(this); this.indexes = new IndexesImpl(this); + this.aliases = new AliasesImpl(this); this.service = RestProxy.create(SearchServiceClientService.class, this.httpPipeline, this.getSerializerAdapter()); } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/SkillsetsImpl.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/SkillsetsImpl.java index 5d574e3917334..00c0fb1def6ef 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/SkillsetsImpl.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/SkillsetsImpl.java @@ -28,6 +28,7 @@ import com.azure.search.documents.indexes.implementation.models.ErrorResponseException; import com.azure.search.documents.indexes.implementation.models.ListSkillsetsResult; import com.azure.search.documents.indexes.implementation.models.RequestOptions; +import com.azure.search.documents.indexes.implementation.models.SkillNames; import com.azure.search.documents.indexes.models.SearchIndexerSkillset; import java.util.UUID; import reactor.core.publisher.Mono; @@ -71,8 +72,11 @@ Mono> createOrUpdate(@HostParam("endpoint") Stri @PathParam("skillsetName") String skillsetName, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("Prefer") String prefer, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - @BodyParam("application/json") SearchIndexerSkillset skillset, Context context); + @QueryParam("api-version") String apiVersion, + @QueryParam("ignoreResetRequirements") Boolean skipIndexerResetRequirementForCache, + @QueryParam("disableCacheReprocessingChangeDetection") Boolean disableCacheReprocessingChangeDetection, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SearchIndexerSkillset skillset, + Context context); @Put("/skillsets('{skillsetName}')") @ExpectedResponses({ 200, 201 }) @@ -81,8 +85,11 @@ Response createOrUpdateSync(@HostParam("endpoint") String @PathParam("skillsetName") String skillsetName, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("Prefer") String prefer, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - @BodyParam("application/json") SearchIndexerSkillset skillset, Context context); + @QueryParam("api-version") String apiVersion, + @QueryParam("ignoreResetRequirements") Boolean skipIndexerResetRequirementForCache, + @QueryParam("disableCacheReprocessingChangeDetection") Boolean disableCacheReprocessingChangeDetection, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SearchIndexerSkillset skillset, + Context context); @Delete("/skillsets('{skillsetName}')") @ExpectedResponses({ 204, 404 }) @@ -147,6 +154,24 @@ Response createSync(@HostParam("endpoint") String endpoin @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, @BodyParam("application/json") SearchIndexerSkillset skillset, Context context); + + @Post("/skillsets('{skillsetName}')/search.resetskills") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> resetSkills(@HostParam("endpoint") String endpoint, + @PathParam("skillsetName") String skillsetName, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SkillNames skillNames, Context context); + + @Post("/skillsets('{skillsetName}')/search.resetskills") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Response resetSkillsSync(@HostParam("endpoint") String endpoint, + @PathParam("skillsetName") String skillsetName, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SkillNames skillNames, Context context); } /** @@ -158,6 +183,8 @@ Response createSync(@HostParam("endpoint") String endpoin * matches this value. * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the * server does not match this value. + * @param skipIndexerResetRequirementForCache Ignores cache reset requirements. + * @param disableCacheReprocessingChangeDetection Disables cache reprocessing change detection. * @param requestOptions Parameter group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorResponseException thrown if the request is rejected by server. @@ -166,7 +193,8 @@ Response createSync(@HostParam("endpoint") String endpoin */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> createOrUpdateWithResponseAsync(String skillsetName, - SearchIndexerSkillset skillset, String ifMatch, String ifNoneMatch, RequestOptions requestOptions) { + SearchIndexerSkillset skillset, String ifMatch, String ifNoneMatch, Boolean skipIndexerResetRequirementForCache, + Boolean disableCacheReprocessingChangeDetection, RequestOptions requestOptions) { final String prefer = "return=representation"; final String accept = "application/json; odata.metadata=minimal"; UUID xMsClientRequestIdInternal = null; @@ -175,7 +203,8 @@ public Mono> createOrUpdateWithResponseAsync(Str } UUID xMsClientRequestId = xMsClientRequestIdInternal; return FluxUtil.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), skillsetName, - xMsClientRequestId, ifMatch, ifNoneMatch, prefer, this.client.getApiVersion(), accept, skillset, context)); + xMsClientRequestId, ifMatch, ifNoneMatch, prefer, this.client.getApiVersion(), + skipIndexerResetRequirementForCache, disableCacheReprocessingChangeDetection, accept, skillset, context)); } /** @@ -187,6 +216,8 @@ public Mono> createOrUpdateWithResponseAsync(Str * matches this value. * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the * server does not match this value. + * @param skipIndexerResetRequirementForCache Ignores cache reset requirements. + * @param disableCacheReprocessingChangeDetection Disables cache reprocessing change detection. * @param requestOptions Parameter group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -196,8 +227,8 @@ public Mono> createOrUpdateWithResponseAsync(Str */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> createOrUpdateWithResponseAsync(String skillsetName, - SearchIndexerSkillset skillset, String ifMatch, String ifNoneMatch, RequestOptions requestOptions, - Context context) { + SearchIndexerSkillset skillset, String ifMatch, String ifNoneMatch, Boolean skipIndexerResetRequirementForCache, + Boolean disableCacheReprocessingChangeDetection, RequestOptions requestOptions, Context context) { final String prefer = "return=representation"; final String accept = "application/json; odata.metadata=minimal"; UUID xMsClientRequestIdInternal = null; @@ -206,7 +237,8 @@ public Mono> createOrUpdateWithResponseAsync(Str } UUID xMsClientRequestId = xMsClientRequestIdInternal; return service.createOrUpdate(this.client.getEndpoint(), skillsetName, xMsClientRequestId, ifMatch, ifNoneMatch, - prefer, this.client.getApiVersion(), accept, skillset, context); + prefer, this.client.getApiVersion(), skipIndexerResetRequirementForCache, + disableCacheReprocessingChangeDetection, accept, skillset, context); } /** @@ -218,6 +250,8 @@ public Mono> createOrUpdateWithResponseAsync(Str * matches this value. * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the * server does not match this value. + * @param skipIndexerResetRequirementForCache Ignores cache reset requirements. + * @param disableCacheReprocessingChangeDetection Disables cache reprocessing change detection. * @param requestOptions Parameter group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorResponseException thrown if the request is rejected by server. @@ -226,8 +260,10 @@ public Mono> createOrUpdateWithResponseAsync(Str */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono createOrUpdateAsync(String skillsetName, SearchIndexerSkillset skillset, - String ifMatch, String ifNoneMatch, RequestOptions requestOptions) { - return createOrUpdateWithResponseAsync(skillsetName, skillset, ifMatch, ifNoneMatch, requestOptions) + String ifMatch, String ifNoneMatch, Boolean skipIndexerResetRequirementForCache, + Boolean disableCacheReprocessingChangeDetection, RequestOptions requestOptions) { + return createOrUpdateWithResponseAsync(skillsetName, skillset, ifMatch, ifNoneMatch, + skipIndexerResetRequirementForCache, disableCacheReprocessingChangeDetection, requestOptions) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } @@ -240,6 +276,8 @@ public Mono createOrUpdateAsync(String skillsetName, Sear * matches this value. * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the * server does not match this value. + * @param skipIndexerResetRequirementForCache Ignores cache reset requirements. + * @param disableCacheReprocessingChangeDetection Disables cache reprocessing change detection. * @param requestOptions Parameter group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -249,8 +287,10 @@ public Mono createOrUpdateAsync(String skillsetName, Sear */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono createOrUpdateAsync(String skillsetName, SearchIndexerSkillset skillset, - String ifMatch, String ifNoneMatch, RequestOptions requestOptions, Context context) { - return createOrUpdateWithResponseAsync(skillsetName, skillset, ifMatch, ifNoneMatch, requestOptions, context) + String ifMatch, String ifNoneMatch, Boolean skipIndexerResetRequirementForCache, + Boolean disableCacheReprocessingChangeDetection, RequestOptions requestOptions, Context context) { + return createOrUpdateWithResponseAsync(skillsetName, skillset, ifMatch, ifNoneMatch, + skipIndexerResetRequirementForCache, disableCacheReprocessingChangeDetection, requestOptions, context) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } @@ -263,6 +303,8 @@ public Mono createOrUpdateAsync(String skillsetName, Sear * matches this value. * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the * server does not match this value. + * @param skipIndexerResetRequirementForCache Ignores cache reset requirements. + * @param disableCacheReprocessingChangeDetection Disables cache reprocessing change detection. * @param requestOptions Parameter group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -272,8 +314,8 @@ public Mono createOrUpdateAsync(String skillsetName, Sear */ @ServiceMethod(returns = ReturnType.SINGLE) public Response createOrUpdateWithResponse(String skillsetName, - SearchIndexerSkillset skillset, String ifMatch, String ifNoneMatch, RequestOptions requestOptions, - Context context) { + SearchIndexerSkillset skillset, String ifMatch, String ifNoneMatch, Boolean skipIndexerResetRequirementForCache, + Boolean disableCacheReprocessingChangeDetection, RequestOptions requestOptions, Context context) { final String prefer = "return=representation"; final String accept = "application/json; odata.metadata=minimal"; UUID xMsClientRequestIdInternal = null; @@ -282,7 +324,8 @@ public Response createOrUpdateWithResponse(String skillse } UUID xMsClientRequestId = xMsClientRequestIdInternal; return service.createOrUpdateSync(this.client.getEndpoint(), skillsetName, xMsClientRequestId, ifMatch, - ifNoneMatch, prefer, this.client.getApiVersion(), accept, skillset, context); + ifNoneMatch, prefer, this.client.getApiVersion(), skipIndexerResetRequirementForCache, + disableCacheReprocessingChangeDetection, accept, skillset, context); } /** @@ -294,6 +337,8 @@ public Response createOrUpdateWithResponse(String skillse * matches this value. * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if the ETag on the * server does not match this value. + * @param skipIndexerResetRequirementForCache Ignores cache reset requirements. + * @param disableCacheReprocessingChangeDetection Disables cache reprocessing change detection. * @param requestOptions Parameter group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorResponseException thrown if the request is rejected by server. @@ -302,8 +347,10 @@ public Response createOrUpdateWithResponse(String skillse */ @ServiceMethod(returns = ReturnType.SINGLE) public SearchIndexerSkillset createOrUpdate(String skillsetName, SearchIndexerSkillset skillset, String ifMatch, - String ifNoneMatch, RequestOptions requestOptions) { - return createOrUpdateWithResponse(skillsetName, skillset, ifMatch, ifNoneMatch, requestOptions, Context.NONE) + String ifNoneMatch, Boolean skipIndexerResetRequirementForCache, + Boolean disableCacheReprocessingChangeDetection, RequestOptions requestOptions) { + return createOrUpdateWithResponse(skillsetName, skillset, ifMatch, ifNoneMatch, + skipIndexerResetRequirementForCache, disableCacheReprocessingChangeDetection, requestOptions, Context.NONE) .getValue(); } @@ -811,4 +858,128 @@ public Response createWithResponse(SearchIndexerSkillset public SearchIndexerSkillset create(SearchIndexerSkillset skillset, RequestOptions requestOptions) { return createWithResponse(skillset, requestOptions, Context.NONE).getValue(); } + + /** + * Reset an existing skillset in a search service. + * + * @param skillsetName The name of the skillset to reset. + * @param skillNames The names of skills to reset. + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> resetSkillsWithResponseAsync(String skillsetName, SkillNames skillNames, + RequestOptions requestOptions) { + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return FluxUtil.withContext(context -> service.resetSkills(this.client.getEndpoint(), skillsetName, + xMsClientRequestId, this.client.getApiVersion(), accept, skillNames, context)); + } + + /** + * Reset an existing skillset in a search service. + * + * @param skillsetName The name of the skillset to reset. + * @param skillNames The names of skills to reset. + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> resetSkillsWithResponseAsync(String skillsetName, SkillNames skillNames, + RequestOptions requestOptions, Context context) { + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.resetSkills(this.client.getEndpoint(), skillsetName, xMsClientRequestId, + this.client.getApiVersion(), accept, skillNames, context); + } + + /** + * Reset an existing skillset in a search service. + * + * @param skillsetName The name of the skillset to reset. + * @param skillNames The names of skills to reset. + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono resetSkillsAsync(String skillsetName, SkillNames skillNames, RequestOptions requestOptions) { + return resetSkillsWithResponseAsync(skillsetName, skillNames, requestOptions).flatMap(ignored -> Mono.empty()); + } + + /** + * Reset an existing skillset in a search service. + * + * @param skillsetName The name of the skillset to reset. + * @param skillNames The names of skills to reset. + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono resetSkillsAsync(String skillsetName, SkillNames skillNames, RequestOptions requestOptions, + Context context) { + return resetSkillsWithResponseAsync(skillsetName, skillNames, requestOptions, context) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Reset an existing skillset in a search service. + * + * @param skillsetName The name of the skillset to reset. + * @param skillNames The names of skills to reset. + * @param requestOptions Parameter group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response resetSkillsWithResponse(String skillsetName, SkillNames skillNames, + RequestOptions requestOptions, Context context) { + final String accept = "application/json; odata.metadata=minimal"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.resetSkillsSync(this.client.getEndpoint(), skillsetName, xMsClientRequestId, + this.client.getApiVersion(), accept, skillNames, context); + } + + /** + * Reset an existing skillset in a search service. + * + * @param skillsetName The name of the skillset to reset. + * @param skillNames The names of skills to reset. + * @param requestOptions Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void resetSkills(String skillsetName, SkillNames skillNames, RequestOptions requestOptions) { + resetSkillsWithResponse(skillsetName, skillNames, requestOptions, Context.NONE); + } } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/models/AnalyzeRequest.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/models/AnalyzeRequest.java index e80bc8168769d..98fdcca52dfec 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/models/AnalyzeRequest.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/models/AnalyzeRequest.java @@ -13,6 +13,7 @@ import com.azure.json.JsonWriter; import com.azure.search.documents.indexes.models.CharFilterName; import com.azure.search.documents.indexes.models.LexicalAnalyzerName; +import com.azure.search.documents.indexes.models.LexicalNormalizerName; import com.azure.search.documents.indexes.models.LexicalTokenizerName; import com.azure.search.documents.indexes.models.TokenFilterName; import java.io.IOException; @@ -40,6 +41,11 @@ public final class AnalyzeRequest implements JsonSerializable { */ private LexicalTokenizerName tokenizer; + /* + * The name of the normalizer to use to normalize the given text. + */ + private LexicalNormalizerName normalizer; + /* * An optional list of token filters to use when breaking the given text. This parameter can only be set when using * the tokenizer parameter. @@ -114,6 +120,26 @@ public AnalyzeRequest setTokenizer(LexicalTokenizerName tokenizer) { return this; } + /** + * Get the normalizer property: The name of the normalizer to use to normalize the given text. + * + * @return the normalizer value. + */ + public LexicalNormalizerName getNormalizer() { + return this.normalizer; + } + + /** + * Set the normalizer property: The name of the normalizer to use to normalize the given text. + * + * @param normalizer the normalizer value to set. + * @return the AnalyzeRequest object itself. + */ + public AnalyzeRequest setNormalizer(LexicalNormalizerName normalizer) { + this.normalizer = normalizer; + return this; + } + /** * Get the tokenFilters property: An optional list of token filters to use when breaking the given text. This * parameter can only be set when using the tokenizer parameter. @@ -167,6 +193,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStringField("text", this.text); jsonWriter.writeStringField("analyzer", this.analyzer == null ? null : this.analyzer.toString()); jsonWriter.writeStringField("tokenizer", this.tokenizer == null ? null : this.tokenizer.toString()); + jsonWriter.writeStringField("normalizer", this.normalizer == null ? null : this.normalizer.toString()); jsonWriter.writeArrayField("tokenFilters", this.tokenFilters, (writer, element) -> writer.writeString(element == null ? null : element.toString())); jsonWriter.writeArrayField("charFilters", this.charFilters, @@ -189,6 +216,7 @@ public static AnalyzeRequest fromJson(JsonReader jsonReader) throws IOException String text = null; LexicalAnalyzerName analyzer = null; LexicalTokenizerName tokenizer = null; + LexicalNormalizerName normalizer = null; List tokenFilters = null; List charFilters = null; while (reader.nextToken() != JsonToken.END_OBJECT) { @@ -202,6 +230,8 @@ public static AnalyzeRequest fromJson(JsonReader jsonReader) throws IOException analyzer = LexicalAnalyzerName.fromString(reader.getString()); } else if ("tokenizer".equals(fieldName)) { tokenizer = LexicalTokenizerName.fromString(reader.getString()); + } else if ("normalizer".equals(fieldName)) { + normalizer = LexicalNormalizerName.fromString(reader.getString()); } else if ("tokenFilters".equals(fieldName)) { tokenFilters = reader.readArray(reader1 -> TokenFilterName.fromString(reader1.getString())); } else if ("charFilters".equals(fieldName)) { @@ -214,6 +244,7 @@ public static AnalyzeRequest fromJson(JsonReader jsonReader) throws IOException AnalyzeRequest deserializedAnalyzeRequest = new AnalyzeRequest(text); deserializedAnalyzeRequest.analyzer = analyzer; deserializedAnalyzeRequest.tokenizer = tokenizer; + deserializedAnalyzeRequest.normalizer = normalizer; deserializedAnalyzeRequest.tokenFilters = tokenFilters; deserializedAnalyzeRequest.charFilters = charFilters; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/models/DocumentKeysOrIds.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/models/DocumentKeysOrIds.java new file mode 100644 index 0000000000000..e1b7f1d06bb77 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/models/DocumentKeysOrIds.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The DocumentKeysOrIds model. + */ +@Fluent +public final class DocumentKeysOrIds implements JsonSerializable { + /* + * document keys to be reset + */ + private List documentKeys; + + /* + * datasource document identifiers to be reset + */ + private List datasourceDocumentIds; + + /** + * Creates an instance of DocumentKeysOrIds class. + */ + public DocumentKeysOrIds() { + } + + /** + * Get the documentKeys property: document keys to be reset. + * + * @return the documentKeys value. + */ + public List getDocumentKeys() { + return this.documentKeys; + } + + /** + * Set the documentKeys property: document keys to be reset. + * + * @param documentKeys the documentKeys value to set. + * @return the DocumentKeysOrIds object itself. + */ + public DocumentKeysOrIds setDocumentKeys(List documentKeys) { + this.documentKeys = documentKeys; + return this; + } + + /** + * Get the datasourceDocumentIds property: datasource document identifiers to be reset. + * + * @return the datasourceDocumentIds value. + */ + public List getDatasourceDocumentIds() { + return this.datasourceDocumentIds; + } + + /** + * Set the datasourceDocumentIds property: datasource document identifiers to be reset. + * + * @param datasourceDocumentIds the datasourceDocumentIds value to set. + * @return the DocumentKeysOrIds object itself. + */ + public DocumentKeysOrIds setDatasourceDocumentIds(List datasourceDocumentIds) { + this.datasourceDocumentIds = datasourceDocumentIds; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("documentKeys", this.documentKeys, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("datasourceDocumentIds", this.datasourceDocumentIds, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DocumentKeysOrIds from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DocumentKeysOrIds if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DocumentKeysOrIds. + */ + public static DocumentKeysOrIds fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DocumentKeysOrIds deserializedDocumentKeysOrIds = new DocumentKeysOrIds(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("documentKeys".equals(fieldName)) { + List documentKeys = reader.readArray(reader1 -> reader1.getString()); + deserializedDocumentKeysOrIds.documentKeys = documentKeys; + } else if ("datasourceDocumentIds".equals(fieldName)) { + List datasourceDocumentIds = reader.readArray(reader1 -> reader1.getString()); + deserializedDocumentKeysOrIds.datasourceDocumentIds = datasourceDocumentIds; + } else { + reader.skipChildren(); + } + } + + return deserializedDocumentKeysOrIds; + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/models/ListAliasesResult.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/models/ListAliasesResult.java new file mode 100644 index 0000000000000..90946d5a0e540 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/models/ListAliasesResult.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.search.documents.indexes.models.SearchAlias; +import java.io.IOException; +import java.util.List; + +/** + * Response from a List Aliases request. If successful, it includes the associated index mappings for all aliases. + */ +@Immutable +public final class ListAliasesResult implements JsonSerializable { + /* + * The aliases in the Search service. + */ + private final List aliases; + + /** + * Creates an instance of ListAliasesResult class. + * + * @param aliases the aliases value to set. + */ + public ListAliasesResult(List aliases) { + this.aliases = aliases; + } + + /** + * Get the aliases property: The aliases in the Search service. + * + * @return the aliases value. + */ + public List getAliases() { + return this.aliases; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListAliasesResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListAliasesResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ListAliasesResult. + */ + public static ListAliasesResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean aliasesFound = false; + List aliases = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + aliases = reader.readArray(reader1 -> SearchAlias.fromJson(reader1)); + aliasesFound = true; + } else { + reader.skipChildren(); + } + } + if (aliasesFound) { + return new ListAliasesResult(aliases); + } + throw new IllegalStateException("Missing required property: value"); + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/models/SkillNames.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/models/SkillNames.java new file mode 100644 index 0000000000000..4a5bd4b8a70d8 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/models/SkillNames.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The SkillNames model. + */ +@Fluent +public final class SkillNames implements JsonSerializable { + /* + * the names of skills to be reset. + */ + private List skillNames; + + /** + * Creates an instance of SkillNames class. + */ + public SkillNames() { + } + + /** + * Get the skillNames property: the names of skills to be reset. + * + * @return the skillNames value. + */ + public List getSkillNames() { + return this.skillNames; + } + + /** + * Set the skillNames property: the names of skills to be reset. + * + * @param skillNames the skillNames value to set. + * @return the SkillNames object itself. + */ + public SkillNames setSkillNames(List skillNames) { + this.skillNames = skillNames; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("skillNames", this.skillNames, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkillNames from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkillNames if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the SkillNames. + */ + public static SkillNames fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkillNames deserializedSkillNames = new SkillNames(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("skillNames".equals(fieldName)) { + List skillNames = reader.readArray(reader1 -> reader1.getString()); + deserializedSkillNames.skillNames = skillNames; + } else { + reader.skipChildren(); + } + } + + return deserializedSkillNames; + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AIServicesVisionParameters.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AIServicesVisionParameters.java new file mode 100644 index 0000000000000..b5ca72d1ff3be --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AIServicesVisionParameters.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * Specifies the AI Services Vision parameters for vectorizing a query image or text. + */ +@Fluent +public final class AIServicesVisionParameters implements JsonSerializable { + /* + * The version of the model to use when calling the AI Services Vision service. It will default to the latest + * available when not specified. + */ + private final String modelVersion; + + /* + * The resource URI of the AI Services resource. + */ + private final String resourceUri; + + /* + * API key of the designated AI Services resource. + */ + private String apiKey; + + /* + * The user-assigned managed identity used for outbound connections. If an authResourceId is provided and it's not + * specified, the system-assigned managed identity is used. On updates to the index, if the identity is unspecified, + * the value remains unchanged. If set to "none", the value of this property is cleared. + */ + private SearchIndexerDataIdentity authIdentity; + + /** + * Creates an instance of AIServicesVisionParameters class. + * + * @param modelVersion the modelVersion value to set. + * @param resourceUri the resourceUri value to set. + */ + public AIServicesVisionParameters(String modelVersion, String resourceUri) { + this.modelVersion = modelVersion; + this.resourceUri = resourceUri; + } + + /** + * Get the modelVersion property: The version of the model to use when calling the AI Services Vision service. It + * will default to the latest available when not specified. + * + * @return the modelVersion value. + */ + public String getModelVersion() { + return this.modelVersion; + } + + /** + * Get the resourceUri property: The resource URI of the AI Services resource. + * + * @return the resourceUri value. + */ + public String getResourceUri() { + return this.resourceUri; + } + + /** + * Get the apiKey property: API key of the designated AI Services resource. + * + * @return the apiKey value. + */ + public String getApiKey() { + return this.apiKey; + } + + /** + * Set the apiKey property: API key of the designated AI Services resource. + * + * @param apiKey the apiKey value to set. + * @return the AIServicesVisionParameters object itself. + */ + public AIServicesVisionParameters setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Get the authIdentity property: The user-assigned managed identity used for outbound connections. If an + * authResourceId is provided and it's not specified, the system-assigned managed identity is used. On updates to + * the index, if the identity is unspecified, the value remains unchanged. If set to "none", the value of this + * property is cleared. + * + * @return the authIdentity value. + */ + public SearchIndexerDataIdentity getAuthIdentity() { + return this.authIdentity; + } + + /** + * Set the authIdentity property: The user-assigned managed identity used for outbound connections. If an + * authResourceId is provided and it's not specified, the system-assigned managed identity is used. On updates to + * the index, if the identity is unspecified, the value remains unchanged. If set to "none", the value of this + * property is cleared. + * + * @param authIdentity the authIdentity value to set. + * @return the AIServicesVisionParameters object itself. + */ + public AIServicesVisionParameters setAuthIdentity(SearchIndexerDataIdentity authIdentity) { + this.authIdentity = authIdentity; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("modelVersion", this.modelVersion); + jsonWriter.writeStringField("resourceUri", this.resourceUri); + jsonWriter.writeStringField("apiKey", this.apiKey); + jsonWriter.writeJsonField("authIdentity", this.authIdentity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AIServicesVisionParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AIServicesVisionParameters if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AIServicesVisionParameters. + */ + public static AIServicesVisionParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean modelVersionFound = false; + String modelVersion = null; + boolean resourceUriFound = false; + String resourceUri = null; + String apiKey = null; + SearchIndexerDataIdentity authIdentity = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("modelVersion".equals(fieldName)) { + modelVersion = reader.getString(); + modelVersionFound = true; + } else if ("resourceUri".equals(fieldName)) { + resourceUri = reader.getString(); + resourceUriFound = true; + } else if ("apiKey".equals(fieldName)) { + apiKey = reader.getString(); + } else if ("authIdentity".equals(fieldName)) { + authIdentity = SearchIndexerDataIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + if (modelVersionFound && resourceUriFound) { + AIServicesVisionParameters deserializedAIServicesVisionParameters + = new AIServicesVisionParameters(modelVersion, resourceUri); + deserializedAIServicesVisionParameters.apiKey = apiKey; + deserializedAIServicesVisionParameters.authIdentity = authIdentity; + + return deserializedAIServicesVisionParameters; + } + List missingProperties = new ArrayList<>(); + if (!modelVersionFound) { + missingProperties.add("modelVersion"); + } + if (!resourceUriFound) { + missingProperties.add("resourceUri"); + } + + throw new IllegalStateException( + "Missing required property/properties: " + String.join(", ", missingProperties)); + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AIServicesVisionVectorizer.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AIServicesVisionVectorizer.java new file mode 100644 index 0000000000000..70514b51bc59a --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AIServicesVisionVectorizer.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specifies the AI Services Vision parameters for vectorizing a query image or text. + */ +@Fluent +public final class AIServicesVisionVectorizer extends VectorSearchVectorizer { + /* + * The name of the kind of vectorization method being configured for use with vector search. + */ + private VectorSearchVectorizerKind kind = VectorSearchVectorizerKind.AISERVICES_VISION; + + /* + * Contains the parameters specific to AI Services Vision embedding vectorization. + */ + private AIServicesVisionParameters aIServicesVisionParameters; + + /** + * Creates an instance of AIServicesVisionVectorizer class. + * + * @param vectorizerName the vectorizerName value to set. + */ + public AIServicesVisionVectorizer(String vectorizerName) { + super(vectorizerName); + } + + /** + * Get the kind property: The name of the kind of vectorization method being configured for use with vector search. + * + * @return the kind value. + */ + @Override + public VectorSearchVectorizerKind getKind() { + return this.kind; + } + + /** + * Get the aIServicesVisionParameters property: Contains the parameters specific to AI Services Vision embedding + * vectorization. + * + * @return the aIServicesVisionParameters value. + */ + public AIServicesVisionParameters getAIServicesVisionParameters() { + return this.aIServicesVisionParameters; + } + + /** + * Set the aIServicesVisionParameters property: Contains the parameters specific to AI Services Vision embedding + * vectorization. + * + * @param aIServicesVisionParameters the aIServicesVisionParameters value to set. + * @return the AIServicesVisionVectorizer object itself. + */ + public AIServicesVisionVectorizer + setAIServicesVisionParameters(AIServicesVisionParameters aIServicesVisionParameters) { + this.aIServicesVisionParameters = aIServicesVisionParameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getVectorizerName()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("aiServicesVisionParameters", this.aIServicesVisionParameters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AIServicesVisionVectorizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AIServicesVisionVectorizer if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AIServicesVisionVectorizer. + */ + public static AIServicesVisionVectorizer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean vectorizerNameFound = false; + String vectorizerName = null; + VectorSearchVectorizerKind kind = VectorSearchVectorizerKind.AISERVICES_VISION; + AIServicesVisionParameters aIServicesVisionParameters = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + vectorizerName = reader.getString(); + vectorizerNameFound = true; + } else if ("kind".equals(fieldName)) { + kind = VectorSearchVectorizerKind.fromString(reader.getString()); + } else if ("aiServicesVisionParameters".equals(fieldName)) { + aIServicesVisionParameters = AIServicesVisionParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + if (vectorizerNameFound) { + AIServicesVisionVectorizer deserializedAIServicesVisionVectorizer + = new AIServicesVisionVectorizer(vectorizerName); + deserializedAIServicesVisionVectorizer.kind = kind; + deserializedAIServicesVisionVectorizer.aIServicesVisionParameters = aIServicesVisionParameters; + + return deserializedAIServicesVisionVectorizer; + } + throw new IllegalStateException("Missing required property: name"); + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AIStudioModelCatalogName.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AIStudioModelCatalogName.java new file mode 100644 index 0000000000000..fd4e1132040de --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AIStudioModelCatalogName.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The name of the embedding model from the Azure AI Studio Catalog that will be called. + */ +public final class AIStudioModelCatalogName extends ExpandableStringEnum { + /** + * Static value OpenAI-CLIP-Image-Text-Embeddings-vit-base-patch32 for AIStudioModelCatalogName. + */ + public static final AIStudioModelCatalogName OPEN_AICLIP_IMAGE_TEXT_EMBEDDINGS_VIT_BASE_PATCH32 + = fromString("OpenAI-CLIP-Image-Text-Embeddings-vit-base-patch32"); + + /** + * Static value OpenAI-CLIP-Image-Text-Embeddings-ViT-Large-Patch14-336 for AIStudioModelCatalogName. + */ + public static final AIStudioModelCatalogName OPEN_AICLIP_IMAGE_TEXT_EMBEDDINGS_VI_TLARGE_PATCH14336 + = fromString("OpenAI-CLIP-Image-Text-Embeddings-ViT-Large-Patch14-336"); + + /** + * Static value Facebook-DinoV2-Image-Embeddings-ViT-Base for AIStudioModelCatalogName. + */ + public static final AIStudioModelCatalogName FACEBOOK_DINO_V2IMAGE_EMBEDDINGS_VI_TBASE + = fromString("Facebook-DinoV2-Image-Embeddings-ViT-Base"); + + /** + * Static value Facebook-DinoV2-Image-Embeddings-ViT-Giant for AIStudioModelCatalogName. + */ + public static final AIStudioModelCatalogName FACEBOOK_DINO_V2IMAGE_EMBEDDINGS_VI_TGIANT + = fromString("Facebook-DinoV2-Image-Embeddings-ViT-Giant"); + + /** + * Static value Cohere-embed-v3-english for AIStudioModelCatalogName. + */ + public static final AIStudioModelCatalogName COHERE_EMBED_V3ENGLISH = fromString("Cohere-embed-v3-english"); + + /** + * Static value Cohere-embed-v3-multilingual for AIStudioModelCatalogName. + */ + public static final AIStudioModelCatalogName COHERE_EMBED_V3MULTILINGUAL + = fromString("Cohere-embed-v3-multilingual"); + + /** + * Creates a new instance of AIStudioModelCatalogName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AIStudioModelCatalogName() { + } + + /** + * Creates or finds a AIStudioModelCatalogName from its string representation. + * + * @param name a name to look for. + * @return the corresponding AIStudioModelCatalogName. + */ + public static AIStudioModelCatalogName fromString(String name) { + return fromString(name, AIStudioModelCatalogName.class); + } + + /** + * Gets known AIStudioModelCatalogName values. + * + * @return known AIStudioModelCatalogName values. + */ + public static Collection values() { + return values(AIStudioModelCatalogName.class); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AzureMachineLearningParameters.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AzureMachineLearningParameters.java new file mode 100644 index 0000000000000..f467cebea260f --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AzureMachineLearningParameters.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; + +/** + * Specifies the properties for connecting to an AML vectorizer. + */ +@Fluent +public final class AzureMachineLearningParameters implements JsonSerializable { + /* + * (Required for no authentication or key authentication) The scoring URI of the AML service to which the JSON + * payload will be sent. Only the https URI scheme is allowed. + */ + private final String scoringUri; + + /* + * (Required for key authentication) The key for the AML service. + */ + private String authenticationKey; + + /* + * (Required for token authentication). The Azure Resource Manager resource ID of the AML service. It should be in + * the format + * subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.MachineLearningServices/workspaces/{workspace + * -name}/services/{service_name}. + */ + private String resourceId; + + /* + * (Optional) When specified, indicates the timeout for the http client making the API call. + */ + private Duration timeout; + + /* + * (Optional for token authentication). The region the AML service is deployed in. + */ + private String region; + + /* + * The name of the embedding model from the Azure AI Studio Catalog that is deployed at the provided endpoint. + */ + private AIStudioModelCatalogName modelName; + + /** + * Creates an instance of AzureMachineLearningParameters class. + * + * @param scoringUri the scoringUri value to set. + */ + public AzureMachineLearningParameters(String scoringUri) { + this.scoringUri = scoringUri; + } + + /** + * Get the scoringUri property: (Required for no authentication or key authentication) The scoring URI of the AML + * service to which the JSON payload will be sent. Only the https URI scheme is allowed. + * + * @return the scoringUri value. + */ + public String getScoringUri() { + return this.scoringUri; + } + + /** + * Get the authenticationKey property: (Required for key authentication) The key for the AML service. + * + * @return the authenticationKey value. + */ + public String getAuthenticationKey() { + return this.authenticationKey; + } + + /** + * Set the authenticationKey property: (Required for key authentication) The key for the AML service. + * + * @param authenticationKey the authenticationKey value to set. + * @return the AzureMachineLearningParameters object itself. + */ + public AzureMachineLearningParameters setAuthenticationKey(String authenticationKey) { + this.authenticationKey = authenticationKey; + return this; + } + + /** + * Get the resourceId property: (Required for token authentication). The Azure Resource Manager resource ID of the + * AML service. It should be in the format + * subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.MachineLearningServices/workspaces/{workspace-name}/services/{service_name}. + * + * @return the resourceId value. + */ + public String getResourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: (Required for token authentication). The Azure Resource Manager resource ID of the + * AML service. It should be in the format + * subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.MachineLearningServices/workspaces/{workspace-name}/services/{service_name}. + * + * @param resourceId the resourceId value to set. + * @return the AzureMachineLearningParameters object itself. + */ + public AzureMachineLearningParameters setResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the timeout property: (Optional) When specified, indicates the timeout for the http client making the API + * call. + * + * @return the timeout value. + */ + public Duration getTimeout() { + return this.timeout; + } + + /** + * Set the timeout property: (Optional) When specified, indicates the timeout for the http client making the API + * call. + * + * @param timeout the timeout value to set. + * @return the AzureMachineLearningParameters object itself. + */ + public AzureMachineLearningParameters setTimeout(Duration timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the region property: (Optional for token authentication). The region the AML service is deployed in. + * + * @return the region value. + */ + public String getRegion() { + return this.region; + } + + /** + * Set the region property: (Optional for token authentication). The region the AML service is deployed in. + * + * @param region the region value to set. + * @return the AzureMachineLearningParameters object itself. + */ + public AzureMachineLearningParameters setRegion(String region) { + this.region = region; + return this; + } + + /** + * Get the modelName property: The name of the embedding model from the Azure AI Studio Catalog that is deployed at + * the provided endpoint. + * + * @return the modelName value. + */ + public AIStudioModelCatalogName getModelName() { + return this.modelName; + } + + /** + * Set the modelName property: The name of the embedding model from the Azure AI Studio Catalog that is deployed at + * the provided endpoint. + * + * @param modelName the modelName value to set. + * @return the AzureMachineLearningParameters object itself. + */ + public AzureMachineLearningParameters setModelName(AIStudioModelCatalogName modelName) { + this.modelName = modelName; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("uri", this.scoringUri); + jsonWriter.writeStringField("key", this.authenticationKey); + jsonWriter.writeStringField("resourceId", this.resourceId); + jsonWriter.writeStringField("timeout", CoreUtils.durationToStringWithDays(this.timeout)); + jsonWriter.writeStringField("region", this.region); + jsonWriter.writeStringField("modelName", this.modelName == null ? null : this.modelName.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureMachineLearningParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureMachineLearningParameters if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureMachineLearningParameters. + */ + public static AzureMachineLearningParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean scoringUriFound = false; + String scoringUri = null; + String authenticationKey = null; + String resourceId = null; + Duration timeout = null; + String region = null; + AIStudioModelCatalogName modelName = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("uri".equals(fieldName)) { + scoringUri = reader.getString(); + scoringUriFound = true; + } else if ("key".equals(fieldName)) { + authenticationKey = reader.getString(); + } else if ("resourceId".equals(fieldName)) { + resourceId = reader.getString(); + } else if ("timeout".equals(fieldName)) { + timeout = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("region".equals(fieldName)) { + region = reader.getString(); + } else if ("modelName".equals(fieldName)) { + modelName = AIStudioModelCatalogName.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + if (scoringUriFound) { + AzureMachineLearningParameters deserializedAzureMachineLearningParameters + = new AzureMachineLearningParameters(scoringUri); + deserializedAzureMachineLearningParameters.authenticationKey = authenticationKey; + deserializedAzureMachineLearningParameters.resourceId = resourceId; + deserializedAzureMachineLearningParameters.timeout = timeout; + deserializedAzureMachineLearningParameters.region = region; + deserializedAzureMachineLearningParameters.modelName = modelName; + + return deserializedAzureMachineLearningParameters; + } + throw new IllegalStateException("Missing required property: uri"); + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AzureMachineLearningSkill.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AzureMachineLearningSkill.java new file mode 100644 index 0000000000000..a2ed91f89a9c3 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AzureMachineLearningSkill.java @@ -0,0 +1,359 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; +import java.util.ArrayList; +import java.util.List; + +/** + * The AML skill allows you to extend AI enrichment with a custom Azure Machine Learning (AML) model. Once an AML model + * is trained and deployed, an AML skill integrates it into AI enrichment. + */ +@Fluent +public final class AzureMachineLearningSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + private String odataType = "#Microsoft.Skills.Custom.AmlSkill"; + + /* + * (Required for no authentication or key authentication) The scoring URI of the AML service to which the JSON + * payload will be sent. Only the https URI scheme is allowed. + */ + private String scoringUri; + + /* + * (Required for key authentication) The key for the AML service. + */ + private String authenticationKey; + + /* + * (Required for token authentication). The Azure Resource Manager resource ID of the AML service. It should be in + * the format + * subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.MachineLearningServices/workspaces/{workspace + * -name}/services/{service_name}. + */ + private String resourceId; + + /* + * (Optional) When specified, indicates the timeout for the http client making the API call. + */ + private Duration timeout; + + /* + * (Optional for token authentication). The region the AML service is deployed in. + */ + private String region; + + /* + * (Optional) When specified, indicates the number of calls the indexer will make in parallel to the endpoint you + * have provided. You can decrease this value if your endpoint is failing under too high of a request load, or raise + * it if your endpoint is able to accept more requests and you would like an increase in the performance of the + * indexer. If not set, a default value of 5 is used. The degreeOfParallelism can be set to a maximum of 10 and a + * minimum of 1. + */ + private Integer degreeOfParallelism; + + /** + * Creates an instance of AzureMachineLearningSkill class. + * + * @param inputs the inputs value to set. + * @param outputs the outputs value to set. + */ + public AzureMachineLearningSkill(List inputs, List outputs) { + super(inputs, outputs); + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the scoringUri property: (Required for no authentication or key authentication) The scoring URI of the AML + * service to which the JSON payload will be sent. Only the https URI scheme is allowed. + * + * @return the scoringUri value. + */ + public String getScoringUri() { + return this.scoringUri; + } + + /** + * Set the scoringUri property: (Required for no authentication or key authentication) The scoring URI of the AML + * service to which the JSON payload will be sent. Only the https URI scheme is allowed. + * + * @param scoringUri the scoringUri value to set. + * @return the AzureMachineLearningSkill object itself. + */ + public AzureMachineLearningSkill setScoringUri(String scoringUri) { + this.scoringUri = scoringUri; + return this; + } + + /** + * Get the authenticationKey property: (Required for key authentication) The key for the AML service. + * + * @return the authenticationKey value. + */ + public String getAuthenticationKey() { + return this.authenticationKey; + } + + /** + * Set the authenticationKey property: (Required for key authentication) The key for the AML service. + * + * @param authenticationKey the authenticationKey value to set. + * @return the AzureMachineLearningSkill object itself. + */ + public AzureMachineLearningSkill setAuthenticationKey(String authenticationKey) { + this.authenticationKey = authenticationKey; + return this; + } + + /** + * Get the resourceId property: (Required for token authentication). The Azure Resource Manager resource ID of the + * AML service. It should be in the format + * subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.MachineLearningServices/workspaces/{workspace-name}/services/{service_name}. + * + * @return the resourceId value. + */ + public String getResourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: (Required for token authentication). The Azure Resource Manager resource ID of the + * AML service. It should be in the format + * subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.MachineLearningServices/workspaces/{workspace-name}/services/{service_name}. + * + * @param resourceId the resourceId value to set. + * @return the AzureMachineLearningSkill object itself. + */ + public AzureMachineLearningSkill setResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the timeout property: (Optional) When specified, indicates the timeout for the http client making the API + * call. + * + * @return the timeout value. + */ + public Duration getTimeout() { + return this.timeout; + } + + /** + * Set the timeout property: (Optional) When specified, indicates the timeout for the http client making the API + * call. + * + * @param timeout the timeout value to set. + * @return the AzureMachineLearningSkill object itself. + */ + public AzureMachineLearningSkill setTimeout(Duration timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the region property: (Optional for token authentication). The region the AML service is deployed in. + * + * @return the region value. + */ + public String getRegion() { + return this.region; + } + + /** + * Set the region property: (Optional for token authentication). The region the AML service is deployed in. + * + * @param region the region value to set. + * @return the AzureMachineLearningSkill object itself. + */ + public AzureMachineLearningSkill setRegion(String region) { + this.region = region; + return this; + } + + /** + * Get the degreeOfParallelism property: (Optional) When specified, indicates the number of calls the indexer will + * make in parallel to the endpoint you have provided. You can decrease this value if your endpoint is failing under + * too high of a request load, or raise it if your endpoint is able to accept more requests and you would like an + * increase in the performance of the indexer. If not set, a default value of 5 is used. The degreeOfParallelism can + * be set to a maximum of 10 and a minimum of 1. + * + * @return the degreeOfParallelism value. + */ + public Integer getDegreeOfParallelism() { + return this.degreeOfParallelism; + } + + /** + * Set the degreeOfParallelism property: (Optional) When specified, indicates the number of calls the indexer will + * make in parallel to the endpoint you have provided. You can decrease this value if your endpoint is failing under + * too high of a request load, or raise it if your endpoint is able to accept more requests and you would like an + * increase in the performance of the indexer. If not set, a default value of 5 is used. The degreeOfParallelism can + * be set to a maximum of 10 and a minimum of 1. + * + * @param degreeOfParallelism the degreeOfParallelism value to set. + * @return the AzureMachineLearningSkill object itself. + */ + public AzureMachineLearningSkill setDegreeOfParallelism(Integer degreeOfParallelism) { + this.degreeOfParallelism = degreeOfParallelism; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureMachineLearningSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureMachineLearningSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureMachineLearningSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("inputs", getInputs(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("outputs", getOutputs(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("description", getDescription()); + jsonWriter.writeStringField("context", getContext()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeStringField("uri", this.scoringUri); + jsonWriter.writeStringField("key", this.authenticationKey); + jsonWriter.writeStringField("resourceId", this.resourceId); + jsonWriter.writeStringField("timeout", CoreUtils.durationToStringWithDays(this.timeout)); + jsonWriter.writeStringField("region", this.region); + jsonWriter.writeNumberField("degreeOfParallelism", this.degreeOfParallelism); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureMachineLearningSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureMachineLearningSkill if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureMachineLearningSkill. + */ + public static AzureMachineLearningSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean inputsFound = false; + List inputs = null; + boolean outputsFound = false; + List outputs = null; + String name = null; + String description = null; + String context = null; + String odataType = "#Microsoft.Skills.Custom.AmlSkill"; + String scoringUri = null; + String authenticationKey = null; + String resourceId = null; + Duration timeout = null; + String region = null; + Integer degreeOfParallelism = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + inputs = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + inputsFound = true; + } else if ("outputs".equals(fieldName)) { + outputs = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + outputsFound = true; + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("context".equals(fieldName)) { + context = reader.getString(); + } else if ("@odata.type".equals(fieldName)) { + odataType = reader.getString(); + } else if ("uri".equals(fieldName)) { + scoringUri = reader.getString(); + } else if ("key".equals(fieldName)) { + authenticationKey = reader.getString(); + } else if ("resourceId".equals(fieldName)) { + resourceId = reader.getString(); + } else if ("timeout".equals(fieldName)) { + timeout = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("region".equals(fieldName)) { + region = reader.getString(); + } else if ("degreeOfParallelism".equals(fieldName)) { + degreeOfParallelism = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + if (inputsFound && outputsFound) { + AzureMachineLearningSkill deserializedAzureMachineLearningSkill + = new AzureMachineLearningSkill(inputs, outputs); + deserializedAzureMachineLearningSkill.setName(name); + deserializedAzureMachineLearningSkill.setDescription(description); + deserializedAzureMachineLearningSkill.setContext(context); + deserializedAzureMachineLearningSkill.odataType = odataType; + deserializedAzureMachineLearningSkill.scoringUri = scoringUri; + deserializedAzureMachineLearningSkill.authenticationKey = authenticationKey; + deserializedAzureMachineLearningSkill.resourceId = resourceId; + deserializedAzureMachineLearningSkill.timeout = timeout; + deserializedAzureMachineLearningSkill.region = region; + deserializedAzureMachineLearningSkill.degreeOfParallelism = degreeOfParallelism; + + return deserializedAzureMachineLearningSkill; + } + List missingProperties = new ArrayList<>(); + if (!inputsFound) { + missingProperties.add("inputs"); + } + if (!outputsFound) { + missingProperties.add("outputs"); + } + + throw new IllegalStateException( + "Missing required property/properties: " + String.join(", ", missingProperties)); + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AzureMachineLearningVectorizer.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AzureMachineLearningVectorizer.java new file mode 100644 index 0000000000000..37230623731f6 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AzureMachineLearningVectorizer.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specifies an Azure Machine Learning endpoint deployed via the Azure AI Studio Model Catalog for generating the vector + * embedding of a query string. + */ +@Fluent +public final class AzureMachineLearningVectorizer extends VectorSearchVectorizer { + /* + * The name of the kind of vectorization method being configured for use with vector search. + */ + private VectorSearchVectorizerKind kind = VectorSearchVectorizerKind.AML; + + /* + * Specifies the properties of the AML vectorizer. + */ + private AzureMachineLearningParameters aMLParameters; + + /** + * Creates an instance of AzureMachineLearningVectorizer class. + * + * @param vectorizerName the vectorizerName value to set. + */ + public AzureMachineLearningVectorizer(String vectorizerName) { + super(vectorizerName); + } + + /** + * Get the kind property: The name of the kind of vectorization method being configured for use with vector search. + * + * @return the kind value. + */ + @Override + public VectorSearchVectorizerKind getKind() { + return this.kind; + } + + /** + * Get the aMLParameters property: Specifies the properties of the AML vectorizer. + * + * @return the aMLParameters value. + */ + public AzureMachineLearningParameters getAMLParameters() { + return this.aMLParameters; + } + + /** + * Set the aMLParameters property: Specifies the properties of the AML vectorizer. + * + * @param aMLParameters the aMLParameters value to set. + * @return the AzureMachineLearningVectorizer object itself. + */ + public AzureMachineLearningVectorizer setAMLParameters(AzureMachineLearningParameters aMLParameters) { + this.aMLParameters = aMLParameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getVectorizerName()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("amlParameters", this.aMLParameters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureMachineLearningVectorizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureMachineLearningVectorizer if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureMachineLearningVectorizer. + */ + public static AzureMachineLearningVectorizer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean vectorizerNameFound = false; + String vectorizerName = null; + VectorSearchVectorizerKind kind = VectorSearchVectorizerKind.AML; + AzureMachineLearningParameters aMLParameters = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + vectorizerName = reader.getString(); + vectorizerNameFound = true; + } else if ("kind".equals(fieldName)) { + kind = VectorSearchVectorizerKind.fromString(reader.getString()); + } else if ("amlParameters".equals(fieldName)) { + aMLParameters = AzureMachineLearningParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + if (vectorizerNameFound) { + AzureMachineLearningVectorizer deserializedAzureMachineLearningVectorizer + = new AzureMachineLearningVectorizer(vectorizerName); + deserializedAzureMachineLearningVectorizer.kind = kind; + deserializedAzureMachineLearningVectorizer.aMLParameters = aMLParameters; + + return deserializedAzureMachineLearningVectorizer; + } + throw new IllegalStateException("Missing required property: name"); + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AzureOpenAITokenizerParameters.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AzureOpenAITokenizerParameters.java new file mode 100644 index 0000000000000..1edf3e0bcaf58 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AzureOpenAITokenizerParameters.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The AzureOpenAITokenizerParameters model. + */ +@Fluent +public final class AzureOpenAITokenizerParameters implements JsonSerializable { + /* + * Only applies if the unit is set to azureOpenAITokens. Options include 'R50k_base', 'P50k_base', 'P50k_edit' and + * 'CL100k_base'. The default value is 'CL100k_base'. + */ + private SplitSkillEncoderModelName encoderModelName; + + /* + * (Optional) Only applies if the unit is set to azureOpenAITokens. This parameter defines a collection of special + * tokens that are permitted within the tokenization process. + */ + private List allowedSpecialTokens; + + /** + * Creates an instance of AzureOpenAITokenizerParameters class. + */ + public AzureOpenAITokenizerParameters() { + } + + /** + * Get the encoderModelName property: Only applies if the unit is set to azureOpenAITokens. Options include + * 'R50k_base', 'P50k_base', 'P50k_edit' and 'CL100k_base'. The default value is 'CL100k_base'. + * + * @return the encoderModelName value. + */ + public SplitSkillEncoderModelName getEncoderModelName() { + return this.encoderModelName; + } + + /** + * Set the encoderModelName property: Only applies if the unit is set to azureOpenAITokens. Options include + * 'R50k_base', 'P50k_base', 'P50k_edit' and 'CL100k_base'. The default value is 'CL100k_base'. + * + * @param encoderModelName the encoderModelName value to set. + * @return the AzureOpenAITokenizerParameters object itself. + */ + public AzureOpenAITokenizerParameters setEncoderModelName(SplitSkillEncoderModelName encoderModelName) { + this.encoderModelName = encoderModelName; + return this; + } + + /** + * Get the allowedSpecialTokens property: (Optional) Only applies if the unit is set to azureOpenAITokens. This + * parameter defines a collection of special tokens that are permitted within the tokenization process. + * + * @return the allowedSpecialTokens value. + */ + public List getAllowedSpecialTokens() { + return this.allowedSpecialTokens; + } + + /** + * Set the allowedSpecialTokens property: (Optional) Only applies if the unit is set to azureOpenAITokens. This + * parameter defines a collection of special tokens that are permitted within the tokenization process. + * + * @param allowedSpecialTokens the allowedSpecialTokens value to set. + * @return the AzureOpenAITokenizerParameters object itself. + */ + public AzureOpenAITokenizerParameters setAllowedSpecialTokens(List allowedSpecialTokens) { + this.allowedSpecialTokens = allowedSpecialTokens; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("encoderModelName", + this.encoderModelName == null ? null : this.encoderModelName.toString()); + jsonWriter.writeArrayField("allowedSpecialTokens", this.allowedSpecialTokens, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureOpenAITokenizerParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureOpenAITokenizerParameters if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureOpenAITokenizerParameters. + */ + public static AzureOpenAITokenizerParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureOpenAITokenizerParameters deserializedAzureOpenAITokenizerParameters + = new AzureOpenAITokenizerParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("encoderModelName".equals(fieldName)) { + deserializedAzureOpenAITokenizerParameters.encoderModelName + = SplitSkillEncoderModelName.fromString(reader.getString()); + } else if ("allowedSpecialTokens".equals(fieldName)) { + List allowedSpecialTokens = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureOpenAITokenizerParameters.allowedSpecialTokens = allowedSpecialTokens; + } else { + reader.skipChildren(); + } + } + + return deserializedAzureOpenAITokenizerParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/BinaryQuantizationCompression.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/BinaryQuantizationCompression.java index 7bc84919ae680..d8912726e93a1 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/BinaryQuantizationCompression.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/BinaryQuantizationCompression.java @@ -60,6 +60,15 @@ public BinaryQuantizationCompression setDefaultOversampling(Double defaultOversa return this; } + /** + * {@inheritDoc} + */ + @Override + public BinaryQuantizationCompression setTruncationDimension(Integer truncationDimension) { + super.setTruncationDimension(truncationDimension); + return this; + } + /** * {@inheritDoc} */ @@ -69,6 +78,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStringField("name", getCompressionName()); jsonWriter.writeBooleanField("rerankWithOriginalVectors", isRerankWithOriginalVectors()); jsonWriter.writeNumberField("defaultOversampling", getDefaultOversampling()); + jsonWriter.writeNumberField("truncationDimension", getTruncationDimension()); jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); return jsonWriter.writeEndObject(); } @@ -88,6 +98,7 @@ public static BinaryQuantizationCompression fromJson(JsonReader jsonReader) thro String compressionName = null; Boolean rerankWithOriginalVectors = null; Double defaultOversampling = null; + Integer truncationDimension = null; VectorSearchCompressionKind kind = VectorSearchCompressionKind.BINARY_QUANTIZATION; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); @@ -100,6 +111,8 @@ public static BinaryQuantizationCompression fromJson(JsonReader jsonReader) thro rerankWithOriginalVectors = reader.getNullable(JsonReader::getBoolean); } else if ("defaultOversampling".equals(fieldName)) { defaultOversampling = reader.getNullable(JsonReader::getDouble); + } else if ("truncationDimension".equals(fieldName)) { + truncationDimension = reader.getNullable(JsonReader::getInt); } else if ("kind".equals(fieldName)) { kind = VectorSearchCompressionKind.fromString(reader.getString()); } else { @@ -111,6 +124,7 @@ public static BinaryQuantizationCompression fromJson(JsonReader jsonReader) thro = new BinaryQuantizationCompression(compressionName); deserializedBinaryQuantizationCompression.setRerankWithOriginalVectors(rerankWithOriginalVectors); deserializedBinaryQuantizationCompression.setDefaultOversampling(defaultOversampling); + deserializedBinaryQuantizationCompression.setTruncationDimension(truncationDimension); deserializedBinaryQuantizationCompression.kind = kind; return deserializedBinaryQuantizationCompression; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/CustomNormalizer.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/CustomNormalizer.java new file mode 100644 index 0000000000000..652e271e6d6a7 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/CustomNormalizer.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Allows you to configure normalization for filterable, sortable, and facetable fields, which by default operate with + * strict matching. This is a user-defined configuration consisting of at least one or more filters, which modify the + * token that is stored. + */ +@Fluent +public final class CustomNormalizer extends LexicalNormalizer { + /* + * A URI fragment specifying the type of normalizer. + */ + private String odataType = "#Microsoft.Azure.Search.CustomNormalizer"; + + /* + * A list of token filters used to filter out or modify the input token. For example, you can specify a lowercase + * filter that converts all characters to lowercase. The filters are run in the order in which they are listed. + */ + private List tokenFilters; + + /* + * A list of character filters used to prepare input text before it is processed. For instance, they can replace + * certain characters or symbols. The filters are run in the order in which they are listed. + */ + private List charFilters; + + /** + * Creates an instance of CustomNormalizer class. + * + * @param name the name value to set. + */ + public CustomNormalizer(String name) { + super(name); + } + + /** + * Get the odataType property: A URI fragment specifying the type of normalizer. + * + * @return the odataType value. + */ + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the tokenFilters property: A list of token filters used to filter out or modify the input token. For example, + * you can specify a lowercase filter that converts all characters to lowercase. The filters are run in the order in + * which they are listed. + * + * @return the tokenFilters value. + */ + public List getTokenFilters() { + return this.tokenFilters; + } + + /** + * Set the tokenFilters property: A list of token filters used to filter out or modify the input token. For example, + * you can specify a lowercase filter that converts all characters to lowercase. The filters are run in the order in + * which they are listed. + * + * @param tokenFilters the tokenFilters value to set. + * @return the CustomNormalizer object itself. + */ + public CustomNormalizer setTokenFilters(List tokenFilters) { + this.tokenFilters = tokenFilters; + return this; + } + + /** + * Get the charFilters property: A list of character filters used to prepare input text before it is processed. For + * instance, they can replace certain characters or symbols. The filters are run in the order in which they are + * listed. + * + * @return the charFilters value. + */ + public List getCharFilters() { + return this.charFilters; + } + + /** + * Set the charFilters property: A list of character filters used to prepare input text before it is processed. For + * instance, they can replace certain characters or symbols. The filters are run in the order in which they are + * listed. + * + * @param charFilters the charFilters value to set. + * @return the CustomNormalizer object itself. + */ + public CustomNormalizer setCharFilters(List charFilters) { + this.charFilters = charFilters; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeArrayField("tokenFilters", this.tokenFilters, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("charFilters", this.charFilters, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomNormalizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomNormalizer if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CustomNormalizer. + */ + public static CustomNormalizer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean nameFound = false; + String name = null; + String odataType = "#Microsoft.Azure.Search.CustomNormalizer"; + List tokenFilters = null; + List charFilters = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + nameFound = true; + } else if ("@odata.type".equals(fieldName)) { + odataType = reader.getString(); + } else if ("tokenFilters".equals(fieldName)) { + tokenFilters = reader.readArray(reader1 -> TokenFilterName.fromString(reader1.getString())); + } else if ("charFilters".equals(fieldName)) { + charFilters = reader.readArray(reader1 -> CharFilterName.fromString(reader1.getString())); + } else { + reader.skipChildren(); + } + } + if (nameFound) { + CustomNormalizer deserializedCustomNormalizer = new CustomNormalizer(name); + deserializedCustomNormalizer.odataType = odataType; + deserializedCustomNormalizer.tokenFilters = tokenFilters; + deserializedCustomNormalizer.charFilters = charFilters; + + return deserializedCustomNormalizer; + } + throw new IllegalStateException("Missing required property: name"); + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/DataDeletionDetectionPolicy.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/DataDeletionDetectionPolicy.java index 2796e02932b59..03aa1302dd7aa 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/DataDeletionDetectionPolicy.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/DataDeletionDetectionPolicy.java @@ -74,6 +74,9 @@ public static DataDeletionDetectionPolicy fromJson(JsonReader jsonReader) throws // Use the discriminator value to determine which subtype should be deserialized. if ("#Microsoft.Azure.Search.SoftDeleteColumnDeletionDetectionPolicy".equals(discriminatorValue)) { return SoftDeleteColumnDeletionDetectionPolicy.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.NativeBlobSoftDeleteDeletionDetectionPolicy" + .equals(discriminatorValue)) { + return NativeBlobSoftDeleteDeletionDetectionPolicy.fromJson(readerToUse.reset()); } else { return fromJsonKnownDiscriminator(readerToUse.reset()); } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/IndexerCurrentState.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/IndexerCurrentState.java new file mode 100644 index 0000000000000..b88db42a19d65 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/IndexerCurrentState.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents all of the state that defines and dictates the indexer's current execution. + */ +@Immutable +public final class IndexerCurrentState implements JsonSerializable { + /* + * The mode the indexer is running in. + */ + private IndexingMode mode; + + /* + * Change tracking state used when indexing starts on all documents in the datasource. + */ + private String allDocsInitialChangeTrackingState; + + /* + * Change tracking state value when indexing finishes on all documents in the datasource. + */ + private String allDocsFinalChangeTrackingState; + + /* + * Change tracking state used when indexing starts on select, reset documents in the datasource. + */ + private String resetDocsInitialChangeTrackingState; + + /* + * Change tracking state value when indexing finishes on select, reset documents in the datasource. + */ + private String resetDocsFinalChangeTrackingState; + + /* + * The list of document keys that have been reset. The document key is the document's unique identifier for the data + * in the search index. The indexer will prioritize selectively re-ingesting these keys. + */ + private List resetDocumentKeys; + + /* + * The list of datasource document ids that have been reset. The datasource document id is the unique identifier for + * the data in the datasource. The indexer will prioritize selectively re-ingesting these ids. + */ + private List resetDatasourceDocumentIds; + + /** + * Creates an instance of IndexerCurrentState class. + */ + public IndexerCurrentState() { + } + + /** + * Get the mode property: The mode the indexer is running in. + * + * @return the mode value. + */ + public IndexingMode getMode() { + return this.mode; + } + + /** + * Get the allDocsInitialChangeTrackingState property: Change tracking state used when indexing starts on all + * documents in the datasource. + * + * @return the allDocsInitialChangeTrackingState value. + */ + public String getAllDocsInitialChangeTrackingState() { + return this.allDocsInitialChangeTrackingState; + } + + /** + * Get the allDocsFinalChangeTrackingState property: Change tracking state value when indexing finishes on all + * documents in the datasource. + * + * @return the allDocsFinalChangeTrackingState value. + */ + public String getAllDocsFinalChangeTrackingState() { + return this.allDocsFinalChangeTrackingState; + } + + /** + * Get the resetDocsInitialChangeTrackingState property: Change tracking state used when indexing starts on select, + * reset documents in the datasource. + * + * @return the resetDocsInitialChangeTrackingState value. + */ + public String getResetDocsInitialChangeTrackingState() { + return this.resetDocsInitialChangeTrackingState; + } + + /** + * Get the resetDocsFinalChangeTrackingState property: Change tracking state value when indexing finishes on select, + * reset documents in the datasource. + * + * @return the resetDocsFinalChangeTrackingState value. + */ + public String getResetDocsFinalChangeTrackingState() { + return this.resetDocsFinalChangeTrackingState; + } + + /** + * Get the resetDocumentKeys property: The list of document keys that have been reset. The document key is the + * document's unique identifier for the data in the search index. The indexer will prioritize selectively + * re-ingesting these keys. + * + * @return the resetDocumentKeys value. + */ + public List getResetDocumentKeys() { + return this.resetDocumentKeys; + } + + /** + * Get the resetDatasourceDocumentIds property: The list of datasource document ids that have been reset. The + * datasource document id is the unique identifier for the data in the datasource. The indexer will prioritize + * selectively re-ingesting these ids. + * + * @return the resetDatasourceDocumentIds value. + */ + public List getResetDatasourceDocumentIds() { + return this.resetDatasourceDocumentIds; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexerCurrentState from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexerCurrentState if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the IndexerCurrentState. + */ + public static IndexerCurrentState fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndexerCurrentState deserializedIndexerCurrentState = new IndexerCurrentState(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("mode".equals(fieldName)) { + deserializedIndexerCurrentState.mode = IndexingMode.fromString(reader.getString()); + } else if ("allDocsInitialChangeTrackingState".equals(fieldName)) { + deserializedIndexerCurrentState.allDocsInitialChangeTrackingState = reader.getString(); + } else if ("allDocsFinalChangeTrackingState".equals(fieldName)) { + deserializedIndexerCurrentState.allDocsFinalChangeTrackingState = reader.getString(); + } else if ("resetDocsInitialChangeTrackingState".equals(fieldName)) { + deserializedIndexerCurrentState.resetDocsInitialChangeTrackingState = reader.getString(); + } else if ("resetDocsFinalChangeTrackingState".equals(fieldName)) { + deserializedIndexerCurrentState.resetDocsFinalChangeTrackingState = reader.getString(); + } else if ("resetDocumentKeys".equals(fieldName)) { + List resetDocumentKeys = reader.readArray(reader1 -> reader1.getString()); + deserializedIndexerCurrentState.resetDocumentKeys = resetDocumentKeys; + } else if ("resetDatasourceDocumentIds".equals(fieldName)) { + List resetDatasourceDocumentIds = reader.readArray(reader1 -> reader1.getString()); + deserializedIndexerCurrentState.resetDatasourceDocumentIds = resetDatasourceDocumentIds; + } else { + reader.skipChildren(); + } + } + + return deserializedIndexerCurrentState; + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/IndexerExecutionResult.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/IndexerExecutionResult.java index e6aa2d071a534..66bf3a8b1a3fb 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/IndexerExecutionResult.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/IndexerExecutionResult.java @@ -27,6 +27,16 @@ public final class IndexerExecutionResult implements JsonSerializable { + /** + * Indicates that the reset that occurred was for a call to ResetDocs. + */ + public static final IndexerExecutionStatusDetail RESET_DOCS = fromString("resetDocs"); + + /** + * Creates a new instance of IndexerExecutionStatusDetail value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public IndexerExecutionStatusDetail() { + } + + /** + * Creates or finds a IndexerExecutionStatusDetail from its string representation. + * + * @param name a name to look for. + * @return the corresponding IndexerExecutionStatusDetail. + */ + public static IndexerExecutionStatusDetail fromString(String name) { + return fromString(name, IndexerExecutionStatusDetail.class); + } + + /** + * Gets known IndexerExecutionStatusDetail values. + * + * @return known IndexerExecutionStatusDetail values. + */ + public static Collection values() { + return values(IndexerExecutionStatusDetail.class); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/IndexingMode.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/IndexingMode.java new file mode 100644 index 0000000000000..7d7b1e8f6fe89 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/IndexingMode.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Represents the mode the indexer is executing in. + */ +public final class IndexingMode extends ExpandableStringEnum { + /** + * The indexer is indexing all documents in the datasource. + */ + public static final IndexingMode INDEXING_ALL_DOCS = fromString("indexingAllDocs"); + + /** + * The indexer is indexing selective, reset documents in the datasource. The documents being indexed are defined on + * indexer status. + */ + public static final IndexingMode INDEXING_RESET_DOCS = fromString("indexingResetDocs"); + + /** + * Creates a new instance of IndexingMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public IndexingMode() { + } + + /** + * Creates or finds a IndexingMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding IndexingMode. + */ + public static IndexingMode fromString(String name) { + return fromString(name, IndexingMode.class); + } + + /** + * Gets known IndexingMode values. + * + * @return known IndexingMode values. + */ + public static Collection values() { + return values(IndexingMode.class); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/LexicalNormalizer.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/LexicalNormalizer.java new file mode 100644 index 0000000000000..8689929abf066 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/LexicalNormalizer.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Base type for normalizers. + */ +@Immutable +public class LexicalNormalizer implements JsonSerializable { + /* + * A URI fragment specifying the type of normalizer. + */ + private String odataType = "LexicalNormalizer"; + + /* + * The name of the normalizer. It must only contain letters, digits, spaces, dashes or underscores, can only start + * and end with alphanumeric characters, and is limited to 128 characters. It cannot end in '.microsoft' nor + * '.lucene', nor be named 'asciifolding', 'standard', 'lowercase', 'uppercase', or 'elision'. + */ + private final String name; + + /** + * Creates an instance of LexicalNormalizer class. + * + * @param name the name value to set. + */ + public LexicalNormalizer(String name) { + this.name = name; + } + + /** + * Get the odataType property: A URI fragment specifying the type of normalizer. + * + * @return the odataType value. + */ + public String getOdataType() { + return this.odataType; + } + + /** + * Get the name property: The name of the normalizer. It must only contain letters, digits, spaces, dashes or + * underscores, can only start and end with alphanumeric characters, and is limited to 128 characters. It cannot end + * in '.microsoft' nor '.lucene', nor be named 'asciifolding', 'standard', 'lowercase', 'uppercase', or 'elision'. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LexicalNormalizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LexicalNormalizer if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the LexicalNormalizer. + */ + public static LexicalNormalizer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("@odata.type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("#Microsoft.Azure.Search.CustomNormalizer".equals(discriminatorValue)) { + return CustomNormalizer.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static LexicalNormalizer fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean nameFound = false; + String name = null; + String odataType = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + nameFound = true; + } else if ("@odata.type".equals(fieldName)) { + odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + if (nameFound) { + LexicalNormalizer deserializedLexicalNormalizer = new LexicalNormalizer(name); + deserializedLexicalNormalizer.odataType = odataType; + + return deserializedLexicalNormalizer; + } + throw new IllegalStateException("Missing required property: name"); + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/LexicalNormalizerName.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/LexicalNormalizerName.java new file mode 100644 index 0000000000000..f199df6d4e871 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/LexicalNormalizerName.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines the names of all text normalizers supported by the search engine. + */ +public final class LexicalNormalizerName extends ExpandableStringEnum { + /** + * Converts alphabetic, numeric, and symbolic Unicode characters which are not in the first 127 ASCII characters + * (the "Basic Latin" Unicode block) into their ASCII equivalents, if such equivalents exist. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/miscellaneous/ASCIIFoldingFilter.html. + */ + public static final LexicalNormalizerName ASCII_FOLDING = fromString("asciifolding"); + + /** + * Removes elisions. For example, "l'avion" (the plane) will be converted to "avion" (plane). See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/util/ElisionFilter.html. + */ + public static final LexicalNormalizerName ELISION = fromString("elision"); + + /** + * Normalizes token text to lowercase. See + * https://lucene.apache.org/core/6_6_1/analyzers-common/org/apache/lucene/analysis/core/LowerCaseFilter.html. + */ + public static final LexicalNormalizerName LOWERCASE = fromString("lowercase"); + + /** + * Standard normalizer, which consists of lowercase and asciifolding. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/reverse/ReverseStringFilter.html. + */ + public static final LexicalNormalizerName STANDARD = fromString("standard"); + + /** + * Normalizes token text to uppercase. See + * https://lucene.apache.org/core/6_6_1/analyzers-common/org/apache/lucene/analysis/core/UpperCaseFilter.html. + */ + public static final LexicalNormalizerName UPPERCASE = fromString("uppercase"); + + /** + * Creates a new instance of LexicalNormalizerName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LexicalNormalizerName() { + } + + /** + * Creates or finds a LexicalNormalizerName from its string representation. + * + * @param name a name to look for. + * @return the corresponding LexicalNormalizerName. + */ + public static LexicalNormalizerName fromString(String name) { + return fromString(name, LexicalNormalizerName.class); + } + + /** + * Gets known LexicalNormalizerName values. + * + * @return known LexicalNormalizerName values. + */ + public static Collection values() { + return values(LexicalNormalizerName.class); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/NativeBlobSoftDeleteDeletionDetectionPolicy.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/NativeBlobSoftDeleteDeletionDetectionPolicy.java new file mode 100644 index 0000000000000..18728bd48a705 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/NativeBlobSoftDeleteDeletionDetectionPolicy.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines a data deletion detection policy utilizing Azure Blob Storage's native soft delete feature for deletion + * detection. + */ +@Immutable +public final class NativeBlobSoftDeleteDeletionDetectionPolicy extends DataDeletionDetectionPolicy { + /* + * A URI fragment specifying the type of data deletion detection policy. + */ + private String odataType = "#Microsoft.Azure.Search.NativeBlobSoftDeleteDeletionDetectionPolicy"; + + /** + * Creates an instance of NativeBlobSoftDeleteDeletionDetectionPolicy class. + */ + public NativeBlobSoftDeleteDeletionDetectionPolicy() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of data deletion detection policy. + * + * @return the odataType value. + */ + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NativeBlobSoftDeleteDeletionDetectionPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NativeBlobSoftDeleteDeletionDetectionPolicy if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the NativeBlobSoftDeleteDeletionDetectionPolicy. + */ + public static NativeBlobSoftDeleteDeletionDetectionPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NativeBlobSoftDeleteDeletionDetectionPolicy deserializedNativeBlobSoftDeleteDeletionDetectionPolicy + = new NativeBlobSoftDeleteDeletionDetectionPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("@odata.type".equals(fieldName)) { + deserializedNativeBlobSoftDeleteDeletionDetectionPolicy.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNativeBlobSoftDeleteDeletionDetectionPolicy; + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/ScalarQuantizationCompression.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/ScalarQuantizationCompression.java index fea423684ec65..1b53cbee42669 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/ScalarQuantizationCompression.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/ScalarQuantizationCompression.java @@ -85,6 +85,15 @@ public ScalarQuantizationCompression setDefaultOversampling(Double defaultOversa return this; } + /** + * {@inheritDoc} + */ + @Override + public ScalarQuantizationCompression setTruncationDimension(Integer truncationDimension) { + super.setTruncationDimension(truncationDimension); + return this; + } + /** * {@inheritDoc} */ @@ -94,6 +103,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStringField("name", getCompressionName()); jsonWriter.writeBooleanField("rerankWithOriginalVectors", isRerankWithOriginalVectors()); jsonWriter.writeNumberField("defaultOversampling", getDefaultOversampling()); + jsonWriter.writeNumberField("truncationDimension", getTruncationDimension()); jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); jsonWriter.writeJsonField("scalarQuantizationParameters", this.parameters); return jsonWriter.writeEndObject(); @@ -114,6 +124,7 @@ public static ScalarQuantizationCompression fromJson(JsonReader jsonReader) thro String compressionName = null; Boolean rerankWithOriginalVectors = null; Double defaultOversampling = null; + Integer truncationDimension = null; VectorSearchCompressionKind kind = VectorSearchCompressionKind.SCALAR_QUANTIZATION; ScalarQuantizationParameters parameters = null; while (reader.nextToken() != JsonToken.END_OBJECT) { @@ -127,6 +138,8 @@ public static ScalarQuantizationCompression fromJson(JsonReader jsonReader) thro rerankWithOriginalVectors = reader.getNullable(JsonReader::getBoolean); } else if ("defaultOversampling".equals(fieldName)) { defaultOversampling = reader.getNullable(JsonReader::getDouble); + } else if ("truncationDimension".equals(fieldName)) { + truncationDimension = reader.getNullable(JsonReader::getInt); } else if ("kind".equals(fieldName)) { kind = VectorSearchCompressionKind.fromString(reader.getString()); } else if ("scalarQuantizationParameters".equals(fieldName)) { @@ -140,6 +153,7 @@ public static ScalarQuantizationCompression fromJson(JsonReader jsonReader) thro = new ScalarQuantizationCompression(compressionName); deserializedScalarQuantizationCompression.setRerankWithOriginalVectors(rerankWithOriginalVectors); deserializedScalarQuantizationCompression.setDefaultOversampling(defaultOversampling); + deserializedScalarQuantizationCompression.setTruncationDimension(truncationDimension); deserializedScalarQuantizationCompression.kind = kind; deserializedScalarQuantizationCompression.parameters = parameters; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchAlias.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchAlias.java new file mode 100644 index 0000000000000..3f73dbc474e85 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchAlias.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * Represents an index alias, which describes a mapping from the alias name to an index. The alias name can be used in + * place of the index name for supported operations. + */ +@Fluent +public final class SearchAlias implements JsonSerializable { + /* + * The name of the alias. + */ + private final String name; + + /* + * The name of the index this alias maps to. Only one index name may be specified. + */ + private final List indexes; + + /* + * The ETag of the alias. + */ + private String eTag; + + /** + * Creates an instance of SearchAlias class. + * + * @param name the name value to set. + * @param indexes the indexes value to set. + */ + public SearchAlias(String name, List indexes) { + this.name = name; + this.indexes = indexes; + } + + /** + * Get the name property: The name of the alias. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * Get the indexes property: The name of the index this alias maps to. Only one index name may be specified. + * + * @return the indexes value. + */ + public List getIndexes() { + return this.indexes; + } + + /** + * Get the eTag property: The ETag of the alias. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag of the alias. + * + * @param eTag the eTag value to set. + * @return the SearchAlias object itself. + */ + public SearchAlias setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeArrayField("indexes", this.indexes, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("@odata.etag", this.eTag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchAlias from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchAlias if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SearchAlias. + */ + public static SearchAlias fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean nameFound = false; + String name = null; + boolean indexesFound = false; + List indexes = null; + String eTag = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + nameFound = true; + } else if ("indexes".equals(fieldName)) { + indexes = reader.readArray(reader1 -> reader1.getString()); + indexesFound = true; + } else if ("@odata.etag".equals(fieldName)) { + eTag = reader.getString(); + } else { + reader.skipChildren(); + } + } + if (nameFound && indexesFound) { + SearchAlias deserializedSearchAlias = new SearchAlias(name, indexes); + deserializedSearchAlias.eTag = eTag; + + return deserializedSearchAlias; + } + List missingProperties = new ArrayList<>(); + if (!nameFound) { + missingProperties.add("name"); + } + if (!indexesFound) { + missingProperties.add("indexes"); + } + + throw new IllegalStateException( + "Missing required property/properties: " + String.join(", ", missingProperties)); + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchField.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchField.java index 2e96f90c36892..e14effe296310 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchField.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchField.java @@ -124,6 +124,13 @@ public final class SearchField implements JsonSerializable { */ private LexicalAnalyzerName indexAnalyzerName; + /* + * The name of the normalizer to use for the field. This option can be used only with fields with filterable, + * sortable, or facetable enabled. Once the normalizer is chosen, it cannot be changed for the field. Must be null + * for complex fields. + */ + private LexicalNormalizerName normalizer; + /* * The dimensionality of the vector field. */ @@ -474,6 +481,30 @@ public SearchField setIndexAnalyzerName(LexicalAnalyzerName indexAnalyzerName) { return this; } + /** + * Get the normalizer property: The name of the normalizer to use for the field. This option can be used only with + * fields with filterable, sortable, or facetable enabled. Once the normalizer is chosen, it cannot be changed for + * the field. Must be null for complex fields. + * + * @return the normalizer value. + */ + public LexicalNormalizerName getNormalizer() { + return this.normalizer; + } + + /** + * Set the normalizer property: The name of the normalizer to use for the field. This option can be used only with + * fields with filterable, sortable, or facetable enabled. Once the normalizer is chosen, it cannot be changed for + * the field. Must be null for complex fields. + * + * @param normalizer the normalizer value to set. + * @return the SearchField object itself. + */ + public SearchField setNormalizer(LexicalNormalizerName normalizer) { + this.normalizer = normalizer; + return this; + } + /** * Get the vectorSearchDimensions property: The dimensionality of the vector field. * @@ -606,6 +637,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { this.searchAnalyzerName == null ? null : this.searchAnalyzerName.toString()); jsonWriter.writeStringField("indexAnalyzer", this.indexAnalyzerName == null ? null : this.indexAnalyzerName.toString()); + jsonWriter.writeStringField("normalizer", this.normalizer == null ? null : this.normalizer.toString()); jsonWriter.writeNumberField("dimensions", this.vectorSearchDimensions); jsonWriter.writeStringField("vectorSearchProfile", this.vectorSearchProfileName); jsonWriter.writeStringField("vectorEncoding", @@ -641,6 +673,7 @@ public static SearchField fromJson(JsonReader jsonReader) throws IOException { LexicalAnalyzerName analyzerName = null; LexicalAnalyzerName searchAnalyzerName = null; LexicalAnalyzerName indexAnalyzerName = null; + LexicalNormalizerName normalizer = null; Integer vectorSearchDimensions = null; String vectorSearchProfileName = null; VectorEncodingFormat vectorEncodingFormat = null; @@ -675,6 +708,8 @@ public static SearchField fromJson(JsonReader jsonReader) throws IOException { searchAnalyzerName = LexicalAnalyzerName.fromString(reader.getString()); } else if ("indexAnalyzer".equals(fieldName)) { indexAnalyzerName = LexicalAnalyzerName.fromString(reader.getString()); + } else if ("normalizer".equals(fieldName)) { + normalizer = LexicalNormalizerName.fromString(reader.getString()); } else if ("dimensions".equals(fieldName)) { vectorSearchDimensions = reader.getNullable(JsonReader::getInt); } else if ("vectorSearchProfile".equals(fieldName)) { @@ -701,6 +736,7 @@ public static SearchField fromJson(JsonReader jsonReader) throws IOException { deserializedSearchField.analyzerName = analyzerName; deserializedSearchField.searchAnalyzerName = searchAnalyzerName; deserializedSearchField.indexAnalyzerName = indexAnalyzerName; + deserializedSearchField.normalizer = normalizer; deserializedSearchField.vectorSearchDimensions = vectorSearchDimensions; deserializedSearchField.vectorSearchProfileName = vectorSearchProfileName; deserializedSearchField.vectorEncodingFormat = vectorEncodingFormat; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndex.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndex.java index 88f56472e1825..32fbf71814846 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndex.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndex.java @@ -71,6 +71,11 @@ public final class SearchIndex implements JsonSerializable { */ private List charFilters; + /* + * The normalizers for the index. + */ + private List normalizers; + /* * A description of an encryption key that you create in Azure Key Vault. This key is used to provide an additional * level of encryption-at-rest for your data when you want full assurance that no one, not even Microsoft, can @@ -305,6 +310,26 @@ public SearchIndex setCharFilters(List charFilters) { return this; } + /** + * Get the normalizers property: The normalizers for the index. + * + * @return the normalizers value. + */ + public List getNormalizers() { + return this.normalizers; + } + + /** + * Set the normalizers property: The normalizers for the index. + * + * @param normalizers the normalizers value to set. + * @return the SearchIndex object itself. + */ + public SearchIndex setNormalizers(List normalizers) { + this.normalizers = normalizers; + return this; + } + /** * Get the encryptionKey property: A description of an encryption key that you create in Azure Key Vault. This key * is used to provide an additional level of encryption-at-rest for your data when you want full assurance that no @@ -438,6 +463,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeArrayField("tokenizers", this.tokenizers, (writer, element) -> writer.writeJson(element)); jsonWriter.writeArrayField("tokenFilters", this.tokenFilters, (writer, element) -> writer.writeJson(element)); jsonWriter.writeArrayField("charFilters", this.charFilters, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("normalizers", this.normalizers, (writer, element) -> writer.writeJson(element)); jsonWriter.writeJsonField("encryptionKey", this.encryptionKey); jsonWriter.writeJsonField("similarity", this.similarity); jsonWriter.writeJsonField("semantic", this.semanticSearch); @@ -468,6 +494,7 @@ public static SearchIndex fromJson(JsonReader jsonReader) throws IOException { List tokenizers = null; List tokenFilters = null; List charFilters = null; + List normalizers = null; SearchResourceEncryptionKey encryptionKey = null; SimilarityAlgorithm similarity = null; SemanticSearch semanticSearch = null; @@ -497,6 +524,8 @@ public static SearchIndex fromJson(JsonReader jsonReader) throws IOException { tokenFilters = reader.readArray(reader1 -> TokenFilter.fromJson(reader1)); } else if ("charFilters".equals(fieldName)) { charFilters = reader.readArray(reader1 -> CharFilter.fromJson(reader1)); + } else if ("normalizers".equals(fieldName)) { + normalizers = reader.readArray(reader1 -> LexicalNormalizer.fromJson(reader1)); } else if ("encryptionKey".equals(fieldName)) { encryptionKey = SearchResourceEncryptionKey.fromJson(reader); } else if ("similarity".equals(fieldName)) { @@ -522,6 +551,7 @@ public static SearchIndex fromJson(JsonReader jsonReader) throws IOException { deserializedSearchIndex.tokenizers = tokenizers; deserializedSearchIndex.tokenFilters = tokenFilters; deserializedSearchIndex.charFilters = charFilters; + deserializedSearchIndex.normalizers = normalizers; deserializedSearchIndex.encryptionKey = encryptionKey; deserializedSearchIndex.similarity = similarity; deserializedSearchIndex.semanticSearch = semanticSearch; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexer.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexer.java index 120e489e16072..4ff7f5043f7ad 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexer.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexer.java @@ -86,6 +86,12 @@ public final class SearchIndexer implements JsonSerializable { */ private SearchResourceEncryptionKey encryptionKey; + /* + * Adds caching to an enrichment pipeline to allow for incremental modification steps without having to rebuild the + * index every time. + */ + private SearchIndexerCache cache; + /** * Creates an instance of SearchIndexer class. * @@ -342,6 +348,28 @@ public SearchIndexer setEncryptionKey(SearchResourceEncryptionKey encryptionKey) return this; } + /** + * Get the cache property: Adds caching to an enrichment pipeline to allow for incremental modification steps + * without having to rebuild the index every time. + * + * @return the cache value. + */ + public SearchIndexerCache getCache() { + return this.cache; + } + + /** + * Set the cache property: Adds caching to an enrichment pipeline to allow for incremental modification steps + * without having to rebuild the index every time. + * + * @param cache the cache value to set. + * @return the SearchIndexer object itself. + */ + public SearchIndexer setCache(SearchIndexerCache cache) { + this.cache = cache; + return this; + } + /** * {@inheritDoc} */ @@ -361,6 +389,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeBooleanField("disabled", this.isDisabled); jsonWriter.writeStringField("@odata.etag", this.eTag); jsonWriter.writeJsonField("encryptionKey", this.encryptionKey); + jsonWriter.writeJsonField("cache", this.cache); return jsonWriter.writeEndObject(); } @@ -388,6 +417,7 @@ public static SearchIndexer fromJson(JsonReader jsonReader) throws IOException { Boolean isDisabled = null; String eTag = null; SearchResourceEncryptionKey encryptionKey = null; + SearchIndexerCache cache = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); @@ -416,6 +446,8 @@ public static SearchIndexer fromJson(JsonReader jsonReader) throws IOException { eTag = reader.getString(); } else if ("encryptionKey".equals(fieldName)) { encryptionKey = SearchResourceEncryptionKey.fromJson(reader); + } else if ("cache".equals(fieldName)) { + cache = SearchIndexerCache.fromJson(reader); } else { reader.skipChildren(); } @@ -433,6 +465,7 @@ public static SearchIndexer fromJson(JsonReader jsonReader) throws IOException { deserializedSearchIndexer.isDisabled = isDisabled; deserializedSearchIndexer.eTag = eTag; deserializedSearchIndexer.encryptionKey = encryptionKey; + deserializedSearchIndexer.cache = cache; return deserializedSearchIndexer; } throw new IllegalStateException("Missing required property: name"); diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexerCache.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexerCache.java new file mode 100644 index 0000000000000..6f8653a18d029 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexerCache.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SearchIndexerCache model. + */ +@Fluent +public final class SearchIndexerCache implements JsonSerializable { + /* + * The connection string to the storage account where the cache data will be persisted. + */ + private String storageConnectionString; + + /* + * Specifies whether incremental reprocessing is enabled. + */ + private Boolean enableReprocessing; + + /* + * The user-assigned managed identity used for connections to the enrichment cache. If the connection string + * indicates an identity (ResourceId) and it's not specified, the system-assigned managed identity is used. On + * updates to the indexer, if the identity is unspecified, the value remains unchanged. If set to "none", the value + * of this property is cleared. + */ + private SearchIndexerDataIdentity identity; + + /** + * Creates an instance of SearchIndexerCache class. + */ + public SearchIndexerCache() { + } + + /** + * Get the storageConnectionString property: The connection string to the storage account where the cache data will + * be persisted. + * + * @return the storageConnectionString value. + */ + public String getStorageConnectionString() { + return this.storageConnectionString; + } + + /** + * Set the storageConnectionString property: The connection string to the storage account where the cache data will + * be persisted. + * + * @param storageConnectionString the storageConnectionString value to set. + * @return the SearchIndexerCache object itself. + */ + public SearchIndexerCache setStorageConnectionString(String storageConnectionString) { + this.storageConnectionString = storageConnectionString; + return this; + } + + /** + * Get the enableReprocessing property: Specifies whether incremental reprocessing is enabled. + * + * @return the enableReprocessing value. + */ + public Boolean isEnableReprocessing() { + return this.enableReprocessing; + } + + /** + * Set the enableReprocessing property: Specifies whether incremental reprocessing is enabled. + * + * @param enableReprocessing the enableReprocessing value to set. + * @return the SearchIndexerCache object itself. + */ + public SearchIndexerCache setEnableReprocessing(Boolean enableReprocessing) { + this.enableReprocessing = enableReprocessing; + return this; + } + + /** + * Get the identity property: The user-assigned managed identity used for connections to the enrichment cache. If + * the connection string indicates an identity (ResourceId) and it's not specified, the system-assigned managed + * identity is used. On updates to the indexer, if the identity is unspecified, the value remains unchanged. If set + * to "none", the value of this property is cleared. + * + * @return the identity value. + */ + public SearchIndexerDataIdentity getIdentity() { + return this.identity; + } + + /** + * Set the identity property: The user-assigned managed identity used for connections to the enrichment cache. If + * the connection string indicates an identity (ResourceId) and it's not specified, the system-assigned managed + * identity is used. On updates to the indexer, if the identity is unspecified, the value remains unchanged. If set + * to "none", the value of this property is cleared. + * + * @param identity the identity value to set. + * @return the SearchIndexerCache object itself. + */ + public SearchIndexerCache setIdentity(SearchIndexerDataIdentity identity) { + this.identity = identity; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("storageConnectionString", this.storageConnectionString); + jsonWriter.writeBooleanField("enableReprocessing", this.enableReprocessing); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerCache from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerCache if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the SearchIndexerCache. + */ + public static SearchIndexerCache fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerCache deserializedSearchIndexerCache = new SearchIndexerCache(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("storageConnectionString".equals(fieldName)) { + deserializedSearchIndexerCache.storageConnectionString = reader.getString(); + } else if ("enableReprocessing".equals(fieldName)) { + deserializedSearchIndexerCache.enableReprocessing = reader.getNullable(JsonReader::getBoolean); + } else if ("identity".equals(fieldName)) { + deserializedSearchIndexerCache.identity = SearchIndexerDataIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerCache; + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexerDataSourceConnection.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexerDataSourceConnection.java index 028be6b67bcab..24e63cb2cc49f 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexerDataSourceConnection.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexerDataSourceConnection.java @@ -44,6 +44,13 @@ public final class SearchIndexerDataSourceConnection implements JsonSerializable */ private SearchIndexerDataContainer container; + /* + * An explicit managed identity to use for this datasource. If not specified and the connection string is a managed + * identity, the system-assigned managed identity is used. If not specified, the value remains unchanged. If "none" + * is specified, the value of this property is cleared. + */ + private SearchIndexerDataIdentity identity; + /* * The data change detection policy for the datasource. */ @@ -148,6 +155,30 @@ public SearchIndexerDataSourceConnection setContainer(SearchIndexerDataContainer return this; } + /** + * Get the identity property: An explicit managed identity to use for this datasource. If not specified and the + * connection string is a managed identity, the system-assigned managed identity is used. If not specified, the + * value remains unchanged. If "none" is specified, the value of this property is cleared. + * + * @return the identity value. + */ + public SearchIndexerDataIdentity getIdentity() { + return this.identity; + } + + /** + * Set the identity property: An explicit managed identity to use for this datasource. If not specified and the + * connection string is a managed identity, the system-assigned managed identity is used. If not specified, the + * value remains unchanged. If "none" is specified, the value of this property is cleared. + * + * @param identity the identity value to set. + * @return the SearchIndexerDataSourceConnection object itself. + */ + public SearchIndexerDataSourceConnection setIdentity(SearchIndexerDataIdentity identity) { + this.identity = identity; + return this; + } + /** * Get the dataChangeDetectionPolicy property: The data change detection policy for the datasource. * @@ -253,6 +284,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); jsonWriter.writeJsonField("credentials", this.credentials); jsonWriter.writeJsonField("container", this.container); + jsonWriter.writeJsonField("identity", this.identity); jsonWriter.writeJsonField("dataChangeDetectionPolicy", this.dataChangeDetectionPolicy); jsonWriter.writeJsonField("dataDeletionDetectionPolicy", this.dataDeletionDetectionPolicy); jsonWriter.writeStringField("@odata.etag", this.eTag); @@ -277,6 +309,7 @@ public static SearchIndexerDataSourceConnection fromJson(JsonReader jsonReader) SearchIndexerDataSourceType type = null; DataSourceCredentials credentials = null; SearchIndexerDataContainer container = null; + SearchIndexerDataIdentity identity = null; DataChangeDetectionPolicy dataChangeDetectionPolicy = null; DataDeletionDetectionPolicy dataDeletionDetectionPolicy = null; String eTag = null; @@ -295,6 +328,8 @@ public static SearchIndexerDataSourceConnection fromJson(JsonReader jsonReader) credentials = DataSourceCredentials.fromJson(reader); } else if ("container".equals(fieldName)) { container = SearchIndexerDataContainer.fromJson(reader); + } else if ("identity".equals(fieldName)) { + identity = SearchIndexerDataIdentity.fromJson(reader); } else if ("dataChangeDetectionPolicy".equals(fieldName)) { dataChangeDetectionPolicy = DataChangeDetectionPolicy.fromJson(reader); } else if ("dataDeletionDetectionPolicy".equals(fieldName)) { @@ -314,6 +349,7 @@ public static SearchIndexerDataSourceConnection fromJson(JsonReader jsonReader) deserializedSearchIndexerDataSourceConnection.type = type; deserializedSearchIndexerDataSourceConnection.credentials = credentials; deserializedSearchIndexerDataSourceConnection.container = container; + deserializedSearchIndexerDataSourceConnection.identity = identity; deserializedSearchIndexerDataSourceConnection.dataChangeDetectionPolicy = dataChangeDetectionPolicy; deserializedSearchIndexerDataSourceConnection.dataDeletionDetectionPolicy = dataDeletionDetectionPolicy; deserializedSearchIndexerDataSourceConnection.eTag = eTag; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexerDataSourceType.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexerDataSourceType.java index dc8049599648a..1606fe793b14e 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexerDataSourceType.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexerDataSourceType.java @@ -43,6 +43,11 @@ public final class SearchIndexerDataSourceType extends ExpandableStringEnum { /* * The connection string to the storage account projections will be stored in. @@ -30,6 +30,20 @@ public final class SearchIndexerKnowledgeStore implements JsonSerializable projections; + /* + * The user-assigned managed identity used for connections to Azure Storage when writing knowledge store + * projections. If the connection string indicates an identity (ResourceId) and it's not specified, the + * system-assigned managed identity is used. On updates to the indexer, if the identity is unspecified, the value + * remains unchanged. If set to "none", the value of this property is cleared. + */ + private SearchIndexerDataIdentity identity; + + /* + * A dictionary of knowledge store-specific configuration properties. Each name is the name of a specific property. + * Each value must be of a primitive type. + */ + private SearchIndexerKnowledgeStoreParameters parameters; + /** * Creates an instance of SearchIndexerKnowledgeStore class. * @@ -61,6 +75,54 @@ public List getProjections() { return this.projections; } + /** + * Get the identity property: The user-assigned managed identity used for connections to Azure Storage when writing + * knowledge store projections. If the connection string indicates an identity (ResourceId) and it's not specified, + * the system-assigned managed identity is used. On updates to the indexer, if the identity is unspecified, the + * value remains unchanged. If set to "none", the value of this property is cleared. + * + * @return the identity value. + */ + public SearchIndexerDataIdentity getIdentity() { + return this.identity; + } + + /** + * Set the identity property: The user-assigned managed identity used for connections to Azure Storage when writing + * knowledge store projections. If the connection string indicates an identity (ResourceId) and it's not specified, + * the system-assigned managed identity is used. On updates to the indexer, if the identity is unspecified, the + * value remains unchanged. If set to "none", the value of this property is cleared. + * + * @param identity the identity value to set. + * @return the SearchIndexerKnowledgeStore object itself. + */ + public SearchIndexerKnowledgeStore setIdentity(SearchIndexerDataIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the parameters property: A dictionary of knowledge store-specific configuration properties. Each name is the + * name of a specific property. Each value must be of a primitive type. + * + * @return the parameters value. + */ + public SearchIndexerKnowledgeStoreParameters getParameters() { + return this.parameters; + } + + /** + * Set the parameters property: A dictionary of knowledge store-specific configuration properties. Each name is the + * name of a specific property. Each value must be of a primitive type. + * + * @param parameters the parameters value to set. + * @return the SearchIndexerKnowledgeStore object itself. + */ + public SearchIndexerKnowledgeStore setParameters(SearchIndexerKnowledgeStoreParameters parameters) { + this.parameters = parameters; + return this; + } + /** * {@inheritDoc} */ @@ -69,6 +131,8 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("storageConnectionString", this.storageConnectionString); jsonWriter.writeArrayField("projections", this.projections, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeJsonField("parameters", this.parameters); return jsonWriter.writeEndObject(); } @@ -87,6 +151,8 @@ public static SearchIndexerKnowledgeStore fromJson(JsonReader jsonReader) throws String storageConnectionString = null; boolean projectionsFound = false; List projections = null; + SearchIndexerDataIdentity identity = null; + SearchIndexerKnowledgeStoreParameters parameters = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); @@ -97,12 +163,21 @@ public static SearchIndexerKnowledgeStore fromJson(JsonReader jsonReader) throws } else if ("projections".equals(fieldName)) { projections = reader.readArray(reader1 -> SearchIndexerKnowledgeStoreProjection.fromJson(reader1)); projectionsFound = true; + } else if ("identity".equals(fieldName)) { + identity = SearchIndexerDataIdentity.fromJson(reader); + } else if ("parameters".equals(fieldName)) { + parameters = SearchIndexerKnowledgeStoreParameters.fromJson(reader); } else { reader.skipChildren(); } } if (storageConnectionStringFound && projectionsFound) { - return new SearchIndexerKnowledgeStore(storageConnectionString, projections); + SearchIndexerKnowledgeStore deserializedSearchIndexerKnowledgeStore + = new SearchIndexerKnowledgeStore(storageConnectionString, projections); + deserializedSearchIndexerKnowledgeStore.identity = identity; + deserializedSearchIndexerKnowledgeStore.parameters = parameters; + + return deserializedSearchIndexerKnowledgeStore; } List missingProperties = new ArrayList<>(); if (!storageConnectionStringFound) { diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexerSkill.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexerSkill.java index e8702411fd2ed..2f40ee2cd8604 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexerSkill.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexerSkill.java @@ -235,8 +235,12 @@ public static SearchIndexerSkill fromJson(JsonReader jsonReader) throws IOExcept return DocumentExtractionSkill.fromJson(readerToUse.reset()); } else if ("#Microsoft.Skills.Custom.WebApiSkill".equals(discriminatorValue)) { return WebApiSkill.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Custom.AmlSkill".equals(discriminatorValue)) { + return AzureMachineLearningSkill.fromJson(readerToUse.reset()); } else if ("#Microsoft.Skills.Text.AzureOpenAIEmbeddingSkill".equals(discriminatorValue)) { return AzureOpenAIEmbeddingSkill.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Vision.VectorizeSkill".equals(discriminatorValue)) { + return VisionVectorizeSkill.fromJson(readerToUse.reset()); } else if ("#Microsoft.Skills.Text.PIIDetectionSkill".equals(discriminatorValue)) { return PiiDetectionSkill.fromJson(readerToUse.reset()); } else if ("#Microsoft.Skills.Text.EntityRecognitionSkill".equals(discriminatorValue)) { diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchResourceEncryptionKey.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchResourceEncryptionKey.java index a610a8d237765..ef77feab2f17e 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchResourceEncryptionKey.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchResourceEncryptionKey.java @@ -44,6 +44,13 @@ public final class SearchResourceEncryptionKey implements JsonSerializable missingProperties = new ArrayList<>(); diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchServiceCounters.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchServiceCounters.java index 4ba14ba514dae..739ecf061ea8f 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchServiceCounters.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchServiceCounters.java @@ -20,6 +20,11 @@ */ @Fluent public final class SearchServiceCounters implements JsonSerializable { + /* + * Total number of aliases. + */ + private ResourceCounter aliasCounter; + /* * Total number of documents across all indexes in the service. */ @@ -81,6 +86,26 @@ public SearchServiceCounters(ResourceCounter documentCounter, ResourceCounter in this.synonymMapCounter = synonymMapCounter; } + /** + * Get the aliasCounter property: Total number of aliases. + * + * @return the aliasCounter value. + */ + public ResourceCounter getAliasCounter() { + return this.aliasCounter; + } + + /** + * Set the aliasCounter property: Total number of aliases. + * + * @param aliasCounter the aliasCounter value to set. + * @return the SearchServiceCounters object itself. + */ + public SearchServiceCounters setAliasCounter(ResourceCounter aliasCounter) { + this.aliasCounter = aliasCounter; + return this; + } + /** * Get the documentCounter property: Total number of documents across all indexes in the service. * @@ -189,6 +214,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeJsonField("dataSourcesCount", this.dataSourceCounter); jsonWriter.writeJsonField("storageSize", this.storageSizeCounter); jsonWriter.writeJsonField("synonymMaps", this.synonymMapCounter); + jsonWriter.writeJsonField("aliasesCount", this.aliasCounter); jsonWriter.writeJsonField("skillsetCount", this.skillsetCounter); jsonWriter.writeJsonField("vectorIndexSize", this.vectorIndexSizeCounter); return jsonWriter.writeEndObject(); @@ -217,6 +243,7 @@ public static SearchServiceCounters fromJson(JsonReader jsonReader) throws IOExc ResourceCounter storageSizeCounter = null; boolean synonymMapCounterFound = false; ResourceCounter synonymMapCounter = null; + ResourceCounter aliasCounter = null; ResourceCounter skillsetCounter = null; ResourceCounter vectorIndexSizeCounter = null; while (reader.nextToken() != JsonToken.END_OBJECT) { @@ -241,6 +268,8 @@ public static SearchServiceCounters fromJson(JsonReader jsonReader) throws IOExc } else if ("synonymMaps".equals(fieldName)) { synonymMapCounter = ResourceCounter.fromJson(reader); synonymMapCounterFound = true; + } else if ("aliasesCount".equals(fieldName)) { + aliasCounter = ResourceCounter.fromJson(reader); } else if ("skillsetCount".equals(fieldName)) { skillsetCounter = ResourceCounter.fromJson(reader); } else if ("vectorIndexSize".equals(fieldName)) { @@ -257,6 +286,7 @@ public static SearchServiceCounters fromJson(JsonReader jsonReader) throws IOExc && synonymMapCounterFound) { SearchServiceCounters deserializedSearchServiceCounters = new SearchServiceCounters(documentCounter, indexCounter, indexerCounter, dataSourceCounter, storageSizeCounter, synonymMapCounter); + deserializedSearchServiceCounters.aliasCounter = aliasCounter; deserializedSearchServiceCounters.skillsetCounter = skillsetCounter; deserializedSearchServiceCounters.vectorIndexSizeCounter = vectorIndexSizeCounter; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SplitSkill.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SplitSkill.java index 4a42c9a3bec33..77f4b3192ab39 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SplitSkill.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SplitSkill.java @@ -52,6 +52,20 @@ public final class SplitSkill extends SearchIndexerSkill { */ private Integer maximumPagesToTake; + /* + * Only applies if textSplitMode is set to pages. There are two possible values. The choice of the values will + * decide the length (maximumPageLength and pageOverlapLength) measurement. The default is 'characters', which means + * the length will be measured by character. + */ + private SplitSkillUnit unit; + + /* + * Only applies if the unit is set to azureOpenAITokens. If specified, the splitSkill will use these parameters when + * performing the tokenization. The parameters are a valid 'encoderModelName' and an optional 'allowedSpecialTokens' + * property. + */ + private AzureOpenAITokenizerParameters azureOpenAITokenizerParameters; + /** * Creates an instance of SplitSkill class. * @@ -178,6 +192,54 @@ public SplitSkill setMaximumPagesToTake(Integer maximumPagesToTake) { return this; } + /** + * Get the unit property: Only applies if textSplitMode is set to pages. There are two possible values. The choice + * of the values will decide the length (maximumPageLength and pageOverlapLength) measurement. The default is + * 'characters', which means the length will be measured by character. + * + * @return the unit value. + */ + public SplitSkillUnit getUnit() { + return this.unit; + } + + /** + * Set the unit property: Only applies if textSplitMode is set to pages. There are two possible values. The choice + * of the values will decide the length (maximumPageLength and pageOverlapLength) measurement. The default is + * 'characters', which means the length will be measured by character. + * + * @param unit the unit value to set. + * @return the SplitSkill object itself. + */ + public SplitSkill setUnit(SplitSkillUnit unit) { + this.unit = unit; + return this; + } + + /** + * Get the azureOpenAITokenizerParameters property: Only applies if the unit is set to azureOpenAITokens. If + * specified, the splitSkill will use these parameters when performing the tokenization. The parameters are a valid + * 'encoderModelName' and an optional 'allowedSpecialTokens' property. + * + * @return the azureOpenAITokenizerParameters value. + */ + public AzureOpenAITokenizerParameters getAzureOpenAITokenizerParameters() { + return this.azureOpenAITokenizerParameters; + } + + /** + * Set the azureOpenAITokenizerParameters property: Only applies if the unit is set to azureOpenAITokens. If + * specified, the splitSkill will use these parameters when performing the tokenization. The parameters are a valid + * 'encoderModelName' and an optional 'allowedSpecialTokens' property. + * + * @param azureOpenAITokenizerParameters the azureOpenAITokenizerParameters value to set. + * @return the SplitSkill object itself. + */ + public SplitSkill setAzureOpenAITokenizerParameters(AzureOpenAITokenizerParameters azureOpenAITokenizerParameters) { + this.azureOpenAITokenizerParameters = azureOpenAITokenizerParameters; + return this; + } + /** * {@inheritDoc} */ @@ -223,6 +285,8 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeNumberField("maximumPageLength", this.maximumPageLength); jsonWriter.writeNumberField("pageOverlapLength", this.pageOverlapLength); jsonWriter.writeNumberField("maximumPagesToTake", this.maximumPagesToTake); + jsonWriter.writeStringField("unit", this.unit == null ? null : this.unit.toString()); + jsonWriter.writeJsonField("azureOpenAITokenizerParameters", this.azureOpenAITokenizerParameters); return jsonWriter.writeEndObject(); } @@ -250,6 +314,8 @@ public static SplitSkill fromJson(JsonReader jsonReader) throws IOException { Integer maximumPageLength = null; Integer pageOverlapLength = null; Integer maximumPagesToTake = null; + SplitSkillUnit unit = null; + AzureOpenAITokenizerParameters azureOpenAITokenizerParameters = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); @@ -278,6 +344,10 @@ public static SplitSkill fromJson(JsonReader jsonReader) throws IOException { pageOverlapLength = reader.getNullable(JsonReader::getInt); } else if ("maximumPagesToTake".equals(fieldName)) { maximumPagesToTake = reader.getNullable(JsonReader::getInt); + } else if ("unit".equals(fieldName)) { + unit = SplitSkillUnit.fromString(reader.getString()); + } else if ("azureOpenAITokenizerParameters".equals(fieldName)) { + azureOpenAITokenizerParameters = AzureOpenAITokenizerParameters.fromJson(reader); } else { reader.skipChildren(); } @@ -293,6 +363,8 @@ public static SplitSkill fromJson(JsonReader jsonReader) throws IOException { deserializedSplitSkill.maximumPageLength = maximumPageLength; deserializedSplitSkill.pageOverlapLength = pageOverlapLength; deserializedSplitSkill.maximumPagesToTake = maximumPagesToTake; + deserializedSplitSkill.unit = unit; + deserializedSplitSkill.azureOpenAITokenizerParameters = azureOpenAITokenizerParameters; return deserializedSplitSkill; } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SplitSkillEncoderModelName.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SplitSkillEncoderModelName.java new file mode 100644 index 0000000000000..52edd1078d441 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SplitSkillEncoderModelName.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +package com.azure.search.documents.indexes.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * A value indicating which tokenizer to use. + */ +public final class SplitSkillEncoderModelName extends ExpandableStringEnum { + + /** + * Refers to a base model trained with a 50,000 token vocabulary, often used in general natural language processing + * tasks. + */ + public static final SplitSkillEncoderModelName R_50K_BASE = fromString("r50k_base"); + + /** + * A base model with a 50,000 token vocabulary, optimized for prompt-based tasks. + */ + public static final SplitSkillEncoderModelName P_50K_BASE = fromString("p50k_base"); + + /** + * Similar to p50k_base but fine-tuned for editing or rephrasing tasks with a 50,000 token vocabulary. + */ + public static final SplitSkillEncoderModelName P_50K_EDIT = fromString("p50k_edit"); + + /** + * A base model with a 100,000 token vocabulary. + */ + public static final SplitSkillEncoderModelName CL_100K_BASE = fromString("cl100k_base"); + + /** + * Creates a new instance of SplitSkillEncoderModelName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SplitSkillEncoderModelName() { + } + + /** + * Creates or finds a SplitSkillEncoderModelName from its string representation. + * + * @param name a name to look for. + * @return the corresponding SplitSkillEncoderModelName. + */ + public static SplitSkillEncoderModelName fromString(String name) { + return fromString(name, SplitSkillEncoderModelName.class); + } + + /** + * Gets known SplitSkillEncoderModelName values. + * + * @return known SplitSkillEncoderModelName values. + */ + public static Collection values() { + return values(SplitSkillEncoderModelName.class); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SplitSkillUnit.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SplitSkillUnit.java new file mode 100644 index 0000000000000..921df515b83e5 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SplitSkillUnit.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.indexes.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * A value indicating which unit to use. + */ +public final class SplitSkillUnit extends ExpandableStringEnum { + /** + * The length will be measured by character. + */ + public static final SplitSkillUnit CHARACTERS = fromString("characters"); + + /** + * The length will be measured by an AzureOpenAI tokenizer from the tiktoken library. + */ + public static final SplitSkillUnit AZURE_OPEN_AITOKENS = fromString("azureOpenAITokens"); + + /** + * Creates a new instance of SplitSkillUnit value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SplitSkillUnit() { + } + + /** + * Creates or finds a SplitSkillUnit from its string representation. + * + * @param name a name to look for. + * @return the corresponding SplitSkillUnit. + */ + public static SplitSkillUnit fromString(String name) { + return fromString(name, SplitSkillUnit.class); + } + + /** + * Gets known SplitSkillUnit values. + * + * @return known SplitSkillUnit values. + */ + public static Collection values() { + return values(SplitSkillUnit.class); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/VectorSearchCompression.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/VectorSearchCompression.java index 66c50ab304275..d7a99cbe6e7a6 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/VectorSearchCompression.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/VectorSearchCompression.java @@ -43,6 +43,15 @@ public class VectorSearchCompression implements JsonSerializable inputs, List outputs, + String modelVersion) { + super(inputs, outputs); + this.modelVersion = modelVersion; + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the modelVersion property: The version of the model to use when calling the AI Services Vision service. It + * will default to the latest available when not specified. + * + * @return the modelVersion value. + */ + public String getModelVersion() { + return this.modelVersion; + } + + /** + * {@inheritDoc} + */ + @Override + public VisionVectorizeSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VisionVectorizeSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VisionVectorizeSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("inputs", getInputs(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("outputs", getOutputs(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("description", getDescription()); + jsonWriter.writeStringField("context", getContext()); + jsonWriter.writeStringField("modelVersion", this.modelVersion); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VisionVectorizeSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VisionVectorizeSkill if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VisionVectorizeSkill. + */ + public static VisionVectorizeSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean inputsFound = false; + List inputs = null; + boolean outputsFound = false; + List outputs = null; + String name = null; + String description = null; + String context = null; + boolean modelVersionFound = false; + String modelVersion = null; + String odataType = "#Microsoft.Skills.Vision.VectorizeSkill"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + inputs = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + inputsFound = true; + } else if ("outputs".equals(fieldName)) { + outputs = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + outputsFound = true; + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("context".equals(fieldName)) { + context = reader.getString(); + } else if ("modelVersion".equals(fieldName)) { + modelVersion = reader.getString(); + modelVersionFound = true; + } else if ("@odata.type".equals(fieldName)) { + odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + if (inputsFound && outputsFound && modelVersionFound) { + VisionVectorizeSkill deserializedVisionVectorizeSkill + = new VisionVectorizeSkill(inputs, outputs, modelVersion); + deserializedVisionVectorizeSkill.setName(name); + deserializedVisionVectorizeSkill.setDescription(description); + deserializedVisionVectorizeSkill.setContext(context); + deserializedVisionVectorizeSkill.odataType = odataType; + + return deserializedVisionVectorizeSkill; + } + List missingProperties = new ArrayList<>(); + if (!inputsFound) { + missingProperties.add("inputs"); + } + if (!outputsFound) { + missingProperties.add("outputs"); + } + if (!modelVersionFound) { + missingProperties.add("modelVersion"); + } + + throw new IllegalStateException( + "Missing required property/properties: " + String.join(", ", missingProperties)); + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/DocumentDebugInfo.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/DocumentDebugInfo.java new file mode 100644 index 0000000000000..c73f1333369f4 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/DocumentDebugInfo.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Contains debugging information that can be used to further explore your search results. + */ +@Immutable +public final class DocumentDebugInfo implements JsonSerializable { + /* + * Contains debugging information specific to semantic ranking requests. + */ + private SemanticDebugInfo semantic; + + /* + * Contains debugging information specific to vector and hybrid search. + */ + private VectorsDebugInfo vectors; + + /** + * Creates an instance of DocumentDebugInfo class. + */ + public DocumentDebugInfo() { + } + + /** + * Get the semantic property: Contains debugging information specific to semantic ranking requests. + * + * @return the semantic value. + */ + public SemanticDebugInfo getSemantic() { + return this.semantic; + } + + /** + * Get the vectors property: Contains debugging information specific to vector and hybrid search. + * + * @return the vectors value. + */ + public VectorsDebugInfo getVectors() { + return this.vectors; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DocumentDebugInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DocumentDebugInfo if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DocumentDebugInfo. + */ + public static DocumentDebugInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DocumentDebugInfo deserializedDocumentDebugInfo = new DocumentDebugInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("semantic".equals(fieldName)) { + deserializedDocumentDebugInfo.semantic = SemanticDebugInfo.fromJson(reader); + } else if ("vectors".equals(fieldName)) { + deserializedDocumentDebugInfo.vectors = VectorsDebugInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDocumentDebugInfo; + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/HybridCountAndFacetMode.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/HybridCountAndFacetMode.java new file mode 100644 index 0000000000000..2b63dc7ce4178 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/HybridCountAndFacetMode.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Determines whether the count and facets should includes all documents that matched the search query, or only the + * documents that are retrieved within the 'maxTextRecallSize' window. The default value is 'countAllResults'. + */ +public final class HybridCountAndFacetMode extends ExpandableStringEnum { + /** + * Only include documents that were matched within the 'maxTextRecallSize' retrieval window when computing 'count' + * and 'facets'. + */ + public static final HybridCountAndFacetMode COUNT_RETRIEVABLE_RESULTS = fromString("countRetrievableResults"); + + /** + * Include all documents that were matched by the search query when computing 'count' and 'facets', regardless of + * whether or not those documents are within the 'maxTextRecallSize' retrieval window. + */ + public static final HybridCountAndFacetMode COUNT_ALL_RESULTS = fromString("countAllResults"); + + /** + * Creates a new instance of HybridCountAndFacetMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public HybridCountAndFacetMode() { + } + + /** + * Creates or finds a HybridCountAndFacetMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding HybridCountAndFacetMode. + */ + public static HybridCountAndFacetMode fromString(String name) { + return fromString(name, HybridCountAndFacetMode.class); + } + + /** + * Gets known HybridCountAndFacetMode values. + * + * @return known HybridCountAndFacetMode values. + */ + public static Collection values() { + return values(HybridCountAndFacetMode.class); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/HybridSearch.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/HybridSearch.java new file mode 100644 index 0000000000000..55e9d8e58faa8 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/HybridSearch.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * TThe query parameters to configure hybrid search behaviors. + */ +@Fluent +public final class HybridSearch implements JsonSerializable { + /* + * Determines the maximum number of documents to be retrieved by the text query portion of a hybrid search request. + * Those documents will be combined with the documents matching the vector queries to produce a single final list of + * results. Choosing a larger maxTextRecallSize value will allow retrieving and paging through more documents (using + * the top and skip parameters), at the cost of higher resource utilization and higher latency. The value needs to + * be between 1 and 10,000. Default is 1000. + */ + private Integer maxTextRecallSize; + + /* + * Determines whether the count and facets should includes all documents that matched the search query, or only the + * documents that are retrieved within the 'maxTextRecallSize' window. + */ + private HybridCountAndFacetMode countAndFacetMode; + + /** + * Creates an instance of HybridSearch class. + */ + public HybridSearch() { + } + + /** + * Get the maxTextRecallSize property: Determines the maximum number of documents to be retrieved by the text query + * portion of a hybrid search request. Those documents will be combined with the documents matching the vector + * queries to produce a single final list of results. Choosing a larger maxTextRecallSize value will allow + * retrieving and paging through more documents (using the top and skip parameters), at the cost of higher resource + * utilization and higher latency. The value needs to be between 1 and 10,000. Default is 1000. + * + * @return the maxTextRecallSize value. + */ + public Integer getMaxTextRecallSize() { + return this.maxTextRecallSize; + } + + /** + * Set the maxTextRecallSize property: Determines the maximum number of documents to be retrieved by the text query + * portion of a hybrid search request. Those documents will be combined with the documents matching the vector + * queries to produce a single final list of results. Choosing a larger maxTextRecallSize value will allow + * retrieving and paging through more documents (using the top and skip parameters), at the cost of higher resource + * utilization and higher latency. The value needs to be between 1 and 10,000. Default is 1000. + * + * @param maxTextRecallSize the maxTextRecallSize value to set. + * @return the HybridSearch object itself. + */ + public HybridSearch setMaxTextRecallSize(Integer maxTextRecallSize) { + this.maxTextRecallSize = maxTextRecallSize; + return this; + } + + /** + * Get the countAndFacetMode property: Determines whether the count and facets should includes all documents that + * matched the search query, or only the documents that are retrieved within the 'maxTextRecallSize' window. + * + * @return the countAndFacetMode value. + */ + public HybridCountAndFacetMode getCountAndFacetMode() { + return this.countAndFacetMode; + } + + /** + * Set the countAndFacetMode property: Determines whether the count and facets should includes all documents that + * matched the search query, or only the documents that are retrieved within the 'maxTextRecallSize' window. + * + * @param countAndFacetMode the countAndFacetMode value to set. + * @return the HybridSearch object itself. + */ + public HybridSearch setCountAndFacetMode(HybridCountAndFacetMode countAndFacetMode) { + this.countAndFacetMode = countAndFacetMode; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("maxTextRecallSize", this.maxTextRecallSize); + jsonWriter.writeStringField("countAndFacetMode", + this.countAndFacetMode == null ? null : this.countAndFacetMode.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HybridSearch from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HybridSearch if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the HybridSearch. + */ + public static HybridSearch fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HybridSearch deserializedHybridSearch = new HybridSearch(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("maxTextRecallSize".equals(fieldName)) { + deserializedHybridSearch.maxTextRecallSize = reader.getNullable(JsonReader::getInt); + } else if ("countAndFacetMode".equals(fieldName)) { + deserializedHybridSearch.countAndFacetMode = HybridCountAndFacetMode.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedHybridSearch; + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QueryDebugMode.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QueryDebugMode.java new file mode 100644 index 0000000000000..7abc9e8006859 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QueryDebugMode.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enables a debugging tool that can be used to further explore your search results. + */ +public final class QueryDebugMode extends ExpandableStringEnum { + /** + * No query debugging information will be returned. + */ + public static final QueryDebugMode DISABLED = fromString("disabled"); + + /** + * Allows the user to further explore their reranked results. + */ + public static final QueryDebugMode SEMANTIC = fromString("semantic"); + + /** + * Allows the user to further explore their hybrid and vector query results. + */ + public static final QueryDebugMode VECTOR = fromString("vector"); + + /** + * Creates a new instance of QueryDebugMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public QueryDebugMode() { + } + + /** + * Creates or finds a QueryDebugMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding QueryDebugMode. + */ + public static QueryDebugMode fromString(String name) { + return fromString(name, QueryDebugMode.class); + } + + /** + * Gets known QueryDebugMode values. + * + * @return known QueryDebugMode values. + */ + public static Collection values() { + return values(QueryDebugMode.class); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QueryLanguage.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QueryLanguage.java new file mode 100644 index 0000000000000..4fc2ee4ff54fd --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QueryLanguage.java @@ -0,0 +1,403 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The language of the query. + */ +public final class QueryLanguage extends ExpandableStringEnum { + /** + * Query language not specified. + */ + public static final QueryLanguage NONE = fromString("none"); + + /** + * Query language value for English (United States). + */ + public static final QueryLanguage EN_US = fromString("en-us"); + + /** + * Query language value for English (Great Britain). + */ + public static final QueryLanguage EN_GB = fromString("en-gb"); + + /** + * Query language value for English (India). + */ + public static final QueryLanguage EN_IN = fromString("en-in"); + + /** + * Query language value for English (Canada). + */ + public static final QueryLanguage EN_CA = fromString("en-ca"); + + /** + * Query language value for English (Australia). + */ + public static final QueryLanguage EN_AU = fromString("en-au"); + + /** + * Query language value for French (France). + */ + public static final QueryLanguage FR_FR = fromString("fr-fr"); + + /** + * Query language value for French (Canada). + */ + public static final QueryLanguage FR_CA = fromString("fr-ca"); + + /** + * Query language value for German (Germany). + */ + public static final QueryLanguage DE_DE = fromString("de-de"); + + /** + * Query language value for Spanish (Spain). + */ + public static final QueryLanguage ES_ES = fromString("es-es"); + + /** + * Query language value for Spanish (Mexico). + */ + public static final QueryLanguage ES_MX = fromString("es-mx"); + + /** + * Query language value for Chinese (China). + */ + public static final QueryLanguage ZH_CN = fromString("zh-cn"); + + /** + * Query language value for Chinese (Taiwan). + */ + public static final QueryLanguage ZH_TW = fromString("zh-tw"); + + /** + * Query language value for Portuguese (Brazil). + */ + public static final QueryLanguage PT_BR = fromString("pt-br"); + + /** + * Query language value for Portuguese (Portugal). + */ + public static final QueryLanguage PT_PT = fromString("pt-pt"); + + /** + * Query language value for Italian (Italy). + */ + public static final QueryLanguage IT_IT = fromString("it-it"); + + /** + * Query language value for Japanese (Japan). + */ + public static final QueryLanguage JA_JP = fromString("ja-jp"); + + /** + * Query language value for Korean (Korea). + */ + public static final QueryLanguage KO_KR = fromString("ko-kr"); + + /** + * Query language value for Russian (Russia). + */ + public static final QueryLanguage RU_RU = fromString("ru-ru"); + + /** + * Query language value for Czech (Czech Republic). + */ + public static final QueryLanguage CS_CZ = fromString("cs-cz"); + + /** + * Query language value for Dutch (Belgium). + */ + public static final QueryLanguage NL_BE = fromString("nl-be"); + + /** + * Query language value for Dutch (Netherlands). + */ + public static final QueryLanguage NL_NL = fromString("nl-nl"); + + /** + * Query language value for Hungarian (Hungary). + */ + public static final QueryLanguage HU_HU = fromString("hu-hu"); + + /** + * Query language value for Polish (Poland). + */ + public static final QueryLanguage PL_PL = fromString("pl-pl"); + + /** + * Query language value for Swedish (Sweden). + */ + public static final QueryLanguage SV_SE = fromString("sv-se"); + + /** + * Query language value for Turkish (Turkey). + */ + public static final QueryLanguage TR_TR = fromString("tr-tr"); + + /** + * Query language value for Hindi (India). + */ + public static final QueryLanguage HI_IN = fromString("hi-in"); + + /** + * Query language value for Arabic (Saudi Arabia). + */ + public static final QueryLanguage AR_SA = fromString("ar-sa"); + + /** + * Query language value for Arabic (Egypt). + */ + public static final QueryLanguage AR_EG = fromString("ar-eg"); + + /** + * Query language value for Arabic (Morocco). + */ + public static final QueryLanguage AR_MA = fromString("ar-ma"); + + /** + * Query language value for Arabic (Kuwait). + */ + public static final QueryLanguage AR_KW = fromString("ar-kw"); + + /** + * Query language value for Arabic (Jordan). + */ + public static final QueryLanguage AR_JO = fromString("ar-jo"); + + /** + * Query language value for Danish (Denmark). + */ + public static final QueryLanguage DA_DK = fromString("da-dk"); + + /** + * Query language value for Norwegian (Norway). + */ + public static final QueryLanguage NO_NO = fromString("no-no"); + + /** + * Query language value for Bulgarian (Bulgaria). + */ + public static final QueryLanguage BG_BG = fromString("bg-bg"); + + /** + * Query language value for Croatian (Croatia). + */ + public static final QueryLanguage HR_HR = fromString("hr-hr"); + + /** + * Query language value for Croatian (Bosnia and Herzegovina). + */ + public static final QueryLanguage HR_BA = fromString("hr-ba"); + + /** + * Query language value for Malay (Malaysia). + */ + public static final QueryLanguage MS_MY = fromString("ms-my"); + + /** + * Query language value for Malay (Brunei Darussalam). + */ + public static final QueryLanguage MS_BN = fromString("ms-bn"); + + /** + * Query language value for Slovenian (Slovenia). + */ + public static final QueryLanguage SL_SL = fromString("sl-sl"); + + /** + * Query language value for Tamil (India). + */ + public static final QueryLanguage TA_IN = fromString("ta-in"); + + /** + * Query language value for Vietnamese (Viet Nam). + */ + public static final QueryLanguage VI_VN = fromString("vi-vn"); + + /** + * Query language value for Greek (Greece). + */ + public static final QueryLanguage EL_GR = fromString("el-gr"); + + /** + * Query language value for Romanian (Romania). + */ + public static final QueryLanguage RO_RO = fromString("ro-ro"); + + /** + * Query language value for Icelandic (Iceland). + */ + public static final QueryLanguage IS_IS = fromString("is-is"); + + /** + * Query language value for Indonesian (Indonesia). + */ + public static final QueryLanguage ID_ID = fromString("id-id"); + + /** + * Query language value for Thai (Thailand). + */ + public static final QueryLanguage TH_TH = fromString("th-th"); + + /** + * Query language value for Lithuanian (Lithuania). + */ + public static final QueryLanguage LT_LT = fromString("lt-lt"); + + /** + * Query language value for Ukrainian (Ukraine). + */ + public static final QueryLanguage UK_UA = fromString("uk-ua"); + + /** + * Query language value for Latvian (Latvia). + */ + public static final QueryLanguage LV_LV = fromString("lv-lv"); + + /** + * Query language value for Estonian (Estonia). + */ + public static final QueryLanguage ET_EE = fromString("et-ee"); + + /** + * Query language value for Catalan. + */ + public static final QueryLanguage CA_ES = fromString("ca-es"); + + /** + * Query language value for Finnish (Finland). + */ + public static final QueryLanguage FI_FI = fromString("fi-fi"); + + /** + * Query language value for Serbian (Bosnia and Herzegovina). + */ + public static final QueryLanguage SR_BA = fromString("sr-ba"); + + /** + * Query language value for Serbian (Montenegro). + */ + public static final QueryLanguage SR_ME = fromString("sr-me"); + + /** + * Query language value for Serbian (Serbia). + */ + public static final QueryLanguage SR_RS = fromString("sr-rs"); + + /** + * Query language value for Slovak (Slovakia). + */ + public static final QueryLanguage SK_SK = fromString("sk-sk"); + + /** + * Query language value for Norwegian (Norway). + */ + public static final QueryLanguage NB_NO = fromString("nb-no"); + + /** + * Query language value for Armenian (Armenia). + */ + public static final QueryLanguage HY_AM = fromString("hy-am"); + + /** + * Query language value for Bengali (India). + */ + public static final QueryLanguage BN_IN = fromString("bn-in"); + + /** + * Query language value for Basque. + */ + public static final QueryLanguage EU_ES = fromString("eu-es"); + + /** + * Query language value for Galician. + */ + public static final QueryLanguage GL_ES = fromString("gl-es"); + + /** + * Query language value for Gujarati (India). + */ + public static final QueryLanguage GU_IN = fromString("gu-in"); + + /** + * Query language value for Hebrew (Israel). + */ + public static final QueryLanguage HE_IL = fromString("he-il"); + + /** + * Query language value for Irish (Ireland). + */ + public static final QueryLanguage GA_IE = fromString("ga-ie"); + + /** + * Query language value for Kannada (India). + */ + public static final QueryLanguage KN_IN = fromString("kn-in"); + + /** + * Query language value for Malayalam (India). + */ + public static final QueryLanguage ML_IN = fromString("ml-in"); + + /** + * Query language value for Marathi (India). + */ + public static final QueryLanguage MR_IN = fromString("mr-in"); + + /** + * Query language value for Persian (U.A.E.). + */ + public static final QueryLanguage FA_AE = fromString("fa-ae"); + + /** + * Query language value for Punjabi (India). + */ + public static final QueryLanguage PA_IN = fromString("pa-in"); + + /** + * Query language value for Telugu (India). + */ + public static final QueryLanguage TE_IN = fromString("te-in"); + + /** + * Query language value for Urdu (Pakistan). + */ + public static final QueryLanguage UR_PK = fromString("ur-pk"); + + /** + * Creates a new instance of QueryLanguage value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public QueryLanguage() { + } + + /** + * Creates or finds a QueryLanguage from its string representation. + * + * @param name a name to look for. + * @return the corresponding QueryLanguage. + */ + public static QueryLanguage fromString(String name) { + return fromString(name, QueryLanguage.class); + } + + /** + * Gets known QueryLanguage values. + * + * @return known QueryLanguage values. + */ + public static Collection values() { + return values(QueryLanguage.class); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QueryResultDocumentRerankerInput.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QueryResultDocumentRerankerInput.java new file mode 100644 index 0000000000000..73f316163a6fe --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QueryResultDocumentRerankerInput.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The raw concatenated strings that were sent to the semantic enrichment process. + */ +@Immutable +public final class QueryResultDocumentRerankerInput implements JsonSerializable { + /* + * The raw string for the title field that was used for semantic enrichment. + */ + private String title; + + /* + * The raw concatenated strings for the content fields that were used for semantic enrichment. + */ + private String content; + + /* + * The raw concatenated strings for the keyword fields that were used for semantic enrichment. + */ + private String keywords; + + /** + * Creates an instance of QueryResultDocumentRerankerInput class. + */ + public QueryResultDocumentRerankerInput() { + } + + /** + * Get the title property: The raw string for the title field that was used for semantic enrichment. + * + * @return the title value. + */ + public String getTitle() { + return this.title; + } + + /** + * Get the content property: The raw concatenated strings for the content fields that were used for semantic + * enrichment. + * + * @return the content value. + */ + public String getContent() { + return this.content; + } + + /** + * Get the keywords property: The raw concatenated strings for the keyword fields that were used for semantic + * enrichment. + * + * @return the keywords value. + */ + public String getKeywords() { + return this.keywords; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of QueryResultDocumentRerankerInput from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of QueryResultDocumentRerankerInput if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the QueryResultDocumentRerankerInput. + */ + public static QueryResultDocumentRerankerInput fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + QueryResultDocumentRerankerInput deserializedQueryResultDocumentRerankerInput + = new QueryResultDocumentRerankerInput(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("title".equals(fieldName)) { + deserializedQueryResultDocumentRerankerInput.title = reader.getString(); + } else if ("content".equals(fieldName)) { + deserializedQueryResultDocumentRerankerInput.content = reader.getString(); + } else if ("keywords".equals(fieldName)) { + deserializedQueryResultDocumentRerankerInput.keywords = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedQueryResultDocumentRerankerInput; + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QueryResultDocumentSemanticField.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QueryResultDocumentSemanticField.java new file mode 100644 index 0000000000000..80f166ecda289 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QueryResultDocumentSemanticField.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Description of fields that were sent to the semantic enrichment process, as well as how they were used. + */ +@Immutable +public final class QueryResultDocumentSemanticField implements JsonSerializable { + /* + * The name of the field that was sent to the semantic enrichment process + */ + private String name; + + /* + * The way the field was used for the semantic enrichment process (fully used, partially used, or unused) + */ + private SemanticFieldState state; + + /** + * Creates an instance of QueryResultDocumentSemanticField class. + */ + public QueryResultDocumentSemanticField() { + } + + /** + * Get the name property: The name of the field that was sent to the semantic enrichment process. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * Get the state property: The way the field was used for the semantic enrichment process (fully used, partially + * used, or unused). + * + * @return the state value. + */ + public SemanticFieldState getState() { + return this.state; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of QueryResultDocumentSemanticField from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of QueryResultDocumentSemanticField if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the QueryResultDocumentSemanticField. + */ + public static QueryResultDocumentSemanticField fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + QueryResultDocumentSemanticField deserializedQueryResultDocumentSemanticField + = new QueryResultDocumentSemanticField(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedQueryResultDocumentSemanticField.name = reader.getString(); + } else if ("state".equals(fieldName)) { + deserializedQueryResultDocumentSemanticField.state + = SemanticFieldState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedQueryResultDocumentSemanticField; + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QueryResultDocumentSubscores.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QueryResultDocumentSubscores.java new file mode 100644 index 0000000000000..f692683a0ad1b --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QueryResultDocumentSubscores.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The breakdown of subscores between the text and vector query components of the search query for this document. Each + * vector query is shown as a separate object in the same order they were received. + */ +@Immutable +public final class QueryResultDocumentSubscores implements JsonSerializable { + /* + * The BM25 or Classic score for the text portion of the query. + */ + private TextResult text; + + /* + * The vector similarity and @search.score values for each vector query. + */ + private List> vectors; + + /* + * The BM25 or Classic score for the text portion of the query. + */ + private Double documentBoost; + + /** + * Creates an instance of QueryResultDocumentSubscores class. + */ + public QueryResultDocumentSubscores() { + } + + /** + * Get the text property: The BM25 or Classic score for the text portion of the query. + * + * @return the text value. + */ + public TextResult getText() { + return this.text; + } + + /** + * Get the vectors property: The vector similarity and @search.score values for each vector query. + * + * @return the vectors value. + */ + public List> getVectors() { + return this.vectors; + } + + /** + * Get the documentBoost property: The BM25 or Classic score for the text portion of the query. + * + * @return the documentBoost value. + */ + public Double getDocumentBoost() { + return this.documentBoost; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of QueryResultDocumentSubscores from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of QueryResultDocumentSubscores if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the QueryResultDocumentSubscores. + */ + public static QueryResultDocumentSubscores fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + QueryResultDocumentSubscores deserializedQueryResultDocumentSubscores = new QueryResultDocumentSubscores(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("text".equals(fieldName)) { + deserializedQueryResultDocumentSubscores.text = TextResult.fromJson(reader); + } else if ("vectors".equals(fieldName)) { + List> vectors = reader + .readArray(reader1 -> reader1.readMap(reader2 -> SingleVectorFieldResult.fromJson(reader2))); + deserializedQueryResultDocumentSubscores.vectors = vectors; + } else if ("documentBoost".equals(fieldName)) { + deserializedQueryResultDocumentSubscores.documentBoost = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedQueryResultDocumentSubscores; + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QuerySpellerType.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QuerySpellerType.java new file mode 100644 index 0000000000000..391b9f6a435e1 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QuerySpellerType.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Improve search recall by spell-correcting individual search query terms. + */ +public final class QuerySpellerType extends ExpandableStringEnum { + /** + * Speller not enabled. + */ + public static final QuerySpellerType NONE = fromString("none"); + + /** + * Speller corrects individual query terms using a static lexicon for the language specified by the queryLanguage + * parameter. + */ + public static final QuerySpellerType LEXICON = fromString("lexicon"); + + /** + * Creates a new instance of QuerySpellerType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public QuerySpellerType() { + } + + /** + * Creates or finds a QuerySpellerType from its string representation. + * + * @param name a name to look for. + * @return the corresponding QuerySpellerType. + */ + public static QuerySpellerType fromString(String name) { + return fromString(name, QuerySpellerType.class); + } + + /** + * Gets known QuerySpellerType values. + * + * @return known QuerySpellerType values. + */ + public static Collection values() { + return values(QuerySpellerType.class); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QueryType.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QueryType.java index cbc58a3a650b2..16bc144e9de7f 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QueryType.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/QueryType.java @@ -8,7 +8,7 @@ /** * Specifies the syntax of the search query. The default is 'simple'. Use 'full' if your query uses the Lucene query - * syntax. + * syntax and 'semantic' if query syntax is not needed. */ public enum QueryType { /** diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SearchScoreThreshold.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SearchScoreThreshold.java new file mode 100644 index 0000000000000..c03a29c86df03 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SearchScoreThreshold.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +package com.azure.search.documents.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The results of the vector query will filter based on the '@search.score' value. Note this is the + * @search.score returned as part of the search response. The threshold direction will be chosen for higher + * @search.score. + */ +@Immutable +public final class SearchScoreThreshold extends VectorThreshold { + + /* + * The kind of threshold used to filter vector queries + */ + private VectorThresholdKind kind = VectorThresholdKind.SEARCH_SCORE; + + /* + * The threshold will filter based on the '@search.score' value. Note this is the @search.score returned as part of + * the search response. The threshold direction will be chosen for higher @search.score. + */ + private final double value; + + /** + * Creates an instance of SearchScoreThreshold class. + * + * @param value the value value to set. + */ + public SearchScoreThreshold(double value) { + this.value = value; + } + + /** + * Get the kind property: The kind of threshold used to filter vector queries. + * + * @return the kind value. + */ + @Override + public VectorThresholdKind getKind() { + return this.kind; + } + + /** + * /** + * Get the value property: The threshold will filter based on the '@search.score' value. Note this is the + * + * `@search.score` returned as part of the search response. The threshold direction will be chosen for higher + * `@search.score`. + * + * @return the value. + * / + */ + public double getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeDoubleField("value", this.value); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchScoreThreshold from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchScoreThreshold if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SearchScoreThreshold. + */ + public static SearchScoreThreshold fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean valueFound = false; + double value = 0.0; + VectorThresholdKind kind = VectorThresholdKind.SEARCH_SCORE; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("value".equals(fieldName)) { + value = reader.getDouble(); + valueFound = true; + } else if ("kind".equals(fieldName)) { + kind = VectorThresholdKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + if (valueFound) { + SearchScoreThreshold deserializedSearchScoreThreshold = new SearchScoreThreshold(value); + deserializedSearchScoreThreshold.kind = kind; + return deserializedSearchScoreThreshold; + } + throw new IllegalStateException("Missing required property: value"); + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SemanticDebugInfo.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SemanticDebugInfo.java new file mode 100644 index 0000000000000..a3e1006bc3269 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SemanticDebugInfo.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The SemanticDebugInfo model. + */ +@Immutable +public final class SemanticDebugInfo implements JsonSerializable { + /* + * The title field that was sent to the semantic enrichment process, as well as how it was used + */ + private QueryResultDocumentSemanticField titleField; + + /* + * The content fields that were sent to the semantic enrichment process, as well as how they were used + */ + private List contentFields; + + /* + * The keyword fields that were sent to the semantic enrichment process, as well as how they were used + */ + private List keywordFields; + + /* + * The raw concatenated strings that were sent to the semantic enrichment process. + */ + private QueryResultDocumentRerankerInput rerankerInput; + + /** + * Creates an instance of SemanticDebugInfo class. + */ + public SemanticDebugInfo() { + } + + /** + * Get the titleField property: The title field that was sent to the semantic enrichment process, as well as how it + * was used. + * + * @return the titleField value. + */ + public QueryResultDocumentSemanticField getTitleField() { + return this.titleField; + } + + /** + * Get the contentFields property: The content fields that were sent to the semantic enrichment process, as well as + * how they were used. + * + * @return the contentFields value. + */ + public List getContentFields() { + return this.contentFields; + } + + /** + * Get the keywordFields property: The keyword fields that were sent to the semantic enrichment process, as well as + * how they were used. + * + * @return the keywordFields value. + */ + public List getKeywordFields() { + return this.keywordFields; + } + + /** + * Get the rerankerInput property: The raw concatenated strings that were sent to the semantic enrichment process. + * + * @return the rerankerInput value. + */ + public QueryResultDocumentRerankerInput getRerankerInput() { + return this.rerankerInput; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SemanticDebugInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SemanticDebugInfo if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the SemanticDebugInfo. + */ + public static SemanticDebugInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SemanticDebugInfo deserializedSemanticDebugInfo = new SemanticDebugInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("titleField".equals(fieldName)) { + deserializedSemanticDebugInfo.titleField = QueryResultDocumentSemanticField.fromJson(reader); + } else if ("contentFields".equals(fieldName)) { + List contentFields + = reader.readArray(reader1 -> QueryResultDocumentSemanticField.fromJson(reader1)); + deserializedSemanticDebugInfo.contentFields = contentFields; + } else if ("keywordFields".equals(fieldName)) { + List keywordFields + = reader.readArray(reader1 -> QueryResultDocumentSemanticField.fromJson(reader1)); + deserializedSemanticDebugInfo.keywordFields = keywordFields; + } else if ("rerankerInput".equals(fieldName)) { + deserializedSemanticDebugInfo.rerankerInput = QueryResultDocumentRerankerInput.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSemanticDebugInfo; + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SemanticFieldState.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SemanticFieldState.java new file mode 100644 index 0000000000000..f382b4b908b10 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SemanticFieldState.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The way the field was used for the semantic enrichment process. + */ +public final class SemanticFieldState extends ExpandableStringEnum { + /** + * The field was fully used for semantic enrichment. + */ + public static final SemanticFieldState USED = fromString("used"); + + /** + * The field was not used for semantic enrichment. + */ + public static final SemanticFieldState UNUSED = fromString("unused"); + + /** + * The field was partially used for semantic enrichment. + */ + public static final SemanticFieldState PARTIAL = fromString("partial"); + + /** + * Creates a new instance of SemanticFieldState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SemanticFieldState() { + } + + /** + * Creates or finds a SemanticFieldState from its string representation. + * + * @param name a name to look for. + * @return the corresponding SemanticFieldState. + */ + public static SemanticFieldState fromString(String name) { + return fromString(name, SemanticFieldState.class); + } + + /** + * Gets known SemanticFieldState values. + * + * @return known SemanticFieldState values. + */ + public static Collection values() { + return values(SemanticFieldState.class); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SingleVectorFieldResult.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SingleVectorFieldResult.java new file mode 100644 index 0000000000000..c1838844dbbe6 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SingleVectorFieldResult.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A single vector field result. Both @search.score and vector similarity values are returned. Vector similarity is + * related to @search.score by an equation. + */ +@Immutable +public final class SingleVectorFieldResult implements JsonSerializable { + /* + * The @search.score value that is calculated from the vector similarity score. This is the score that's visible in + * a pure single-field single-vector query. + */ + private Double searchScore; + + /* + * The vector similarity score for this document. Note this is the canonical definition of similarity metric, not + * the 'distance' version. For example, cosine similarity instead of cosine distance. + */ + private Double vectorSimilarity; + + /** + * Creates an instance of SingleVectorFieldResult class. + */ + public SingleVectorFieldResult() { + } + + /** + * Get the searchScore property: The @search.score value that is calculated from the vector similarity score. + * This is the score that's visible in a pure single-field single-vector query. + * + * @return the searchScore value. + */ + public Double getSearchScore() { + return this.searchScore; + } + + /** + * Get the vectorSimilarity property: The vector similarity score for this document. Note this is the canonical + * definition of similarity metric, not the 'distance' version. For example, cosine similarity instead of cosine + * distance. + * + * @return the vectorSimilarity value. + */ + public Double getVectorSimilarity() { + return this.vectorSimilarity; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SingleVectorFieldResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SingleVectorFieldResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SingleVectorFieldResult. + */ + public static SingleVectorFieldResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SingleVectorFieldResult deserializedSingleVectorFieldResult = new SingleVectorFieldResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("searchScore".equals(fieldName)) { + deserializedSingleVectorFieldResult.searchScore = reader.getNullable(JsonReader::getDouble); + } else if ("vectorSimilarity".equals(fieldName)) { + deserializedSingleVectorFieldResult.vectorSimilarity = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedSingleVectorFieldResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/TextResult.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/TextResult.java new file mode 100644 index 0000000000000..53811f11c5b88 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/TextResult.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The BM25 or Classic score for the text portion of the query. + */ +@Immutable +public final class TextResult implements JsonSerializable { + /* + * The BM25 or Classic score for the text portion of the query. + */ + private Double searchScore; + + /** + * Creates an instance of TextResult class. + */ + public TextResult() { + } + + /** + * Get the searchScore property: The BM25 or Classic score for the text portion of the query. + * + * @return the searchScore value. + */ + public Double getSearchScore() { + return this.searchScore; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TextResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TextResult if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the TextResult. + */ + public static TextResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TextResult deserializedTextResult = new TextResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("searchScore".equals(fieldName)) { + deserializedTextResult.searchScore = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedTextResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorQuery.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorQuery.java index a0386c2fa1f6b..27b5eca80415f 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorQuery.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorQuery.java @@ -55,6 +55,17 @@ public class VectorQuery implements JsonSerializable { */ private Float weight; + /* + * The threshold used for vector queries. Note this can only be set if all 'fields' use the same similarity metric. + */ + private VectorThreshold threshold; + + /* + * The OData filter expression to apply to this specific vector query. If no filter expression is defined at the + * vector level, the expression defined in the top level filter parameter is used instead. + */ + private String filterOverride; + /** * Creates an instance of VectorQuery class. */ @@ -186,6 +197,52 @@ public VectorQuery setWeight(Float weight) { return this; } + /** + * Get the threshold property: The threshold used for vector queries. Note this can only be set if all 'fields' use + * the same similarity metric. + * + * @return the threshold value. + */ + public VectorThreshold getThreshold() { + return this.threshold; + } + + /** + * Set the threshold property: The threshold used for vector queries. Note this can only be set if all 'fields' use + * the same similarity metric. + * + * @param threshold the threshold value to set. + * @return the VectorQuery object itself. + */ + public VectorQuery setThreshold(VectorThreshold threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get the filterOverride property: The OData filter expression to apply to this specific vector query. If no filter + * expression is defined at the vector level, the expression defined in the top level filter parameter is used + * instead. + * + * @return the filterOverride value. + */ + public String getFilterOverride() { + return this.filterOverride; + } + + /** + * Set the filterOverride property: The OData filter expression to apply to this specific vector query. If no filter + * expression is defined at the vector level, the expression defined in the top level filter parameter is used + * instead. + * + * @param filterOverride the filterOverride value to set. + * @return the VectorQuery object itself. + */ + public VectorQuery setFilterOverride(String filterOverride) { + this.filterOverride = filterOverride; + return this; + } + /** * {@inheritDoc} */ @@ -198,6 +255,8 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeBooleanField("exhaustive", this.exhaustive); jsonWriter.writeNumberField("oversampling", this.oversampling); jsonWriter.writeNumberField("weight", this.weight); + jsonWriter.writeJsonField("threshold", this.threshold); + jsonWriter.writeStringField("filterOverride", this.filterOverride); return jsonWriter.writeEndObject(); } @@ -228,6 +287,10 @@ public static VectorQuery fromJson(JsonReader jsonReader) throws IOException { // Use the discriminator value to determine which subtype should be deserialized. if ("text".equals(discriminatorValue)) { return VectorizableTextQuery.fromJson(readerToUse.reset()); + } else if ("imageUrl".equals(discriminatorValue)) { + return VectorizableImageUrlQuery.fromJson(readerToUse.reset()); + } else if ("imageBinary".equals(discriminatorValue)) { + return VectorizableImageBinaryQuery.fromJson(readerToUse.reset()); } else if ("vector".equals(discriminatorValue)) { return VectorizedQuery.fromJson(readerToUse.reset()); } else { @@ -255,6 +318,10 @@ static VectorQuery fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOEx deserializedVectorQuery.oversampling = reader.getNullable(JsonReader::getDouble); } else if ("weight".equals(fieldName)) { deserializedVectorQuery.weight = reader.getNullable(JsonReader::getFloat); + } else if ("threshold".equals(fieldName)) { + deserializedVectorQuery.threshold = VectorThreshold.fromJson(reader); + } else if ("filterOverride".equals(fieldName)) { + deserializedVectorQuery.filterOverride = reader.getString(); } else { reader.skipChildren(); } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorQueryKind.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorQueryKind.java index 7b5bf1ccf491d..58e53b65716bf 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorQueryKind.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorQueryKind.java @@ -23,6 +23,16 @@ public final class VectorQueryKind extends ExpandableStringEnum */ public static final VectorQueryKind TEXT = fromString("text"); + /** + * Vector query where an url that represents an image value that needs to be vectorized is provided. + */ + public static final VectorQueryKind IMAGE_URL = fromString("imageUrl"); + + /** + * Vector query where a base 64 encoded binary of an image that needs to be vectorized is provided. + */ + public static final VectorQueryKind IMAGE_BINARY = fromString("imageBinary"); + /** * Creates a new instance of VectorQueryKind value. * diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorSimilarityThreshold.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorSimilarityThreshold.java new file mode 100644 index 0000000000000..7297aacd88d39 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorSimilarityThreshold.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The results of the vector query will be filtered based on the vector similarity metric. Note this is the canonical + * definition of similarity metric, not the 'distance' version. The threshold direction (larger or smaller) will be + * chosen automatically according to the metric used by the field. + */ +@Immutable +public final class VectorSimilarityThreshold extends VectorThreshold { + /* + * The kind of threshold used to filter vector queries + */ + private VectorThresholdKind kind = VectorThresholdKind.VECTOR_SIMILARITY; + + /* + * The threshold will filter based on the similarity metric value. Note this is the canonical definition of + * similarity metric, not the 'distance' version. The threshold direction (larger or smaller) will be chosen + * automatically according to the metric used by the field. + */ + private final double value; + + /** + * Creates an instance of VectorSimilarityThreshold class. + * + * @param value the value value to set. + */ + public VectorSimilarityThreshold(double value) { + this.value = value; + } + + /** + * Get the kind property: The kind of threshold used to filter vector queries. + * + * @return the kind value. + */ + @Override + public VectorThresholdKind getKind() { + return this.kind; + } + + /** + * Get the value property: The threshold will filter based on the similarity metric value. Note this is the + * canonical definition of similarity metric, not the 'distance' version. The threshold direction (larger or + * smaller) will be chosen automatically according to the metric used by the field. + * + * @return the value value. + */ + public double getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeDoubleField("value", this.value); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorSimilarityThreshold from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorSimilarityThreshold if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VectorSimilarityThreshold. + */ + public static VectorSimilarityThreshold fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean valueFound = false; + double value = 0.0; + VectorThresholdKind kind = VectorThresholdKind.VECTOR_SIMILARITY; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.getDouble(); + valueFound = true; + } else if ("kind".equals(fieldName)) { + kind = VectorThresholdKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + if (valueFound) { + VectorSimilarityThreshold deserializedVectorSimilarityThreshold = new VectorSimilarityThreshold(value); + deserializedVectorSimilarityThreshold.kind = kind; + + return deserializedVectorSimilarityThreshold; + } + throw new IllegalStateException("Missing required property: value"); + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorThreshold.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorThreshold.java new file mode 100644 index 0000000000000..6256f5f7b9a63 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorThreshold.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The threshold used for vector queries. + */ +@Immutable +public class VectorThreshold implements JsonSerializable { + /* + * The kind of threshold used to filter vector queries + */ + private VectorThresholdKind kind = VectorThresholdKind.fromString("VectorThreshold"); + + /** + * Creates an instance of VectorThreshold class. + */ + public VectorThreshold() { + } + + /** + * Get the kind property: The kind of threshold used to filter vector queries. + * + * @return the kind value. + */ + public VectorThresholdKind getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorThreshold from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorThreshold if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the VectorThreshold. + */ + public static VectorThreshold fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("vectorSimilarity".equals(discriminatorValue)) { + return VectorSimilarityThreshold.fromJson(readerToUse.reset()); + } else if ("searchScore".equals(discriminatorValue)) { + return SearchScoreThreshold.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static VectorThreshold fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorThreshold deserializedVectorThreshold = new VectorThreshold(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedVectorThreshold.kind = VectorThresholdKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVectorThreshold; + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorThresholdKind.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorThresholdKind.java new file mode 100644 index 0000000000000..c1447a4612b68 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorThresholdKind.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The kind of vector query being performed. + */ +public final class VectorThresholdKind extends ExpandableStringEnum { + /** + * The results of the vector query will be filtered based on the vector similarity metric. Note this is the + * canonical definition of similarity metric, not the 'distance' version. The threshold direction (larger or + * smaller) will be chosen automatically according to the metric used by the field. + */ + public static final VectorThresholdKind VECTOR_SIMILARITY = fromString("vectorSimilarity"); + + /** + * The results of the vector query will filter based on the '@search.score' value. Note this is the + * @search.score returned as part of the search response. The threshold direction will be chosen for higher + * @search.score. + */ + public static final VectorThresholdKind SEARCH_SCORE = fromString("searchScore"); + + /** + * Creates a new instance of VectorThresholdKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public VectorThresholdKind() { + } + + /** + * Creates or finds a VectorThresholdKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorThresholdKind. + */ + public static VectorThresholdKind fromString(String name) { + return fromString(name, VectorThresholdKind.class); + } + + /** + * Gets known VectorThresholdKind values. + * + * @return known VectorThresholdKind values. + */ + public static Collection values() { + return values(VectorThresholdKind.class); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorizableImageBinaryQuery.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorizableImageBinaryQuery.java new file mode 100644 index 0000000000000..bb9c1f2374f73 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorizableImageBinaryQuery.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +package com.azure.search.documents.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The query parameters to use for vector search when a base 64 encoded binary of an image that needs to be vectorized + * is provided. + */ +@Fluent +public final class VectorizableImageBinaryQuery extends VectorQuery { + + /* + * The kind of vector query being performed. + */ + private VectorQueryKind kind = VectorQueryKind.IMAGE_BINARY; + + /* + * The base 64 encoded binary of an image to be vectorized to perform a vector search query. + */ + private String base64Image; + + /** + * Creates an instance of VectorizableImageBinaryQuery class. + */ + public VectorizableImageBinaryQuery() { + } + + /** + * Get the kind property: The kind of vector query being performed. + * + * @return the kind value. + */ + @Override + public VectorQueryKind getKind() { + return this.kind; + } + + /** + * Get the base64Image property: The base 64 encoded binary of an image to be vectorized to perform a vector search + * query. + * + * @return the base64Image value. + */ + public String getBase64Image() { + return this.base64Image; + } + + /** + * Set the base64Image property: The base 64 encoded binary of an image to be vectorized to perform a vector search + * query. + * + * @param base64Image the base64Image value to set. + * @return the VectorizableImageBinaryQuery object itself. + */ + public VectorizableImageBinaryQuery setBase64Image(String base64Image) { + this.base64Image = base64Image; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VectorizableImageBinaryQuery setKNearestNeighborsCount(Integer kNearestNeighborsCount) { + super.setKNearestNeighborsCount(kNearestNeighborsCount); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VectorizableImageBinaryQuery setFields(String... fields) { + super.setFields(fields); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VectorizableImageBinaryQuery setExhaustive(Boolean exhaustive) { + super.setExhaustive(exhaustive); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VectorizableImageBinaryQuery setOversampling(Double oversampling) { + super.setOversampling(oversampling); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VectorizableImageBinaryQuery setWeight(Float weight) { + super.setWeight(weight); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VectorizableImageBinaryQuery setThreshold(VectorThreshold threshold) { + super.setThreshold(threshold); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VectorizableImageBinaryQuery setFilterOverride(String filterOverride) { + super.setFilterOverride(filterOverride); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("k", getKNearestNeighborsCount()); + jsonWriter.writeStringField("fields", getFields()); + jsonWriter.writeBooleanField("exhaustive", isExhaustive()); + jsonWriter.writeNumberField("oversampling", getOversampling()); + jsonWriter.writeNumberField("weight", getWeight()); + jsonWriter.writeJsonField("threshold", getThreshold()); + jsonWriter.writeStringField("filterOverride", getFilterOverride()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("base64Image", this.base64Image); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorizableImageBinaryQuery from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorizableImageBinaryQuery if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the VectorizableImageBinaryQuery. + */ + public static VectorizableImageBinaryQuery fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorizableImageBinaryQuery deserializedVectorizableImageBinaryQuery = new VectorizableImageBinaryQuery(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("k".equals(fieldName)) { + deserializedVectorizableImageBinaryQuery + .setKNearestNeighborsCount(reader.getNullable(JsonReader::getInt)); + } else if ("fields".equals(fieldName)) { + deserializedVectorizableImageBinaryQuery.setFields(reader.getString()); + } else if ("exhaustive".equals(fieldName)) { + deserializedVectorizableImageBinaryQuery.setExhaustive(reader.getNullable(JsonReader::getBoolean)); + } else if ("oversampling".equals(fieldName)) { + deserializedVectorizableImageBinaryQuery.setOversampling(reader.getNullable(JsonReader::getDouble)); + } else if ("weight".equals(fieldName)) { + deserializedVectorizableImageBinaryQuery.setWeight(reader.getNullable(JsonReader::getFloat)); + } else if ("threshold".equals(fieldName)) { + deserializedVectorizableImageBinaryQuery.setThreshold(VectorThreshold.fromJson(reader)); + } else if ("filterOverride".equals(fieldName)) { + deserializedVectorizableImageBinaryQuery.setFilterOverride(reader.getString()); + } else if ("kind".equals(fieldName)) { + deserializedVectorizableImageBinaryQuery.kind = VectorQueryKind.fromString(reader.getString()); + } else if ("base64Image".equals(fieldName)) { + deserializedVectorizableImageBinaryQuery.base64Image = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedVectorizableImageBinaryQuery; + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorizableImageUrlQuery.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorizableImageUrlQuery.java new file mode 100644 index 0000000000000..f1a5a23499ca4 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorizableImageUrlQuery.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +package com.azure.search.documents.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The query parameters to use for vector search when an url that represents an image value that needs to be vectorized + * is provided. + */ +@Fluent +public final class VectorizableImageUrlQuery extends VectorQuery { + + /* + * The kind of vector query being performed. + */ + private VectorQueryKind kind = VectorQueryKind.IMAGE_URL; + + /* + * The URL of an image to be vectorized to perform a vector search query. + */ + private String url; + + /** + * Creates an instance of VectorizableImageUrlQuery class. + */ + public VectorizableImageUrlQuery() { + } + + /** + * Get the kind property: The kind of vector query being performed. + * + * @return the kind value. + */ + @Override + public VectorQueryKind getKind() { + return this.kind; + } + + /** + * Get the url property: The URL of an image to be vectorized to perform a vector search query. + * + * @return the url value. + */ + public String getUrl() { + return this.url; + } + + /** + * Set the url property: The URL of an image to be vectorized to perform a vector search query. + * + * @param url the url value to set. + * @return the VectorizableImageUrlQuery object itself. + */ + public VectorizableImageUrlQuery setUrl(String url) { + this.url = url; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VectorizableImageUrlQuery setKNearestNeighborsCount(Integer kNearestNeighborsCount) { + super.setKNearestNeighborsCount(kNearestNeighborsCount); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VectorizableImageUrlQuery setFields(String... fields) { + super.setFields(fields); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VectorizableImageUrlQuery setExhaustive(Boolean exhaustive) { + super.setExhaustive(exhaustive); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VectorizableImageUrlQuery setOversampling(Double oversampling) { + super.setOversampling(oversampling); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VectorizableImageUrlQuery setWeight(Float weight) { + super.setWeight(weight); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VectorizableImageUrlQuery setThreshold(VectorThreshold threshold) { + super.setThreshold(threshold); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VectorizableImageUrlQuery setFilterOverride(String filterOverride) { + super.setFilterOverride(filterOverride); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("k", getKNearestNeighborsCount()); + jsonWriter.writeStringField("fields", getFields()); + jsonWriter.writeBooleanField("exhaustive", isExhaustive()); + jsonWriter.writeNumberField("oversampling", getOversampling()); + jsonWriter.writeNumberField("weight", getWeight()); + jsonWriter.writeJsonField("threshold", getThreshold()); + jsonWriter.writeStringField("filterOverride", getFilterOverride()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("url", this.url); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorizableImageUrlQuery from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorizableImageUrlQuery if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the VectorizableImageUrlQuery. + */ + public static VectorizableImageUrlQuery fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorizableImageUrlQuery deserializedVectorizableImageUrlQuery = new VectorizableImageUrlQuery(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("k".equals(fieldName)) { + deserializedVectorizableImageUrlQuery + .setKNearestNeighborsCount(reader.getNullable(JsonReader::getInt)); + } else if ("fields".equals(fieldName)) { + deserializedVectorizableImageUrlQuery.setFields(reader.getString()); + } else if ("exhaustive".equals(fieldName)) { + deserializedVectorizableImageUrlQuery.setExhaustive(reader.getNullable(JsonReader::getBoolean)); + } else if ("oversampling".equals(fieldName)) { + deserializedVectorizableImageUrlQuery.setOversampling(reader.getNullable(JsonReader::getDouble)); + } else if ("weight".equals(fieldName)) { + deserializedVectorizableImageUrlQuery.setWeight(reader.getNullable(JsonReader::getFloat)); + } else if ("threshold".equals(fieldName)) { + deserializedVectorizableImageUrlQuery.setThreshold(VectorThreshold.fromJson(reader)); + } else if ("filterOverride".equals(fieldName)) { + deserializedVectorizableImageUrlQuery.setFilterOverride(reader.getString()); + } else if ("kind".equals(fieldName)) { + deserializedVectorizableImageUrlQuery.kind = VectorQueryKind.fromString(reader.getString()); + } else if ("url".equals(fieldName)) { + deserializedVectorizableImageUrlQuery.url = reader.getString(); + } else { + reader.skipChildren(); + } + } + return deserializedVectorizableImageUrlQuery; + }); + } +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorizableTextQuery.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorizableTextQuery.java index 057629957b744..f2fd250931fca 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorizableTextQuery.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorizableTextQuery.java @@ -100,6 +100,24 @@ public VectorizableTextQuery setWeight(Float weight) { return this; } + /** + * {@inheritDoc} + */ + @Override + public VectorizableTextQuery setThreshold(VectorThreshold threshold) { + super.setThreshold(threshold); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VectorizableTextQuery setFilterOverride(String filterOverride) { + super.setFilterOverride(filterOverride); + return this; + } + /** * {@inheritDoc} */ @@ -111,6 +129,8 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeBooleanField("exhaustive", isExhaustive()); jsonWriter.writeNumberField("oversampling", getOversampling()); jsonWriter.writeNumberField("weight", getWeight()); + jsonWriter.writeJsonField("threshold", getThreshold()); + jsonWriter.writeStringField("filterOverride", getFilterOverride()); jsonWriter.writeStringField("text", this.text); jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); return jsonWriter.writeEndObject(); @@ -132,6 +152,8 @@ public static VectorizableTextQuery fromJson(JsonReader jsonReader) throws IOExc Boolean exhaustive = null; Double oversampling = null; Float weight = null; + VectorThreshold threshold = null; + String filterOverride = null; boolean textFound = false; String text = null; VectorQueryKind kind = VectorQueryKind.TEXT; @@ -148,6 +170,10 @@ public static VectorizableTextQuery fromJson(JsonReader jsonReader) throws IOExc oversampling = reader.getNullable(JsonReader::getDouble); } else if ("weight".equals(fieldName)) { weight = reader.getNullable(JsonReader::getFloat); + } else if ("threshold".equals(fieldName)) { + threshold = VectorThreshold.fromJson(reader); + } else if ("filterOverride".equals(fieldName)) { + filterOverride = reader.getString(); } else if ("text".equals(fieldName)) { text = reader.getString(); textFound = true; @@ -164,6 +190,8 @@ public static VectorizableTextQuery fromJson(JsonReader jsonReader) throws IOExc deserializedVectorizableTextQuery.setExhaustive(exhaustive); deserializedVectorizableTextQuery.setOversampling(oversampling); deserializedVectorizableTextQuery.setWeight(weight); + deserializedVectorizableTextQuery.setThreshold(threshold); + deserializedVectorizableTextQuery.setFilterOverride(filterOverride); deserializedVectorizableTextQuery.kind = kind; return deserializedVectorizableTextQuery; } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorizedQuery.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorizedQuery.java index 276457db16641..3135f3aca9586 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorizedQuery.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorizedQuery.java @@ -101,6 +101,24 @@ public VectorizedQuery setWeight(Float weight) { return this; } + /** + * {@inheritDoc} + */ + @Override + public VectorizedQuery setThreshold(VectorThreshold threshold) { + super.setThreshold(threshold); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VectorizedQuery setFilterOverride(String filterOverride) { + super.setFilterOverride(filterOverride); + return this; + } + /** * {@inheritDoc} */ @@ -112,6 +130,8 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeBooleanField("exhaustive", isExhaustive()); jsonWriter.writeNumberField("oversampling", getOversampling()); jsonWriter.writeNumberField("weight", getWeight()); + jsonWriter.writeJsonField("threshold", getThreshold()); + jsonWriter.writeStringField("filterOverride", getFilterOverride()); jsonWriter.writeArrayField("vector", this.vector, (writer, element) -> writer.writeFloat(element)); jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); return jsonWriter.writeEndObject(); @@ -133,6 +153,8 @@ public static VectorizedQuery fromJson(JsonReader jsonReader) throws IOException Boolean exhaustive = null; Double oversampling = null; Float weight = null; + VectorThreshold threshold = null; + String filterOverride = null; boolean vectorFound = false; List vector = null; VectorQueryKind kind = VectorQueryKind.VECTOR; @@ -149,6 +171,10 @@ public static VectorizedQuery fromJson(JsonReader jsonReader) throws IOException oversampling = reader.getNullable(JsonReader::getDouble); } else if ("weight".equals(fieldName)) { weight = reader.getNullable(JsonReader::getFloat); + } else if ("threshold".equals(fieldName)) { + threshold = VectorThreshold.fromJson(reader); + } else if ("filterOverride".equals(fieldName)) { + filterOverride = reader.getString(); } else if ("vector".equals(fieldName)) { vector = reader.readArray(reader1 -> reader1.getFloat()); vectorFound = true; @@ -165,6 +191,8 @@ public static VectorizedQuery fromJson(JsonReader jsonReader) throws IOException deserializedVectorizedQuery.setExhaustive(exhaustive); deserializedVectorizedQuery.setOversampling(oversampling); deserializedVectorizedQuery.setWeight(weight); + deserializedVectorizedQuery.setThreshold(threshold); + deserializedVectorizedQuery.setFilterOverride(filterOverride); deserializedVectorizedQuery.kind = kind; return deserializedVectorizedQuery; } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorsDebugInfo.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorsDebugInfo.java new file mode 100644 index 0000000000000..874442a5b4a79 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/VectorsDebugInfo.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package com.azure.search.documents.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The VectorsDebugInfo model. + */ +@Immutable +public final class VectorsDebugInfo implements JsonSerializable { + /* + * The breakdown of subscores of the document prior to the chosen result set fusion/combination method such as RRF. + */ + private QueryResultDocumentSubscores subscores; + + /** + * Creates an instance of VectorsDebugInfo class. + */ + public VectorsDebugInfo() { + } + + /** + * Get the subscores property: The breakdown of subscores of the document prior to the chosen result set + * fusion/combination method such as RRF. + * + * @return the subscores value. + */ + public QueryResultDocumentSubscores getSubscores() { + return this.subscores; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorsDebugInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorsDebugInfo if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the VectorsDebugInfo. + */ + public static VectorsDebugInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorsDebugInfo deserializedVectorsDebugInfo = new VectorsDebugInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("subscores".equals(fieldName)) { + deserializedVectorsDebugInfo.subscores = QueryResultDocumentSubscores.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVectorsDebugInfo; + }); + } +} diff --git a/sdk/search/azure-search-documents/src/samples/README.md b/sdk/search/azure-search-documents/src/samples/README.md index 4791ddf49d40a..20c89f89d25a9 100644 --- a/sdk/search/azure-search-documents/src/samples/README.md +++ b/sdk/search/azure-search-documents/src/samples/README.md @@ -61,7 +61,7 @@ add the direct dependency to your project as follows. com.azure azure-search-documents - 11.7.0 + 11.8.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/VectorSearchTests.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/VectorSearchTests.java index 38822c67b46e3..587de846f5f56 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/VectorSearchTests.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/VectorSearchTests.java @@ -11,10 +11,12 @@ import com.azure.search.documents.indexes.SearchIndexAsyncClient; import com.azure.search.documents.indexes.SearchIndexClient; import com.azure.search.documents.indexes.SearchIndexClientBuilder; +import com.azure.search.documents.indexes.models.BinaryQuantizationCompression; import com.azure.search.documents.indexes.models.DistanceScoringFunction; import com.azure.search.documents.indexes.models.DistanceScoringParameters; import com.azure.search.documents.indexes.models.HnswAlgorithmConfiguration; import com.azure.search.documents.indexes.models.LexicalAnalyzerName; +import com.azure.search.documents.indexes.models.ScalarQuantizationCompression; import com.azure.search.documents.indexes.models.ScoringFunctionAggregation; import com.azure.search.documents.indexes.models.ScoringProfile; import com.azure.search.documents.indexes.models.SearchField; @@ -67,6 +69,7 @@ /** * Tests Vector search functionality. */ + @Execution(ExecutionMode.SAME_THREAD) public class VectorSearchTests extends SearchTestBase { private static void assertKeysEqual(List results, Function keyAccessor, @@ -87,7 +90,6 @@ public static void setupClass() { searchIndexClient = new SearchIndexClientBuilder() .endpoint(ENDPOINT) - .serviceVersion(SearchServiceVersion.V2023_11_01) .credential(TestHelpers.getTestTokenCredential()) .retryPolicy(SERVICE_THROTTLE_SAFE_RETRY_POLICY) .buildClient(); @@ -487,6 +489,186 @@ public void updateExistingIndexToAddVectorFieldsSync() { (List) responseDocument.get("DescriptionVector")); } + // create a test that synchronously tests the ability to use VectorSearchCompression.truncationDimension to reduce the dimensionality of the vector + @SuppressWarnings("unchecked") + @Test + public void testVectorSearchCompressionTruncationDimensionSync() { + // create a new index with a vector field + String indexName = randomIndexName("compressiontruncationdimension"); + String compressionName = "vector-compression-100"; + + + SearchIndex searchIndex = new SearchIndex(indexName) + .setFields( + new SearchField("Id", SearchFieldDataType.STRING) + .setKey(true), + new SearchField("Name", SearchFieldDataType.STRING) + .setSearchable(true) + .setFilterable(true), + new SearchField("DescriptionVector", SearchFieldDataType.collection(SearchFieldDataType.SINGLE)) + .setSearchable(true) + .setHidden(false) + .setVectorSearchDimensions(1536) + .setVectorSearchProfileName("my-vector-profile")) + .setVectorSearch(new VectorSearch() + .setProfiles(Collections.singletonList( + new VectorSearchProfile("my-vector-profile", "my-vector-config"))) + .setAlgorithms(Collections.singletonList(new HnswAlgorithmConfiguration("my-vector-config"))) + .setCompressions(new BinaryQuantizationCompression(compressionName).setTruncationDimension(100))); + + SearchIndexClient searchIndexClient = getSearchIndexClientBuilder(true).buildClient(); + searchIndexClient.createIndex(searchIndex); + + indexesToDelete.add(indexName); + + SearchIndex retrievedIndex = searchIndexClient.getIndex(indexName); + assertEquals(1, retrievedIndex.getVectorSearch().getCompressions().size()); + assertEquals(compressionName, retrievedIndex.getVectorSearch().getCompressions().get(0).getCompressionName()); + + } + + + + // create a test that asynchronously tests the ability to use VectorSearchCompression.truncationDimension to reduce the dimensionality of the vector + @SuppressWarnings("unchecked") + @Test + public void testVectorSearchCompressionTruncationDimensionAsync() { + // create a new index with a vector field + String indexName = randomIndexName("compressiontruncationdimensionasync"); + String compressionName = "vector-compression-100"; + + SearchIndex searchIndex = new SearchIndex(indexName) + .setFields( + new SearchField("Id", SearchFieldDataType.STRING) + .setKey(true), + new SearchField("Name", SearchFieldDataType.STRING) + .setSearchable(true) + .setFilterable(true), + new SearchField("DescriptionVector", SearchFieldDataType.collection(SearchFieldDataType.SINGLE)) + .setSearchable(true) + .setHidden(false) + .setVectorSearchDimensions(1536) + .setVectorSearchProfileName("my-vector-profile")) + .setVectorSearch(new VectorSearch() + .setProfiles(Collections.singletonList( + new VectorSearchProfile("my-vector-profile", "my-vector-config"))) + .setAlgorithms(Collections.singletonList(new HnswAlgorithmConfiguration("my-vector-config"))) + .setCompressions(new ScalarQuantizationCompression(compressionName).setTruncationDimension(100))); + + SearchIndexAsyncClient searchIndexAsyncClient = getSearchIndexClientBuilder(false).buildAsyncClient(); + searchIndexAsyncClient.createIndex(searchIndex).block(); + waitForIndexing(); + indexesToDelete.add(indexName); + + StepVerifier.create(searchIndexAsyncClient.getIndex(indexName)) + .assertNext(retrievedIndex -> { + assertEquals(1, retrievedIndex.getVectorSearch().getCompressions().size()); + assertEquals(compressionName, retrievedIndex.getVectorSearch().getCompressions().get(0).getCompressionName()); + }) + .verifyComplete(); + } + + // write a test that asynchronously tests the ability to upload a vector field to an index using BinaryQuantizationCompression + @SuppressWarnings("unchecked") + @Test + public void testVectorSearchCompressionBinaryQuantizationAsync() { + // create a new index with a vector field + String indexName = randomIndexName("compressionbinaryquantizationasync"); + String compressionName = "binary-vector-compression"; + + SearchIndex searchIndex = new SearchIndex(indexName) + .setFields( + new SearchField("Id", SearchFieldDataType.STRING) + .setKey(true), + new SearchField("Name", SearchFieldDataType.STRING) + .setSearchable(true) + .setFilterable(true), + new SearchField("BinaryCompressedVector", SearchFieldDataType.collection(SearchFieldDataType.SINGLE)) + .setSearchable(true) + .setHidden(false) + .setVectorSearchDimensions(5) + .setVectorSearchProfileName("my-vector-profile")) + .setVectorSearch(new VectorSearch() + .setProfiles(Collections.singletonList( + new VectorSearchProfile("my-vector-profile", "my-vector-config"))) + .setAlgorithms(Collections.singletonList(new HnswAlgorithmConfiguration("my-vector-config"))) + .setCompressions(new BinaryQuantizationCompression(compressionName))); + + SearchIndexAsyncClient searchIndexAsyncClient = getSearchIndexClientBuilder(false).buildAsyncClient(); + searchIndexAsyncClient.createIndex(searchIndex).block(); + indexesToDelete.add(indexName); + + StepVerifier.create(searchIndexAsyncClient.getIndex(indexName)) + .assertNext(retrievedIndex -> { + assertEquals(1, retrievedIndex.getVectorSearch().getCompressions().size()); + assertEquals(compressionName, retrievedIndex.getVectorSearch().getCompressions().get(0).getCompressionName()); + }) + .verifyComplete(); + } + + // write a test that synchronously tests the ability to upload a vector field to an index using BinaryQuantizationCompression + @SuppressWarnings("unchecked") + @Test + public void testVectorSearchCompressionBinaryQuantizationSync() { + // create a new index with a vector field + String indexName = randomIndexName("compressionbinaryquantizationsync"); + String compressionName = "binary-vector-compression"; + + SearchIndex searchIndex = new SearchIndex(indexName) + .setFields( + new SearchField("Id", SearchFieldDataType.STRING) + .setKey(true), + new SearchField("Name", SearchFieldDataType.STRING) + .setSearchable(true) + .setFilterable(true), + new SearchField("BinaryCompressedVector", SearchFieldDataType.collection(SearchFieldDataType.SINGLE)) + .setSearchable(true) + .setHidden(false) + .setVectorSearchDimensions(5) + .setVectorSearchProfileName("my-vector-profile")) + .setVectorSearch(new VectorSearch() + .setProfiles(Collections.singletonList( + new VectorSearchProfile("my-vector-profile", "my-vector-config"))) + .setAlgorithms(Collections.singletonList(new HnswAlgorithmConfiguration("my-vector-config"))) + .setCompressions(new BinaryQuantizationCompression(compressionName))); + + SearchIndexClient searchIndexClient = getSearchIndexClientBuilder(true).buildClient(); + searchIndexClient.createIndex(searchIndex); + indexesToDelete.add(indexName); + + SearchIndex retrievedIndex = searchIndexClient.getIndex(indexName); + assertEquals(1, retrievedIndex.getVectorSearch().getCompressions().size()); + assertEquals(compressionName, retrievedIndex.getVectorSearch().getCompressions().get(0).getCompressionName()); + } + + // a test that creates a hybrid search query with a vector search query and a regular search query, and utilizes the vector query + // fiter override to filter the vector search results + @Test + public void testHybridSearchWithVectorFilterOverride() { + // create a new index with a vector field + + + // create a hybrid search query with a vector search query and a regular search query + SearchOptions searchOptions = new SearchOptions() + .setFilter("Rating ge 3") + .setSelect("HotelId", "HotelName", "Rating") + .setVectorSearchOptions(new VectorSearchOptions() + .setQueries(new VectorizedQuery(VectorSearchEmbeddings.DEFAULT_VECTORIZE_DESCRIPTION) + .setFields("DescriptionVector") + .setFilterOverride("HotelId eq '1'"))); + + // run the hybrid search query + SearchClient searchClient = getSearchClientBuilder(HOTEL_INDEX_NAME, true).buildClient(); + List results = searchClient.search("fancy", searchOptions, Context.NONE) + .stream().collect(Collectors.toList()); + + // check that the results are as expected + assertEquals(1, results.size()); + assertEquals("1", results.get(0).getDocument(SearchDocument.class).get("HotelId")); + + } + + private static void compareFloatListToDeserializedFloatList(List expected, List actual) { if (actual == null) { assertNull(expected); @@ -506,6 +688,8 @@ private static void compareFloatListToDeserializedFloatList(List expected } } + + private static SearchIndex getVectorIndex() { return new SearchIndex(HOTEL_INDEX_NAME) .setFields( diff --git a/sdk/search/azure-search-documents/swagger/README.md b/sdk/search/azure-search-documents/swagger/README.md index cf59e0b357870..b5a1a61e20b8d 100644 --- a/sdk/search/azure-search-documents/swagger/README.md +++ b/sdk/search/azure-search-documents/swagger/README.md @@ -87,10 +87,10 @@ These settings apply only when `--tag=searchindex` is specified on the command l ``` yaml $(tag) == 'searchindex' namespace: com.azure.search.documents input-file: -- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/dc27f9b32787533cd4d07fe0de5245f2f8354dbe/specification/search/data-plane/Azure.Search/stable/2024-07-01/searchindex.json +- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/4b7fbd8b842b509a0330f20260821dd844328dff/specification/search/data-plane/Azure.Search/preview/2024-09-01-preview/searchindex.json models-subpackage: models custom-types-subpackage: implementation.models -custom-types: AutocompleteRequest,IndexAction,IndexBatch,RequestOptions,SearchDocumentsResult,SearchErrorException,SearchOptions,SearchRequest,SearchResult,SuggestDocumentsResult,SuggestRequest,SuggestResult,ErrorAdditionalInfo,ErrorDetail,ErrorResponse,ErrorResponseException +custom-types: AutocompleteRequest,IndexAction,IndexBatch,RequestOptions,SearchDocumentsResult,SearchErrorException,SearchOptions,SearchRequest,SearchResult,SuggestDocumentsResult,SuggestRequest,SuggestResult,ErrorAdditionalInfo,ErrorDetail,ErrorResponse,ErrorResponseException,Speller customization-class: src/main/java/SearchIndexCustomizations.java directive: - rename-model: @@ -105,7 +105,7 @@ These settings apply only when `--tag=searchservice` is specified on the command ``` yaml $(tag) == 'searchservice' namespace: com.azure.search.documents.indexes input-file: -- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/bfb929ca5fd9e73258071724b440ae244e084c56/specification/search/data-plane/Azure.Search/stable/2024-07-01/searchservice.json +- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/4b7fbd8b842b509a0330f20260821dd844328dff/specification/search/data-plane/Azure.Search/preview/2024-09-01-preview/searchservice.json models-subpackage: models custom-types-subpackage: implementation.models custom-types: AnalyzeRequest,AnalyzeResult,AzureActiveDirectoryApplicationCredentials,DataSourceCredentials,DocumentKeysOrIds,EdgeNGramTokenFilterV1,EdgeNGramTokenFilterV2,EntityRecognitionSkillV1,EntityRecognitionSkillV3,KeywordTokenizerV1,KeywordTokenizerV2,ListAliasesResult,ListDataSourcesResult,ListIndexersResult,ListIndexesResult,ListSkillsetsResult,ListSynonymMapsResult,LuceneStandardTokenizerV1,LuceneStandardTokenizerV2,NGramTokenFilterV1,NGramTokenFilterV2,RequestOptions,SearchErrorException,SentimentSkillV1,SentimentSkillV3,SkillNames,ErrorAdditionalInfo,ErrorDetail,ErrorResponse,ErrorResponseException @@ -449,3 +449,33 @@ directive: $.OcrSkillLineEnding["x-ms-client-name"] = "OcrLineEnding"; $.OcrSkillLineEnding["x-ms-enum"].name = "OcrLineEnding"; ``` + +### QueryDebugMode is missing vector property + +```yaml $(tag) == 'searchindex' +directive: +- from: "searchindex.json" + where: $.definitions.QueryDebugMode + transform: > + $.enum.push("vector"); + $["x-ms-enum"].values.push({ "value": "vector", "name": "Vector", description: "Allows the user to further explore their hybrid and vector query results." }); +``` + +### Rename Speller to QuerySpellerType +``` yaml $(java) +directive: + - from: swagger-document + where: $.paths["/docs"].get.parameters + transform: > + $.find(p => p.name === "speller")["x-ms-enum"].name = "QuerySpellerType"; +``` + +### Rename Speller to QuerySpellerType +``` yaml $(tag) == 'searchindex' +directive: + - from: swagger-document + where: $.definitions + transform: > + $.Speller["x-ms-enum"].name = "QuerySpellerType"; +``` + diff --git a/sdk/search/azure-search-documents/swagger/src/main/java/SearchIndexCustomizations.java b/sdk/search/azure-search-documents/swagger/src/main/java/SearchIndexCustomizations.java index a4619918ea23f..a6080b7f2bddf 100644 --- a/sdk/search/azure-search-documents/swagger/src/main/java/SearchIndexCustomizations.java +++ b/sdk/search/azure-search-documents/swagger/src/main/java/SearchIndexCustomizations.java @@ -86,9 +86,9 @@ private void customizeModelsPackage(PackageCustomization packageCustomization) { customizeVectorQuery(packageCustomization.getClass("VectorQuery")); customizeVectorizedQuery(packageCustomization.getClass("VectorizedQuery")); customizeVectorizableTextQuery(packageCustomization.getClass("VectorizableTextQuery")); - //customizeVectorizableImageUrlQuery(packageCustomization.getClass("VectorizableImageUrlQuery")); - //customizeVectorizableImageBinaryQuery(packageCustomization.getClass("VectorizableImageBinaryQuery")); - //customizeSearchScoreThreshold(packageCustomization.getClass("SearchScoreThreshold")); + customizeVectorizableImageUrlQuery(packageCustomization.getClass("VectorizableImageUrlQuery")); + customizeVectorizableImageBinaryQuery(packageCustomization.getClass("VectorizableImageBinaryQuery")); + customizeSearchScoreThreshold(packageCustomization.getClass("SearchScoreThreshold")); packageCustomization.getClass("QueryAnswerResult").removeMethod("setAdditionalProperties"); packageCustomization.getClass("QueryCaptionResult").removeMethod("setAdditionalProperties"); diff --git a/sdk/search/azure-search-documents/swagger/src/main/java/SearchServiceCustomizations.java b/sdk/search/azure-search-documents/swagger/src/main/java/SearchServiceCustomizations.java index 27b8ed52a4fa2..8a7d53a48f7a1 100644 --- a/sdk/search/azure-search-documents/swagger/src/main/java/SearchServiceCustomizations.java +++ b/sdk/search/azure-search-documents/swagger/src/main/java/SearchServiceCustomizations.java @@ -93,6 +93,7 @@ public void customize(LibraryCustomization libraryCustomization, Logger logger) customizeVectorSearch(publicCustomization.getClass("VectorSearch")); customizeAzureOpenAIModelName(publicCustomization.getClass("AzureOpenAIModelName")); // customizeSearchError(implCustomization.getClass("SearchError")); + customizeSplitSkillEncoderModelName(publicCustomization.getClass("SplitSkillEncoderModelName")); bulkRemoveFromJsonMethods(publicCustomization.getClass("SearchIndexerKnowledgeStoreProjectionSelector"), publicCustomization.getClass("SearchIndexerKnowledgeStoreBlobProjectionSelector")); @@ -657,6 +658,15 @@ private static void customizeAzureOpenAIModelName(ClassCustomization classCustom }); } + private static void customizeSplitSkillEncoderModelName(ClassCustomization classCustomization) { + customizeAst(classCustomization, clazz -> { + clazz.getFieldByName("R50KBASE").get().getVariable(0).setName("R_50K_BASE"); + clazz.getFieldByName("P50KBASE").get().getVariable(0).setName("P_50K_BASE"); + clazz.getFieldByName("P50KEDIT").get().getVariable(0).setName("P_50K_EDIT"); + clazz.getFieldByName("CL100KBASE").get().getVariable(0).setName("CL_100K_BASE"); + }); + } + private void customizeSearchError(ClassCustomization classCustomization) { customizeAst(classCustomization, clazz -> { MethodDeclaration fromJson = clazz.getMethodsByName("fromJson").get(0); diff --git a/sdk/search/tests.yml b/sdk/search/tests.yml index 3fc225594f651..c732c3d3dcd47 100644 --- a/sdk/search/tests.yml +++ b/sdk/search/tests.yml @@ -5,14 +5,15 @@ extends: parameters: UseFederatedAuth: true ServiceDirectory: search - SupportedClouds: 'Public,UsGov,China' + Clouds: 'Preview' + SupportedClouds: 'Preview,UsGov,China' TimeoutInMinutes: 60 CloudConfig: - Public: - ServiceConnection: azure-sdk-tests + Preview: + SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources-preview) + ServiceConnection: azure-sdk-tests-preview SubscriptionConfigurationFilePaths: - - eng/common/TestResources/sub-config/AzurePublicMsft.json - Location: eastus + - eng/common/TestResources/sub-config/AzurePreviewMsft.json UsGov: ServiceConnection: usgov_azure-sdk-tests SubscriptionConfigurationFilePaths: