Skip to content

Commit 2881b7f

Browse files
authored
Search 10-01-2023 preview Swagger Regen (Azure#37099)
* Swagger Regeneration 10-01-2023 preview * Swagger Regeneration 10-01-2023 preview (updates) * Swagger Regeneration 10-01-2023 preview (updates) with test re-recordings * Swagger Regeneration 10-01-2023 preview (updates) with test re-recordings * test re-recordings * test re-recordings * test re-recordings * test re-recordings * test re-recordings * PR updates from feedback * Updating Code-Customization * Updating Code-Customization * Updating Code-Customization * Updating deserialization * Fixing spotbugs and checkstyle issues
1 parent 05783f7 commit 2881b7f

File tree

48 files changed

+3226
-328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3226
-328
lines changed

sdk/search/azure-search-documents/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "java",
44
"TagPrefix": "java/search/azure-search-documents",
5-
"Tag": "java/search/azure-search-documents_5dd3c5969f"
5+
"Tag": "java/search/azure-search-documents_0d03c8265f"
66
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,8 @@ static SearchRequest createSearchRequest(String searchText, SearchOptions option
11101110
.setSemanticErrorHandling(options.getSemanticErrorHandling())
11111111
.setSemanticMaxWaitInMilliseconds(options.getSemanticMaxWaitInMilliseconds())
11121112
.setDebug(options.getDebug())
1113-
.setVectors(options.getVectors());
1113+
.setVectorQueries(options.getVectorQueries())
1114+
.setSemanticQuery(options.getSemanticQuery());
11141115
}
11151116

11161117
static String createSearchRequestAnswers(SearchOptions searchOptions) {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ public enum SearchServiceVersion implements ServiceVersion {
2020
V2021_04_30_PREVIEW("2021-04-30-Preview"),
2121

2222
/**
23-
* {@code 2023-07-01-Preview} service version.
23+
* {@code 2023-10-01-Preview} service version.
2424
*/
25-
V2023_07_01_PREVIEW("2023-07-01-Preview");
25+
V2023_10_01_PREVIEW("2023-10-01-Preview");
2626

2727
private final String version;
2828

@@ -44,6 +44,6 @@ public String getVersion() {
4444
* @return The latest version supported by this client library.
4545
*/
4646
public static SearchServiceVersion getLatest() {
47-
return V2023_07_01_PREVIEW;
47+
return V2023_10_01_PREVIEW;
4848
}
4949
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ Mono<Response<SearchDocumentsResult>> searchGet(
115115
@QueryParam("queryType") QueryType queryType,
116116
@QueryParam(value = "scoringParameter", multipleQueryParams = true) List<String> scoringParameters,
117117
@QueryParam("scoringProfile") String scoringProfile,
118+
@QueryParam("semanticQuery") String semanticQuery,
118119
@QueryParam("semanticConfiguration") String semanticConfiguration,
119120
@QueryParam("semanticErrorHandling") SemanticErrorHandling semanticErrorHandling,
120121
@QueryParam("semanticMaxWaitInMilliseconds") Integer semanticMaxWaitInMilliseconds,
@@ -154,6 +155,7 @@ Response<SearchDocumentsResult> searchGetSync(
154155
@QueryParam("queryType") QueryType queryType,
155156
@QueryParam(value = "scoringParameter", multipleQueryParams = true) List<String> scoringParameters,
156157
@QueryParam("scoringProfile") String scoringProfile,
158+
@QueryParam("semanticQuery") String semanticQuery,
157159
@QueryParam("semanticConfiguration") String semanticConfiguration,
158160
@QueryParam("semanticErrorHandling") SemanticErrorHandling semanticErrorHandling,
159161
@QueryParam("semanticMaxWaitInMilliseconds") Integer semanticMaxWaitInMilliseconds,

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

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,22 @@ public final class SearchOptions implements JsonSerializable<SearchOptions> {
9191
*/
9292
private String scoringProfile;
9393

94+
/*
95+
* Allows setting a separate search query that will be solely used for semantic reranking, semantic captions and
96+
* semantic answers. Is useful for scenarios where there is a need to use different queries between the base
97+
* retrieval and ranking phase, and the L2 semantic phase.
98+
*/
99+
private String semanticQuery;
100+
94101
/*
95102
* The name of the semantic configuration that lists which fields should be used for semantic ranking, captions,
96103
* highlights, and answers
97104
*/
98105
private String semanticConfiguration;
99106

100107
/*
101-
* Allows the user to choose whether a semantic call should fail completely, or to return partial results.
108+
* Allows the user to choose whether a semantic call should fail completely, or to return partial results
109+
* (default).
102110
*/
103111
private SemanticErrorHandling semanticErrorHandling;
104112

@@ -448,6 +456,30 @@ public SearchOptions setScoringProfile(String scoringProfile) {
448456
return this;
449457
}
450458

459+
/**
460+
* Get the semanticQuery property: Allows setting a separate search query that will be solely used for semantic
461+
* reranking, semantic captions and semantic answers. Is useful for scenarios where there is a need to use different
462+
* queries between the base retrieval and ranking phase, and the L2 semantic phase.
463+
*
464+
* @return the semanticQuery value.
465+
*/
466+
public String getSemanticQuery() {
467+
return this.semanticQuery;
468+
}
469+
470+
/**
471+
* Set the semanticQuery property: Allows setting a separate search query that will be solely used for semantic
472+
* reranking, semantic captions and semantic answers. Is useful for scenarios where there is a need to use different
473+
* queries between the base retrieval and ranking phase, and the L2 semantic phase.
474+
*
475+
* @param semanticQuery the semanticQuery value to set.
476+
* @return the SearchOptions object itself.
477+
*/
478+
public SearchOptions setSemanticQuery(String semanticQuery) {
479+
this.semanticQuery = semanticQuery;
480+
return this;
481+
}
482+
451483
/**
452484
* Get the semanticConfiguration property: The name of the semantic configuration that lists which fields should be
453485
* used for semantic ranking, captions, highlights, and answers.
@@ -472,7 +504,7 @@ public SearchOptions setSemanticConfiguration(String semanticConfiguration) {
472504

473505
/**
474506
* Get the semanticErrorHandling property: Allows the user to choose whether a semantic call should fail completely,
475-
* or to return partial results.
507+
* or to return partial results (default).
476508
*
477509
* @return the semanticErrorHandling value.
478510
*/
@@ -482,7 +514,7 @@ public SemanticErrorHandling getSemanticErrorHandling() {
482514

483515
/**
484516
* Set the semanticErrorHandling property: Allows the user to choose whether a semantic call should fail completely,
485-
* or to return partial results.
517+
* or to return partial results (default).
486518
*
487519
* @param semanticErrorHandling the semanticErrorHandling value to set.
488520
* @return the SearchOptions object itself.
@@ -832,6 +864,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
832864
jsonWriter.writeArrayField(
833865
"ScoringParameters", this.scoringParameters, (writer, element) -> writer.writeString(element));
834866
jsonWriter.writeStringField("scoringProfile", this.scoringProfile);
867+
jsonWriter.writeStringField("semanticQuery", this.semanticQuery);
835868
jsonWriter.writeStringField("semanticConfiguration", this.semanticConfiguration);
836869
jsonWriter.writeStringField("semanticErrorHandling", Objects.toString(this.semanticErrorHandling, null));
837870
jsonWriter.writeNumberField("semanticMaxWaitInMilliseconds", this.semanticMaxWaitInMilliseconds);
@@ -893,6 +926,8 @@ public static SearchOptions fromJson(JsonReader jsonReader) throws IOException {
893926
deserializedSearchOptions.scoringParameters = scoringParameters;
894927
} else if ("scoringProfile".equals(fieldName)) {
895928
deserializedSearchOptions.scoringProfile = reader.getString();
929+
} else if ("semanticQuery".equals(fieldName)) {
930+
deserializedSearchOptions.semanticQuery = reader.getString();
896931
} else if ("semanticConfiguration".equals(fieldName)) {
897932
deserializedSearchOptions.semanticConfiguration = reader.getString();
898933
} else if ("semanticErrorHandling".equals(fieldName)) {

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

Lines changed: 89 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
import com.azure.search.documents.models.QueryType;
1818
import com.azure.search.documents.models.ScoringStatistics;
1919
import com.azure.search.documents.models.SearchMode;
20-
import com.azure.search.documents.models.SearchQueryVector;
2120
import com.azure.search.documents.models.SemanticErrorHandling;
21+
import com.azure.search.documents.models.VectorFilterMode;
22+
import com.azure.search.documents.models.VectorQuery;
2223
import java.io.IOException;
2324
import java.util.List;
2425
import java.util.Objects;
@@ -110,14 +111,21 @@ public final class SearchRequest implements JsonSerializable<SearchRequest> {
110111
*/
111112
private String scoringProfile;
112113

114+
/*
115+
* Allows setting a separate search query that will be solely used for semantic reranking, semantic captions and
116+
* semantic answers. Is useful for scenarios where there is a need to use different queries between the base
117+
* retrieval and ranking phase, and the L2 semantic phase.
118+
*/
119+
private String semanticQuery;
120+
113121
/*
114122
* The name of a semantic configuration that will be used when processing documents for queries of type semantic.
115123
*/
116124
private String semanticConfiguration;
117125

118126
/*
119-
* Allows the user to choose whether a semantic call should fail completely (default / current behavior), or to
120-
* return partial results.
127+
* Allows the user to choose whether a semantic call should fail completely, or to return partial results
128+
* (default).
121129
*/
122130
private SemanticErrorHandling semanticErrorHandling;
123131

@@ -204,9 +212,15 @@ public final class SearchRequest implements JsonSerializable<SearchRequest> {
204212
private String semanticFields;
205213

206214
/*
207-
* The query parameters for multi-vector search queries.
215+
* The query parameters for vector and hybrid search queries.
216+
*/
217+
private List<VectorQuery> vectorQueries;
218+
219+
/*
220+
* Determines whether or not filters are applied before or after the vector search is performed. Default is
221+
* 'preFilter'.
208222
*/
209-
private List<SearchQueryVector> vectors;
223+
private VectorFilterMode vectorFilterMode;
210224

211225
/** Creates an instance of SearchRequest class. */
212226
public SearchRequest() {}
@@ -517,6 +531,30 @@ public SearchRequest setScoringProfile(String scoringProfile) {
517531
return this;
518532
}
519533

534+
/**
535+
* Get the semanticQuery property: Allows setting a separate search query that will be solely used for semantic
536+
* reranking, semantic captions and semantic answers. Is useful for scenarios where there is a need to use different
537+
* queries between the base retrieval and ranking phase, and the L2 semantic phase.
538+
*
539+
* @return the semanticQuery value.
540+
*/
541+
public String getSemanticQuery() {
542+
return this.semanticQuery;
543+
}
544+
545+
/**
546+
* Set the semanticQuery property: Allows setting a separate search query that will be solely used for semantic
547+
* reranking, semantic captions and semantic answers. Is useful for scenarios where there is a need to use different
548+
* queries between the base retrieval and ranking phase, and the L2 semantic phase.
549+
*
550+
* @param semanticQuery the semanticQuery value to set.
551+
* @return the SearchRequest object itself.
552+
*/
553+
public SearchRequest setSemanticQuery(String semanticQuery) {
554+
this.semanticQuery = semanticQuery;
555+
return this;
556+
}
557+
520558
/**
521559
* Get the semanticConfiguration property: The name of a semantic configuration that will be used when processing
522560
* documents for queries of type semantic.
@@ -540,8 +578,8 @@ public SearchRequest setSemanticConfiguration(String semanticConfiguration) {
540578
}
541579

542580
/**
543-
* Get the semanticErrorHandling property: Allows the user to choose whether a semantic call should fail completely
544-
* (default / current behavior), or to return partial results.
581+
* Get the semanticErrorHandling property: Allows the user to choose whether a semantic call should fail completely,
582+
* or to return partial results (default).
545583
*
546584
* @return the semanticErrorHandling value.
547585
*/
@@ -550,8 +588,8 @@ public SemanticErrorHandling getSemanticErrorHandling() {
550588
}
551589

552590
/**
553-
* Set the semanticErrorHandling property: Allows the user to choose whether a semantic call should fail completely
554-
* (default / current behavior), or to return partial results.
591+
* Set the semanticErrorHandling property: Allows the user to choose whether a semantic call should fail completely,
592+
* or to return partial results (default).
555593
*
556594
* @param semanticErrorHandling the semanticErrorHandling value to set.
557595
* @return the SearchRequest object itself.
@@ -862,22 +900,44 @@ public SearchRequest setSemanticFields(String semanticFields) {
862900
}
863901

864902
/**
865-
* Get the vectors property: The query parameters for multi-vector search queries.
903+
* Get the vectorQueries property: The query parameters for vector and hybrid search queries.
904+
*
905+
* @return the vectorQueries value.
906+
*/
907+
public List<VectorQuery> getVectorQueries() {
908+
return this.vectorQueries;
909+
}
910+
911+
/**
912+
* Set the vectorQueries property: The query parameters for vector and hybrid search queries.
913+
*
914+
* @param vectorQueries the vectorQueries value to set.
915+
* @return the SearchRequest object itself.
916+
*/
917+
public SearchRequest setVectorQueries(List<VectorQuery> vectorQueries) {
918+
this.vectorQueries = vectorQueries;
919+
return this;
920+
}
921+
922+
/**
923+
* Get the vectorFilterMode property: Determines whether or not filters are applied before or after the vector
924+
* search is performed. Default is 'preFilter'.
866925
*
867-
* @return the vectors value.
926+
* @return the vectorFilterMode value.
868927
*/
869-
public List<SearchQueryVector> getVectors() {
870-
return this.vectors;
928+
public VectorFilterMode getVectorFilterMode() {
929+
return this.vectorFilterMode;
871930
}
872931

873932
/**
874-
* Set the vectors property: The query parameters for multi-vector search queries.
933+
* Set the vectorFilterMode property: Determines whether or not filters are applied before or after the vector
934+
* search is performed. Default is 'preFilter'.
875935
*
876-
* @param vectors the vectors value to set.
936+
* @param vectorFilterMode the vectorFilterMode value to set.
877937
* @return the SearchRequest object itself.
878938
*/
879-
public SearchRequest setVectors(List<SearchQueryVector> vectors) {
880-
this.vectors = vectors;
939+
public SearchRequest setVectorFilterMode(VectorFilterMode vectorFilterMode) {
940+
this.vectorFilterMode = vectorFilterMode;
881941
return this;
882942
}
883943

@@ -898,6 +958,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
898958
jsonWriter.writeArrayField(
899959
"scoringParameters", this.scoringParameters, (writer, element) -> writer.writeString(element));
900960
jsonWriter.writeStringField("scoringProfile", this.scoringProfile);
961+
jsonWriter.writeStringField("semanticQuery", this.semanticQuery);
901962
jsonWriter.writeStringField("semanticConfiguration", this.semanticConfiguration);
902963
jsonWriter.writeStringField("semanticErrorHandling", Objects.toString(this.semanticErrorHandling, null));
903964
jsonWriter.writeNumberField("semanticMaxWaitInMilliseconds", this.semanticMaxWaitInMilliseconds);
@@ -913,7 +974,8 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
913974
jsonWriter.writeNumberField("top", this.top);
914975
jsonWriter.writeStringField("captions", this.captions);
915976
jsonWriter.writeStringField("semanticFields", this.semanticFields);
916-
jsonWriter.writeArrayField("vectors", this.vectors, (writer, element) -> writer.writeJson(element));
977+
jsonWriter.writeArrayField("vectorQueries", this.vectorQueries, (writer, element) -> writer.writeJson(element));
978+
jsonWriter.writeStringField("vectorFilterMode", Objects.toString(this.vectorFilterMode, null));
917979
return jsonWriter.writeEndObject();
918980
}
919981

@@ -963,6 +1025,8 @@ public static SearchRequest fromJson(JsonReader jsonReader) throws IOException {
9631025
deserializedSearchRequest.scoringParameters = scoringParameters;
9641026
} else if ("scoringProfile".equals(fieldName)) {
9651027
deserializedSearchRequest.scoringProfile = reader.getString();
1028+
} else if ("semanticQuery".equals(fieldName)) {
1029+
deserializedSearchRequest.semanticQuery = reader.getString();
9661030
} else if ("semanticConfiguration".equals(fieldName)) {
9671031
deserializedSearchRequest.semanticConfiguration = reader.getString();
9681032
} else if ("semanticErrorHandling".equals(fieldName)) {
@@ -995,10 +1059,13 @@ public static SearchRequest fromJson(JsonReader jsonReader) throws IOException {
9951059
deserializedSearchRequest.captions = reader.getString();
9961060
} else if ("semanticFields".equals(fieldName)) {
9971061
deserializedSearchRequest.semanticFields = reader.getString();
998-
} else if ("vectors".equals(fieldName)) {
999-
List<SearchQueryVector> vectors =
1000-
reader.readArray(reader1 -> SearchQueryVector.fromJson(reader1));
1001-
deserializedSearchRequest.vectors = vectors;
1062+
} else if ("vectorQueries".equals(fieldName)) {
1063+
List<VectorQuery> vectorQueries =
1064+
reader.readArray(reader1 -> VectorQuery.fromJson(reader1));
1065+
deserializedSearchRequest.vectorQueries = vectorQueries;
1066+
} else if ("vectorFilterMode".equals(fieldName)) {
1067+
deserializedSearchRequest.vectorFilterMode =
1068+
VectorFilterMode.fromString(reader.getString());
10021069
} else {
10031070
reader.skipChildren();
10041071
}

0 commit comments

Comments
 (0)