Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@
"AICLIPIMAGE",
"AISERVICES",
"AITOKENS",
"azsearch",
"Bangla",
"bokmaal",
"Bokm",
Expand Down Expand Up @@ -669,7 +670,8 @@
"TLARGE",
"vectorizable",
"vectorizer",
"vectorizers"
"vectorizers",
"workiq"
]
},
{
Expand Down
57 changes: 57 additions & 0 deletions eng/lintingconfigs/revapi/track2/revapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1797,6 +1797,63 @@
"code": "java.method.returnTypeChanged",
"old" : "method com.azure.resourcemanager.monitor.models.ConditionOperator[] com.azure.resourcemanager.monitor.models.ConditionOperator::values()",
"justification": "TypeSpec migration: ConditionOperator changed from enum to ExpandableStringEnum, values() return type changed."
},
{
"ignore": true,
"code": "java.field.enumConstantOrderChanged",
"old": "field com.azure.search.documents.SearchServiceVersion.V2026_04_01",
"justification": "Non-breaking change: new API version V2026_05_01_PREVIEW inserted before existing version."
},
{
"ignore": true,
"code": "java.method.visibilityIncreased",
"old": {
"matcher": "regex",
"match": "method void com\\.azure\\.search\\.documents\\.knowledgebases\\.models\\..*::<init>\\(.*\\)"
},
"justification": "Non-breaking change: constructor visibility increased on final classes in knowledgebases preview package."
},
{
"ignore": true,
"code": "java.method.parameterTypeChanged",
"old": {
"matcher": "regex",
"match": "parameter .* com\\.azure\\.search\\.documents\\.knowledgebases\\.KnowledgeBaseRetrieval(Async)?Client::retrieve\\(.*\\)"
},
"justification": "Intentional breaking change in knowledgebases preview: retrieve() signature restructured, knowledgeBaseName removed from parameters."
},
{
"ignore": true,
"code": "java.method.numberOfParametersChanged",
"old": {
"matcher": "regex",
"match": "method .* com\\.azure\\.search\\.documents\\.knowledgebases\\.KnowledgeBaseRetrieval(Async)?Client::retrieveWithResponse\\(.*\\)"
},
"justification": "Intentional breaking change in knowledgebases preview: retrieveWithResponse() signature restructured."
},
{
"ignore": true,
"code": "java.class.removed",
"old": "class com.azure.search.documents.knowledgebases.models.AIServices",
"justification": "Intentional rename in knowledgebases preview: AIServices renamed to AiServices per archboard guidance."
},
{
"ignore": true,
"code": "java.method.removed",
"old": {
"matcher": "regex",
"match": "method .* com\\.azure\\.search\\.documents\\.knowledgebases\\.models\\.KnowledgeBaseModelWebSummarizationActivityRecord::get(Input|Output)Tokens\\(\\)"
},
"justification": "Intentional rename in knowledgebases preview: getInputTokens()/getOutputTokens() renamed to getInputTokensCount()/getOutputTokensCount() per archboard guidance."
},
{
"ignore": true,
"code": "java.method.removed",
"old": {
"matcher": "regex",
"match": "method .* com\\.azure\\.search\\.documents\\.knowledgebases\\.models\\.KnowledgeSourceIngestionParameters::(get|set)AIServices\\(.*\\)"
},
"justification": "Intentional rename in knowledgebases preview: getAIServices()/setAIServices() renamed to getAiServices()/setAiServices() following AIServices to AiServices rename per archboard guidance."
}
]
}
Expand Down
18 changes: 18 additions & 0 deletions sdk/search/azure-search-documents/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,26 @@

### Features Added

- Added support for the `2026-05-01-Preview` service version.
- Added new knowledge source types: `FabricDataAgentKnowledgeSource`, `FabricOntologyKnowledgeSource`, `FileKnowledgeSource`, `IndexedSharePointKnowledgeSource`, `IndexedSqlKnowledgeSource`, `McpServerKnowledgeSource`, `RemoteSharePointKnowledgeSource`, and `WorkIQKnowledgeSource`.
- Added MCP server knowledge source types including `McpServerAuthentication`, `McpServerOutputParsing`, and `McpServerTool`.
- Added knowledge base reference types: `KnowledgeBaseFabricDataAgentReference`, `KnowledgeBaseFabricOntologyReference`, `KnowledgeBaseFileReference`, `KnowledgeBaseIndexedSharePointReference`, `KnowledgeBaseIndexedSqlReference`, `KnowledgeBaseMcpServerReference`, `KnowledgeBaseRemoteSharePointReference`, and `KnowledgeBaseWorkIQReference`.
- Added `FreshnessPolicy` model for knowledge source freshness configuration.
- Added `ContentColumnMapping` and `EmbeddingColumnMapping` models.
- Added `SharePointConnectorAppRegistration` for SharePoint connector authentication.
- Added `PurviewSensitivityLabelInfo` model.
- Added `WorkIQAttribution` model.
- Added `AssetStore` model.
- Added `failOnError`, `maxOutputDocuments`, and `enableImageServing` properties to knowledge source parameters.
- Added knowledge source params subtypes: `FabricDataAgentKnowledgeSourceParams`, `FabricOntologyKnowledgeSourceParams`, `FileKnowledgeSourceParams`, `IndexedSharePointKnowledgeSourceParams`, `IndexedSqlKnowledgeSourceParams`, `McpServerKnowledgeSourceParams`, `RemoteSharePointKnowledgeSourceParams`, and `WorkIQKnowledgeSourceParams`.
- Added `ImageServingStatistics` model for knowledge base image content retrieval.

### Breaking Changes

- Renamed `AIServices` to `AiServices`, including `getAIServices()`/`setAIServices()` to `getAiServices()`/`setAiServices()` on `KnowledgeSourceIngestionParameters`.
- Renamed `getInputTokens()`/`getOutputTokens()` to `getInputTokensCount()`/`getOutputTokensCount()` on `KnowledgeBaseModelWebSummarizationActivityRecord`.
- Changed `KnowledgeBaseRetrievalClient` and `KnowledgeBaseRetrievalAsyncClient` `retrieve()` and `retrieveWithResponse()` signatures — client is now scoped to a single knowledge base at construction; `knowledgeBaseName` parameter replaced with `KnowledgeBaseRetrievalOptions`.

### Bugs Fixed

### Other Changes
Expand Down
2 changes: 1 addition & 1 deletion sdk/search/azure-search-documents/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "java",
"TagPrefix": "java/search/azure-search-documents",
"Tag": "java/search/azure-search-documents_25987e5c19"
"Tag": "java/search/azure-search-documents_01c5d0ce"
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
<suppress files="com.azure.search.documents.implementation.batching.SearchIndexingPublisher.java" checks="io.clientcore.linting.extensions.checkstyle.checks.ThrowFromClientLoggerCheck" />
<suppress files="com.azure.search.documents.indexes.models.SearchIndexerKnowledgeStoreProjectionSelector.java" checks="io.clientcore.linting.extensions.checkstyle.checks.SerializableMethodsCheck" />
<suppress files="com.azure.search.documents.models.SearchContinuationToken.java" checks="io.clientcore.linting.extensions.checkstyle.checks.SerializableMethodsCheck" />
<suppress files="com.azure.search.documents.indexes.models.McpServerKnowledgeSourceParameters.java" checks="io.clientcore.linting.extensions.checkstyle.checks.DenyListedWordsCheck" />
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds a file-level suppression for DenyListedWordsCheck. If possible, it’s better to fix the offending term(s) in code/Javadoc (or narrow the suppression to the smallest scope possible with a clear rationale) rather than suppressing the rule for the whole file, since this can mask future violations.

Suggested change
<suppress files="com.azure.search.documents.indexes.models.McpServerKnowledgeSourceParameters.java" checks="io.clientcore.linting.extensions.checkstyle.checks.DenyListedWordsCheck" />

Copilot uses AI. Check for mistakes.
</suppressions>
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ public void customize(LibraryCustomization libraryCustomization, Logger logger)
hideWithResponseBinaryDataApis(indexes.getClass("SearchIndexerAsyncClient"));
hideWithResponseBinaryDataApis(knowledge.getClass("KnowledgeBaseRetrievalClient"));
hideWithResponseBinaryDataApis(knowledge.getClass("KnowledgeBaseRetrievalAsyncClient"));

// After hiding BinaryData protocol methods, add typed public convenience wrappers on the async client
// that mirror what the sync client already has as hand-written methods.
addAsyncKnowledgeBaseConvenienceMethods(indexes.getClass("SearchIndexAsyncClient"));

// SearchResourceEncryptionKey workaround: the spec marks keyVaultUri and keyVaultKeyName as required,
// but they are not required when isServiceLevelKey is true. Add a no-arg constructor.
addNoArgConstructorToEncryptionKey(
libraryCustomization.getPackage("com.azure.search.documents.indexes.models")
.getClass("SearchResourceEncryptionKey"));
}

// Weird quirk in the Java generator where SearchOptions is inferred from the parameters of searchPost in TypeSpec,
Expand Down Expand Up @@ -137,8 +147,14 @@ private static void hideWithResponseBinaryDataApis(ClassCustomization customizat
return;
}

if (hasBinaryDataInType(method.getType())
|| method.getParameters().stream().anyMatch(param -> hasBinaryDataInType(param.getType()))) {
boolean returnsBinaryData = hasBinaryDataInType(method.getType());
boolean acceptsBinaryData
= method.getParameters().stream().anyMatch(param -> hasBinaryDataInType(param.getType()));

// Only hide methods that return BinaryData or accept BinaryData in WithResponse methods.
// Convenience methods that accept BinaryData as input (e.g., file upload) should remain public.
boolean isWithResponse = method.getNameAsString().contains("WithResponse");
if (returnsBinaryData || (acceptsBinaryData && isWithResponse)) {
String methodName = method.getNameAsString();
String newMethodName = "hiddenGenerated" + Character.toUpperCase(methodName.charAt(0))
+ methodName.substring(1);
Expand Down Expand Up @@ -185,4 +201,81 @@ private static void hideSearchDocumentsResultInternalProperties(ClassCustomizati
}
}));
}

// SearchResourceEncryptionKey has keyName and vaultUrl as required (final) fields, but when
// isServiceLevelKey is true, they are not needed. This adds a no-arg constructor and makes those fields non-final.
private static void addNoArgConstructorToEncryptionKey(ClassCustomization customization) {
customization.customizeAst(ast -> ast.getClassByName(customization.getClassName()).ifPresent(clazz -> {
// Make keyName and vaultUrl non-final
clazz.getFieldByName("keyName").ifPresent(field -> field.setModifiers(Modifier.Keyword.PRIVATE));
clazz.getFieldByName("vaultUrl").ifPresent(field -> field.setModifiers(Modifier.Keyword.PRIVATE));

// Add no-arg constructor
clazz.addMember(StaticJavaParser.parseBodyDeclaration(
"/**\n"
+ " * Creates an instance of SearchResourceEncryptionKey class. Used when isServiceLevelKey is\n"
+ " * set to true, in which case keyName and vaultUrl are not required.\n"
+ " */\n"
+ "public SearchResourceEncryptionKey() {\n"
+ " this.keyName = null;\n"
+ " this.vaultUrl = null;\n"
+ "}\n"));
}));
}

// Adds public convenience methods to SearchIndexAsyncClient for knowledge base and knowledge source
// createOrUpdate operations. The sync client has equivalent hand-written wrappers, but the async client
// only has package-private generated convenience methods after hideWithResponseBinaryDataApis runs.
private static void addAsyncKnowledgeBaseConvenienceMethods(ClassCustomization customization) {
customization.customizeAst(ast -> ast.getClassByName(customization.getClassName()).ifPresent(clazz -> {
// Add: public Mono<KnowledgeBase> createOrUpdateKnowledgeBase(KnowledgeBase knowledgeBase)
MethodDeclaration createOrUpdateKB = StaticJavaParser.parseBodyDeclaration(
"@ServiceMethod(returns = ReturnType.SINGLE)\n"
+ "public Mono<KnowledgeBase> createOrUpdateKnowledgeBase(KnowledgeBase knowledgeBase) {\n"
+ " return createOrUpdateKnowledgeBase(knowledgeBase.getName(), knowledgeBase);\n"
+ "}\n").asMethodDeclaration();
createOrUpdateKB.setJavadocComment(
"Creates a new knowledge base or updates a knowledge base if it already exists.\n"
+ "\n"
+ "@param knowledgeBase The definition of the knowledge base to create or update.\n"
+ "@return the knowledge base that was created or updated.");
clazz.addMember(createOrUpdateKB);

// Add: public Mono<Response<KnowledgeBase>> createOrUpdateKnowledgeBaseWithResponse(
// KnowledgeBase knowledgeBase, RequestOptions requestOptions)
MethodDeclaration createOrUpdateKBWithResponse = StaticJavaParser.parseBodyDeclaration(
"@ServiceMethod(returns = ReturnType.SINGLE)\n"
+ "public Mono<Response<KnowledgeBase>> createOrUpdateKnowledgeBaseWithResponse("
+ "KnowledgeBase knowledgeBase, RequestOptions requestOptions) {\n"
+ " return mapResponse(this.serviceClient.createOrUpdateKnowledgeBaseWithResponseAsync("
+ "knowledgeBase.getName(), BinaryData.fromObject(knowledgeBase), requestOptions), "
+ "KnowledgeBase.class);\n"
+ "}\n").asMethodDeclaration();
createOrUpdateKBWithResponse.setJavadocComment(
"Creates a new knowledge base or updates a knowledge base if it already exists.\n"
+ "\n"
+ "@param knowledgeBase The definition of the knowledge base to create or update.\n"
+ "@param requestOptions The options to configure the HTTP request before HTTP client sends it.\n"
+ "@return the knowledge base that was created or updated along with {@link Response}.");
clazz.addMember(createOrUpdateKBWithResponse);

// Add: public Mono<Response<KnowledgeSource>> createOrUpdateKnowledgeSourceWithResponse(
// KnowledgeSource knowledgeSource, RequestOptions requestOptions)
MethodDeclaration createOrUpdateKSWithResponse = StaticJavaParser.parseBodyDeclaration(
"@ServiceMethod(returns = ReturnType.SINGLE)\n"
+ "public Mono<Response<KnowledgeSource>> createOrUpdateKnowledgeSourceWithResponse("
+ "KnowledgeSource knowledgeSource, RequestOptions requestOptions) {\n"
+ " return mapResponse(this.serviceClient.createOrUpdateKnowledgeSourceWithResponseAsync("
+ "knowledgeSource.getName(), BinaryData.fromObject(knowledgeSource), requestOptions), "
+ "KnowledgeSource.class);\n"
+ "}\n").asMethodDeclaration();
createOrUpdateKSWithResponse.setJavadocComment(
"Creates a new knowledge source or updates a knowledge source if it already exists.\n"
+ "\n"
+ "@param knowledgeSource The definition of the knowledge source to create or update.\n"
+ "@param requestOptions The options to configure the HTTP request before HTTP client sends it.\n"
+ "@return the knowledge source that was created or updated along with {@link Response}.");
clazz.addMember(createOrUpdateKSWithResponse);
}));
}
}
Loading