From c6f90ae89bd7d2db53dbb33dda7f6919ea6e0d34 Mon Sep 17 00:00:00 2001 From: Isaiah Dickerson Date: Wed, 15 Oct 2025 13:16:26 -0700 Subject: [PATCH] Autorest generated code and some changes --- sdk/search/azure-search-documents/pom.xml | 18 + .../main/java/com/azure/search/Aliases.java | 491 +++++++ .../java/com/azure/search/DataSources.java | 545 +++++++ .../main/java/com/azure/search/Documents.java | 1271 +++++++++++++++++ .../main/java/com/azure/search/Indexers.java | 960 +++++++++++++ .../main/java/com/azure/search/Indexes.java | 691 +++++++++ .../java/com/azure/search/KnowledgeBases.java | 483 +++++++ .../com/azure/search/KnowledgeRetrievals.java | 161 +++ .../com/azure/search/KnowledgeSources.java | 574 ++++++++ .../java/com/azure/search/SearchClient.java | 462 ++++++ .../com/azure/search/SearchClientBuilder.java | 346 +++++ .../main/java/com/azure/search/Skillsets.java | 625 ++++++++ .../java/com/azure/search/SynonymMaps.java | 515 +++++++ .../implementation/models/AnalyzeResult.java | 97 ++ .../implementation/models/package-info.java | 10 + .../models/AIFoundryModelCatalogName.java | 93 ++ .../com/azure/search/models/AIServices.java | 125 ++ .../models/AIServicesAccountIdentity.java | 164 +++ .../search/models/AIServicesAccountKey.java | 159 +++ .../models/AIServicesVisionParameters.java | 198 +++ .../models/AIServicesVisionVectorizer.java | 131 ++ .../azure/search/models/AMLParameters.java | 266 ++++ .../azure/search/models/AMLVectorizer.java | 127 ++ .../azure/search/models/AnalyzeRequest.java | 268 ++++ .../search/models/AnalyzedTokenInfo.java | 139 ++ .../models/AsciiFoldingTokenFilter.java | 128 ++ .../azure/search/models/AutocompleteItem.java | 99 ++ .../azure/search/models/AutocompleteMode.java | 67 + .../search/models/AutocompleteOptions.java | 278 ++++ .../search/models/AutocompleteRequest.java | 407 ++++++ .../search/models/AutocompleteResult.java | 103 ++ ...ActiveDirectoryApplicationCredentials.java | 134 ++ .../models/AzureBlobKnowledgeSource.java | 166 +++ .../AzureBlobKnowledgeSourceParameters.java | 244 ++++ .../AzureBlobKnowledgeSourceParams.java | 153 ++ .../models/AzureMachineLearningSkill.java | 366 +++++ .../models/AzureOpenAIEmbeddingSkill.java | 342 +++++ .../search/models/AzureOpenAIModelName.java | 112 ++ .../search/models/AzureOpenAIParameters.java | 217 +++ .../AzureOpenAITokenizerParameters.java | 136 ++ .../search/models/AzureOpenAIVectorizer.java | 126 ++ .../azure/search/models/BM25Similarity.java | 157 ++ ...yQuantizationCompressionConfiguration.java | 154 ++ .../models/BlobIndexerDataToExtract.java | 67 + .../search/models/BlobIndexerImageAction.java | 73 + .../BlobIndexerPDFTextRotationAlgorithm.java | 62 + .../search/models/BlobIndexerParsingMode.java | 88 ++ .../com/azure/search/models/CharFilter.java | 144 ++ .../azure/search/models/CharFilterName.java | 53 + ...ChatCompletionExtraParametersBehavior.java | 65 + .../models/ChatCompletionResponseFormat.java | 132 ++ ...ionResponseFormatJsonSchemaProperties.java | 190 +++ .../ChatCompletionResponseFormatType.java | 65 + .../search/models/ChatCompletionSchema.java | 196 +++ .../search/models/ChatCompletionSkill.java | 432 ++++++ .../search/models/CjkBigramTokenFilter.java | 165 +++ .../models/CjkBigramTokenFilterScripts.java | 67 + .../search/models/ClassicSimilarity.java | 83 ++ .../azure/search/models/ClassicTokenizer.java | 130 ++ .../models/CognitiveServicesAccount.java | 145 ++ .../models/CognitiveServicesAccountKey.java | 127 ++ .../search/models/CommonGramTokenFilter.java | 198 +++ .../search/models/CommonModelParameters.java | 285 ++++ .../models/CompletedSynchronizationState.java | 228 +++ .../azure/search/models/ConditionalSkill.java | 152 ++ .../models/ContentUnderstandingSkill.java | 223 +++ ...tUnderstandingSkillChunkingProperties.java | 160 +++ ...ContentUnderstandingSkillChunkingUnit.java | 53 + ...ntUnderstandingSkillExtractionOptions.java | 59 + .../com/azure/search/models/CorsOptions.java | 136 ++ .../azure/search/models/CustomAnalyzer.java | 207 +++ .../com/azure/search/models/CustomEntity.java | 483 +++++++ .../search/models/CustomEntityAlias.java | 187 +++ .../models/CustomEntityLookupSkill.java | 361 +++++ .../CustomEntityLookupSkillLanguage.java | 100 ++ .../azure/search/models/CustomNormalizer.java | 176 +++ .../models/DataChangeDetectionPolicy.java | 109 ++ .../models/DataDeletionDetectionPolicy.java | 110 ++ .../search/models/DataSourceCredentials.java | 98 ++ .../com/azure/search/models/DebugInfo.java | 80 ++ .../DefaultCognitiveServicesAccount.java | 96 ++ .../DictionaryDecompounderTokenFilter.java | 264 ++++ .../models/DistanceScoringFunction.java | 155 ++ .../models/DistanceScoringParameters.java | 129 ++ .../search/models/DocumentDebugInfo.java | 121 ++ .../models/DocumentExtractionSkill.java | 250 ++++ .../DocumentIntelligenceLayoutSkill.java | 324 +++++ ...lligenceLayoutSkillChunkingProperties.java | 160 +++ ...ntIntelligenceLayoutSkillChunkingUnit.java | 53 + ...elligenceLayoutSkillExtractionOptions.java | 60 + ...ligenceLayoutSkillMarkdownHeaderDepth.java | 83 ++ ...ntIntelligenceLayoutSkillOutputFormat.java | 59 + ...mentIntelligenceLayoutSkillOutputMode.java | 53 + .../search/models/DocumentKeysOrIds.java | 128 ++ .../search/models/EdgeNGramTokenFilter.java | 189 +++ .../models/EdgeNGramTokenFilterSide.java | 57 + .../search/models/EdgeNGramTokenFilterV2.java | 191 +++ .../search/models/EdgeNGramTokenizer.java | 195 +++ .../search/models/ElisionTokenFilter.java | 129 ++ .../azure/search/models/EntityCategory.java | 88 ++ .../search/models/EntityLinkingSkill.java | 255 ++++ .../search/models/EntityRecognitionSkill.java | 293 ++++ .../EntityRecognitionSkillLanguage.java | 184 +++ .../models/EntityRecognitionSkillV3.java | 287 ++++ .../search/models/ErrorAdditionalInfo.java | 98 ++ .../com/azure/search/models/ErrorDetail.java | 156 ++ .../azure/search/models/ErrorResponse.java | 96 ++ .../search/models/ErrorResponseException.java | 43 + .../ExhaustiveKnnAlgorithmConfiguration.java | 130 ++ .../models/ExhaustiveKnnParameters.java | 94 ++ .../com/azure/search/models/FacetResult.java | 239 ++++ .../com/azure/search/models/FieldMapping.java | 158 ++ .../search/models/FieldMappingFunction.java | 129 ++ .../models/FreshnessScoringFunction.java | 155 ++ .../models/FreshnessScoringParameters.java | 99 ++ .../models/GetIndexStatisticsResult.java | 117 ++ .../HighWaterMarkChangeDetectionPolicy.java | 114 ++ .../models/HnswAlgorithmConfiguration.java | 128 ++ .../azure/search/models/HnswParameters.java | 204 +++ .../models/HybridCountAndFacetMode.java | 61 + .../com/azure/search/models/HybridSearch.java | 140 ++ .../search/models/ImageAnalysisSkill.java | 253 ++++ .../models/ImageAnalysisSkillLanguage.java | 358 +++++ .../com/azure/search/models/ImageDetail.java | 58 + .../com/azure/search/models/IndexAction.java | 134 ++ .../azure/search/models/IndexActionType.java | 73 + .../azure/search/models/IndexBatchImpl.java | 96 ++ .../search/models/IndexDocumentsResult.java | 83 ++ .../search/models/IndexProjectionMode.java | 59 + .../search/models/IndexStatisticsSummary.java | 148 ++ .../models/IndexedOneLakeKnowledgeSource.java | 169 +++ ...dexedOneLakeKnowledgeSourceParameters.java | 211 +++ .../IndexedOneLakeKnowledgeSourceParams.java | 153 ++ .../IndexedSharePointContainerName.java | 64 + .../IndexedSharePointKnowledgeSource.java | 170 +++ ...edSharePointKnowledgeSourceParameters.java | 217 +++ ...ndexedSharePointKnowledgeSourceParams.java | 153 ++ .../search/models/IndexerCurrentState.java | 239 ++++ .../models/IndexerExecutionEnvironment.java | 61 + .../search/models/IndexerExecutionResult.java | 290 ++++ .../search/models/IndexerExecutionStatus.java | 68 + .../models/IndexerExecutionStatusDetail.java | 58 + .../models/IndexerPermissionOption.java | 64 + .../search/models/IndexerResyncBody.java | 97 ++ .../search/models/IndexerResyncOption.java | 52 + .../azure/search/models/IndexerRuntime.java | 198 +++ .../azure/search/models/IndexerStatus.java | 62 + .../com/azure/search/models/IndexingMode.java | 65 + .../search/models/IndexingParameters.java | 198 +++ .../IndexingParametersConfiguration.java | 747 ++++++++++ .../azure/search/models/IndexingResult.java | 143 ++ .../azure/search/models/IndexingSchedule.java | 132 ++ .../search/models/InputFieldMappingEntry.java | 190 +++ .../azure/search/models/KeepTokenFilter.java | 160 +++ .../models/KeyPhraseExtractionSkill.java | 254 ++++ .../KeyPhraseExtractionSkillLanguage.java | 142 ++ .../models/KeywordMarkerTokenFilter.java | 162 +++ .../azure/search/models/KeywordTokenizer.java | 126 ++ .../search/models/KeywordTokenizerV2.java | 129 ++ .../azure/search/models/KnowledgeBase.java | 401 ++++++ .../models/KnowledgeBaseActivityRecord.java | 222 +++ ...dgeBaseAgenticReasoningActivityRecord.java | 189 +++ ...owledgeBaseAzureBlobActivityArguments.java | 95 ++ .../KnowledgeBaseAzureBlobActivityRecord.java | 201 +++ .../KnowledgeBaseAzureBlobReference.java | 169 +++ .../models/KnowledgeBaseAzureOpenAIModel.java | 116 ++ .../KnowledgeBaseErrorAdditionalInfo.java | 99 ++ .../models/KnowledgeBaseErrorDetail.java | 157 ++ ...geBaseIndexedOneLakeActivityArguments.java | 95 ++ ...ledgeBaseIndexedOneLakeActivityRecord.java | 202 +++ .../KnowledgeBaseIndexedOneLakeReference.java | 169 +++ ...aseIndexedSharePointActivityArguments.java | 95 ++ ...geBaseIndexedSharePointActivityRecord.java | 202 +++ ...owledgeBaseIndexedSharePointReference.java | 169 +++ .../search/models/KnowledgeBaseMessage.java | 128 ++ .../models/KnowledgeBaseMessageContent.java | 111 ++ .../KnowledgeBaseMessageContentType.java | 58 + .../KnowledgeBaseMessageImageContent.java | 116 ++ ...KnowledgeBaseMessageImageContentImage.java | 96 ++ .../KnowledgeBaseMessageTextContent.java | 115 ++ .../search/models/KnowledgeBaseModel.java | 107 ++ ...aseModelAnswerSynthesisActivityRecord.java | 188 +++ .../search/models/KnowledgeBaseModelKind.java | 52 + ...eBaseModelQueryPlanningActivityRecord.java | 188 +++ .../search/models/KnowledgeBaseReference.java | 244 ++++ ...BaseRemoteSharePointActivityArguments.java | 127 ++ ...dgeBaseRemoteSharePointActivityRecord.java | 202 +++ ...nowledgeBaseRemoteSharePointReference.java | 204 +++ .../KnowledgeBaseRetrievalActivityRecord.java | 260 ++++ .../models/KnowledgeBaseRetrievalRequest.java | 324 +++++ .../KnowledgeBaseRetrievalResponse.java | 163 +++ ...ledgeBaseSearchIndexActivityArguments.java | 126 ++ ...nowledgeBaseSearchIndexActivityRecord.java | 201 +++ .../KnowledgeBaseSearchIndexReference.java | 169 +++ .../KnowledgeBaseWebActivityArguments.java | 218 +++ .../KnowledgeBaseWebActivityRecord.java | 198 +++ .../models/KnowledgeBaseWebReference.java | 198 +++ ...KnowledgeRetrievalHighReasoningEffort.java | 83 ++ .../models/KnowledgeRetrievalIntent.java | 108 ++ .../models/KnowledgeRetrievalIntentType.java | 52 + .../KnowledgeRetrievalLowReasoningEffort.java | 83 ++ ...owledgeRetrievalMediumReasoningEffort.java | 83 ++ ...wledgeRetrievalMinimalReasoningEffort.java | 83 ++ .../models/KnowledgeRetrievalOutputMode.java | 58 + .../KnowledgeRetrievalReasoningEffort.java | 116 ++ ...KnowledgeRetrievalReasoningEffortKind.java | 71 + .../KnowledgeRetrievalSemanticIntent.java | 115 ++ .../azure/search/models/KnowledgeSource.java | 260 ++++ .../KnowledgeSourceAzureOpenAIVectorizer.java | 115 ++ .../KnowledgeSourceContentExtractionMode.java | 59 + .../KnowledgeSourceIngestionParameters.java | 332 +++++ ...wledgeSourceIngestionPermissionOption.java | 65 + .../search/models/KnowledgeSourceKind.java | 82 ++ .../search/models/KnowledgeSourceParams.java | 282 ++++ .../models/KnowledgeSourceReference.java | 94 ++ .../models/KnowledgeSourceStatistics.java | 160 +++ .../search/models/KnowledgeSourceStatus.java | 226 +++ .../KnowledgeSourceSynchronizationStatus.java | 65 + .../models/KnowledgeSourceVectorizer.java | 108 ++ .../search/models/LanguageDetectionSkill.java | 222 +++ .../search/models/LengthTokenFilter.java | 159 +++ .../azure/search/models/LexicalAnalyzer.java | 148 ++ .../search/models/LexicalAnalyzerName.java | 611 ++++++++ .../search/models/LexicalNormalizer.java | 145 ++ .../search/models/LexicalNormalizerName.java | 82 ++ .../azure/search/models/LexicalTokenizer.java | 164 +++ .../search/models/LexicalTokenizerName.java | 136 ++ .../azure/search/models/LimitTokenFilter.java | 160 +++ .../com/azure/search/models/LineEnding.java | 71 + .../search/models/ListAliasesResult.java | 83 ++ .../search/models/ListDataSourcesResult.java | 84 ++ .../search/models/ListIndexStatsSummary.java | 85 ++ .../search/models/ListIndexersResult.java | 83 ++ .../search/models/ListIndexesResult.java | 83 ++ .../models/ListKnowledgeBasesResult.java | 96 ++ .../models/ListKnowledgeSourcesResult.java | 97 ++ .../search/models/ListSkillsetsResult.java | 84 ++ .../search/models/ListSynonymMapsResult.java | 83 ++ .../search/models/LuceneStandardAnalyzer.java | 162 +++ .../models/LuceneStandardTokenizer.java | 128 ++ .../models/LuceneStandardTokenizerV2.java | 129 ++ .../models/MagnitudeScoringFunction.java | 155 ++ .../models/MagnitudeScoringParameters.java | 160 +++ .../search/models/MappingCharFilter.java | 133 ++ .../search/models/MarkdownHeaderDepth.java | 83 ++ .../search/models/MarkdownParsingSubmode.java | 61 + .../com/azure/search/models/MergeSkill.java | 219 +++ .../MicrosoftLanguageStemmingTokenizer.java | 201 +++ .../models/MicrosoftLanguageTokenizer.java | 199 +++ .../MicrosoftStemmingTokenizerLanguage.java | 272 ++++ .../models/MicrosoftTokenizerLanguage.java | 257 ++++ .../azure/search/models/NGramTokenFilter.java | 157 ++ .../search/models/NGramTokenFilterV2.java | 159 +++ .../azure/search/models/NGramTokenizer.java | 194 +++ ...BlobSoftDeleteDeletionDetectionPolicy.java | 83 ++ .../com/azure/search/models/OcrSkill.java | 251 ++++ .../azure/search/models/OcrSkillLanguage.java | 1066 ++++++++++++++ .../models/OutputFieldMappingEntry.java | 125 ++ .../search/models/PIIDetectionSkill.java | 391 +++++ .../models/PIIDetectionSkillMaskingMode.java | 60 + .../models/PathHierarchyTokenizerV2.java | 255 ++++ .../azure/search/models/PatternAnalyzer.java | 225 +++ .../models/PatternCaptureTokenFilter.java | 162 +++ .../models/PatternReplaceCharFilter.java | 160 +++ .../models/PatternReplaceTokenFilter.java | 160 +++ .../azure/search/models/PatternTokenizer.java | 198 +++ .../azure/search/models/PermissionFilter.java | 64 + .../azure/search/models/PhoneticEncoder.java | 102 ++ .../search/models/PhoneticTokenFilter.java | 160 +++ .../search/models/QueryAnswerResult.java | 184 +++ .../azure/search/models/QueryAnswerType.java | 66 + .../search/models/QueryCaptionResult.java | 147 ++ .../azure/search/models/QueryCaptionType.java | 63 + .../azure/search/models/QueryDebugMode.java | 83 ++ .../azure/search/models/QueryLanguage.java | 478 +++++++ .../models/QueryResultDocumentInnerHit.java | 104 ++ .../QueryResultDocumentRerankerInput.java | 119 ++ .../QueryResultDocumentSemanticField.java | 101 ++ .../models/QueryResultDocumentSubscores.java | 121 ++ .../search/models/QueryRewritesDebugInfo.java | 101 ++ .../search/models/QueryRewritesType.java | 61 + .../models/QueryRewritesValuesDebugInfo.java | 102 ++ .../azure/search/models/QuerySpellerType.java | 59 + .../com/azure/search/models/QueryType.java | 67 + .../com/azure/search/models/RankingOrder.java | 58 + .../com/azure/search/models/RegexFlags.java | 95 ++ .../RemoteSharePointKnowledgeSource.java | 170 +++ ...teSharePointKnowledgeSourceParameters.java | 171 +++ ...RemoteSharePointKnowledgeSourceParams.java | 190 +++ .../azure/search/models/RequestOptions.java | 51 + .../azure/search/models/RescoringOptions.java | 173 +++ .../azure/search/models/ResourceCounter.java | 125 ++ ...rQuantizationCompressionConfiguration.java | 186 +++ .../models/ScalarQuantizationParameters.java | 95 ++ .../azure/search/models/ScoringFunction.java | 212 +++ .../models/ScoringFunctionAggregation.java | 77 + .../models/ScoringFunctionInterpolation.java | 69 + .../azure/search/models/ScoringProfile.java | 194 +++ .../search/models/ScoringStatistics.java | 59 + .../com/azure/search/models/SearchAlias.java | 159 +++ .../search/models/SearchDocumentsResult.java | 291 ++++ .../com/azure/search/models/SearchField.java | 855 +++++++++++ .../search/models/SearchFieldDataType.java | 126 ++ .../com/azure/search/models/SearchIndex.java | 699 +++++++++ .../models/SearchIndexKnowledgeSource.java | 168 +++ .../SearchIndexKnowledgeSourceParameters.java | 199 +++ ...ledgeSourceParametersSearchFieldsItem.java | 97 ++ ...eSourceParametersSourceDataFieldsItem.java | 98 ++ .../SearchIndexKnowledgeSourceParams.java | 184 +++ .../SearchIndexPermissionFilterOption.java | 58 + .../azure/search/models/SearchIndexer.java | 498 +++++++ .../search/models/SearchIndexerCache.java | 197 +++ .../models/SearchIndexerDataContainer.java | 131 ++ .../models/SearchIndexerDataIdentity.java | 109 ++ .../models/SearchIndexerDataNoneIdentity.java | 82 ++ .../models/SearchIndexerDataSource.java | 456 ++++++ .../models/SearchIndexerDataSourceType.java | 94 ++ ...SearchIndexerDataUserAssignedIdentity.java | 122 ++ .../search/models/SearchIndexerError.java | 179 +++ .../SearchIndexerIndexProjectionSelector.java | 202 +++ .../models/SearchIndexerIndexProjections.java | 133 ++ ...archIndexerIndexProjectionsParameters.java | 144 ++ .../models/SearchIndexerKnowledgeStore.java | 205 +++ ...rKnowledgeStoreBlobProjectionSelector.java | 164 +++ ...rKnowledgeStoreFileProjectionSelector.java | 148 ++ ...nowledgeStoreObjectProjectionSelector.java | 150 ++ ...SearchIndexerKnowledgeStoreParameters.java | 143 ++ ...SearchIndexerKnowledgeStoreProjection.java | 167 +++ ...dexerKnowledgeStoreProjectionSelector.java | 222 +++ ...KnowledgeStoreTableProjectionSelector.java | 166 +++ .../search/models/SearchIndexerLimits.java | 121 ++ .../search/models/SearchIndexerSkill.java | 329 +++++ .../search/models/SearchIndexerSkillset.java | 334 +++++ .../search/models/SearchIndexerStatus.java | 194 +++ .../search/models/SearchIndexerWarning.java | 158 ++ .../com/azure/search/models/SearchMode.java | 57 + .../azure/search/models/SearchOptions.java | 975 +++++++++++++ .../azure/search/models/SearchRequest.java | 1208 ++++++++++++++++ .../models/SearchResourceEncryptionKey.java | 235 +++ .../com/azure/search/models/SearchResult.java | 229 +++ .../search/models/SearchScoreThreshold.java | 120 ++ .../search/models/SemanticConfiguration.java | 195 +++ .../search/models/SemanticDebugInfo.java | 142 ++ .../search/models/SemanticErrorMode.java | 60 + .../search/models/SemanticErrorReason.java | 65 + .../azure/search/models/SemanticField.java | 94 ++ .../search/models/SemanticFieldState.java | 64 + .../models/SemanticPrioritizedFields.java | 179 +++ .../SemanticQueryRewritesResultType.java | 53 + .../azure/search/models/SemanticSearch.java | 131 ++ .../models/SemanticSearchResultsType.java | 59 + .../azure/search/models/SentimentSkill.java | 185 +++ .../search/models/SentimentSkillLanguage.java | 136 ++ .../azure/search/models/SentimentSkillV3.java | 257 ++++ .../azure/search/models/ServiceCounters.java | 344 +++++ .../search/models/ServiceIndexersRuntime.java | 200 +++ .../azure/search/models/ServiceLimits.java | 262 ++++ .../search/models/ServiceStatistics.java | 157 ++ .../com/azure/search/models/ShaperSkill.java | 153 ++ .../SharePointSensitivityLabelInfo.java | 249 ++++ .../search/models/ShingleTokenFilter.java | 294 ++++ .../com/azure/search/models/Similarity.java | 111 ++ .../models/SingleVectorFieldResult.java | 104 ++ .../com/azure/search/models/SkillNames.java | 95 ++ .../search/models/SnowballTokenFilter.java | 127 ++ .../models/SnowballTokenFilterLanguage.java | 157 ++ ...ftDeleteColumnDeletionDetectionPolicy.java | 145 ++ .../com/azure/search/models/SplitSkill.java | 392 +++++ .../models/SplitSkillEncoderModelName.java | 71 + .../search/models/SplitSkillLanguage.java | 244 ++++ .../azure/search/models/SplitSkillUnit.java | 58 + .../SqlIntegratedChangeTrackingPolicy.java | 83 ++ .../models/StemmerOverrideTokenFilter.java | 132 ++ .../search/models/StemmerTokenFilter.java | 126 ++ .../models/StemmerTokenFilterLanguage.java | 317 ++++ .../com/azure/search/models/StopAnalyzer.java | 129 ++ .../azure/search/models/StopwordsList.java | 202 +++ .../search/models/StopwordsTokenFilter.java | 232 +++ .../search/models/SuggestDocumentsResult.java | 103 ++ .../azure/search/models/SuggestOptions.java | 315 ++++ .../azure/search/models/SuggestRequest.java | 449 ++++++ .../azure/search/models/SuggestResult.java | 124 ++ .../com/azure/search/models/Suggester.java | 146 ++ .../search/models/SynchronizationState.java | 194 +++ .../com/azure/search/models/SynonymMap.java | 223 +++ .../search/models/SynonymTokenFilter.java | 214 +++ .../search/models/TagScoringFunction.java | 155 ++ .../search/models/TagScoringParameters.java | 97 ++ .../com/azure/search/models/TextResult.java | 80 ++ .../azure/search/models/TextSplitMode.java | 58 + .../search/models/TextTranslationSkill.java | 260 ++++ .../models/TextTranslationSkillLanguage.java | 478 +++++++ .../com/azure/search/models/TextWeights.java | 99 ++ .../search/models/TokenCharacterKind.java | 72 + .../com/azure/search/models/TokenFilter.java | 190 +++ .../azure/search/models/TokenFilterName.java | 286 ++++ .../search/models/TruncateTokenFilter.java | 126 ++ .../search/models/UaxUrlEmailTokenizer.java | 129 ++ .../search/models/UniqueTokenFilter.java | 128 ++ .../search/models/VectorEncodingFormat.java | 52 + .../azure/search/models/VectorFilterMode.java | 66 + .../com/azure/search/models/VectorQuery.java | 399 ++++++ .../azure/search/models/VectorQueryKind.java | 70 + .../com/azure/search/models/VectorSearch.java | 199 +++ .../VectorSearchAlgorithmConfiguration.java | 143 ++ .../models/VectorSearchAlgorithmKind.java | 58 + .../models/VectorSearchAlgorithmMetric.java | 75 + .../VectorSearchCompressionConfiguration.java | 301 ++++ .../models/VectorSearchCompressionKind.java | 62 + ...SearchCompressionRescoreStorageMethod.java | 63 + ...VectorSearchCompressionTargetDataType.java | 53 + .../search/models/VectorSearchProfile.java | 191 +++ .../search/models/VectorSearchVectorizer.java | 145 ++ .../models/VectorSearchVectorizerKind.java | 71 + .../models/VectorSimilarityThreshold.java | 121 ++ .../azure/search/models/VectorThreshold.java | 109 ++ .../search/models/VectorThresholdKind.java | 62 + .../models/VectorizableImageBinaryQuery.java | 220 +++ .../models/VectorizableImageUrlQuery.java | 218 +++ .../search/models/VectorizableTextQuery.java | 250 ++++ .../azure/search/models/VectorizedQuery.java | 219 +++ .../azure/search/models/VectorsDebugInfo.java | 81 ++ .../search/models/VisionVectorizeSkill.java | 187 +++ .../azure/search/models/VisualFeature.java | 88 ++ .../azure/search/models/WebApiParameters.java | 275 ++++ .../com/azure/search/models/WebApiSkill.java | 451 ++++++ .../azure/search/models/WebApiVectorizer.java | 127 ++ .../search/models/WebKnowledgeSource.java | 165 +++ .../models/WebKnowledgeSourceDomain.java | 125 ++ .../models/WebKnowledgeSourceDomains.java | 131 ++ .../models/WebKnowledgeSourceParameters.java | 93 ++ .../models/WebKnowledgeSourceParams.java | 274 ++++ .../models/WordDelimiterTokenFilter.java | 433 ++++++ .../com/azure/search/models/package-info.java | 10 + .../java/com/azure/search/package-info.java | 10 + .../documents/util/SearchPagedFlux.java | 81 +- .../documents/util/SearchPagedIterable.java | 70 +- .../src/main/java/module-info.java | 20 - 438 files changed, 77933 insertions(+), 30 deletions(-) create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Aliases.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/DataSources.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Documents.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Indexers.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Indexes.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/KnowledgeBases.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/KnowledgeRetrievals.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/KnowledgeSources.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/SearchClient.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/SearchClientBuilder.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Skillsets.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/SynonymMaps.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/implementation/models/AnalyzeResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/implementation/models/package-info.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIFoundryModelCatalogName.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServices.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServicesAccountIdentity.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServicesAccountKey.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServicesVisionParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServicesVisionVectorizer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AMLParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AMLVectorizer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AnalyzeRequest.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AnalyzedTokenInfo.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AsciiFoldingTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteItem.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteMode.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteOptions.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteRequest.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureActiveDirectoryApplicationCredentials.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureBlobKnowledgeSource.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureBlobKnowledgeSourceParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureBlobKnowledgeSourceParams.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureMachineLearningSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureOpenAIEmbeddingSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureOpenAIModelName.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureOpenAIParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureOpenAITokenizerParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureOpenAIVectorizer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BM25Similarity.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BinaryQuantizationCompressionConfiguration.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BlobIndexerDataToExtract.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BlobIndexerImageAction.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BlobIndexerPDFTextRotationAlgorithm.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BlobIndexerParsingMode.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CharFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CharFilterName.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionExtraParametersBehavior.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionResponseFormat.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionResponseFormatJsonSchemaProperties.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionResponseFormatType.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionSchema.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CjkBigramTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CjkBigramTokenFilterScripts.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ClassicSimilarity.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ClassicTokenizer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CognitiveServicesAccount.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CognitiveServicesAccountKey.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CommonGramTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CommonModelParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CompletedSynchronizationState.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ConditionalSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ContentUnderstandingSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ContentUnderstandingSkillChunkingProperties.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ContentUnderstandingSkillChunkingUnit.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ContentUnderstandingSkillExtractionOptions.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CorsOptions.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomAnalyzer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomEntity.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomEntityAlias.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomEntityLookupSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomEntityLookupSkillLanguage.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomNormalizer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DataChangeDetectionPolicy.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DataDeletionDetectionPolicy.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DataSourceCredentials.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DebugInfo.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DefaultCognitiveServicesAccount.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DictionaryDecompounderTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DistanceScoringFunction.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DistanceScoringParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentDebugInfo.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentExtractionSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillChunkingProperties.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillChunkingUnit.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillExtractionOptions.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillMarkdownHeaderDepth.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillOutputFormat.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillOutputMode.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentKeysOrIds.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EdgeNGramTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EdgeNGramTokenFilterSide.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EdgeNGramTokenFilterV2.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EdgeNGramTokenizer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ElisionTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityCategory.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityLinkingSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityRecognitionSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityRecognitionSkillLanguage.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityRecognitionSkillV3.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ErrorAdditionalInfo.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ErrorDetail.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ErrorResponse.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ErrorResponseException.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ExhaustiveKnnAlgorithmConfiguration.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ExhaustiveKnnParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FacetResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FieldMapping.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FieldMappingFunction.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FreshnessScoringFunction.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FreshnessScoringParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/GetIndexStatisticsResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HighWaterMarkChangeDetectionPolicy.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HnswAlgorithmConfiguration.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HnswParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HybridCountAndFacetMode.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HybridSearch.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ImageAnalysisSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ImageAnalysisSkillLanguage.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ImageDetail.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexAction.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexActionType.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexBatchImpl.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexDocumentsResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexProjectionMode.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexStatisticsSummary.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedOneLakeKnowledgeSource.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedOneLakeKnowledgeSourceParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedOneLakeKnowledgeSourceParams.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedSharePointContainerName.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedSharePointKnowledgeSource.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedSharePointKnowledgeSourceParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedSharePointKnowledgeSourceParams.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerCurrentState.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerExecutionEnvironment.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerExecutionResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerExecutionStatus.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerExecutionStatusDetail.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerPermissionOption.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerResyncBody.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerResyncOption.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerRuntime.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerStatus.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingMode.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingParametersConfiguration.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingSchedule.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/InputFieldMappingEntry.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeepTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeyPhraseExtractionSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeyPhraseExtractionSkillLanguage.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeywordMarkerTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeywordTokenizer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeywordTokenizerV2.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBase.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseActivityRecord.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAgenticReasoningActivityRecord.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAzureBlobActivityArguments.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAzureBlobActivityRecord.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAzureBlobReference.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAzureOpenAIModel.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseErrorAdditionalInfo.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseErrorDetail.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedOneLakeActivityArguments.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedOneLakeActivityRecord.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedOneLakeReference.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedSharePointActivityArguments.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedSharePointActivityRecord.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedSharePointReference.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessage.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageContent.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageContentType.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageImageContent.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageImageContentImage.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageTextContent.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseModel.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseModelAnswerSynthesisActivityRecord.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseModelKind.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseModelQueryPlanningActivityRecord.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseReference.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRemoteSharePointActivityArguments.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRemoteSharePointActivityRecord.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRemoteSharePointReference.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRetrievalActivityRecord.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRetrievalRequest.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRetrievalResponse.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseSearchIndexActivityArguments.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseSearchIndexActivityRecord.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseSearchIndexReference.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseWebActivityArguments.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseWebActivityRecord.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseWebReference.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalHighReasoningEffort.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalIntent.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalIntentType.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalLowReasoningEffort.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalMediumReasoningEffort.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalMinimalReasoningEffort.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalOutputMode.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalReasoningEffort.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalReasoningEffortKind.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalSemanticIntent.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSource.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceAzureOpenAIVectorizer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceContentExtractionMode.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceIngestionParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceIngestionPermissionOption.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceKind.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceParams.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceReference.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceStatistics.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceStatus.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceSynchronizationStatus.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceVectorizer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LanguageDetectionSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LengthTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalAnalyzer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalAnalyzerName.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalNormalizer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalNormalizerName.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalTokenizer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalTokenizerName.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LimitTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LineEnding.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListAliasesResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListDataSourcesResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListIndexStatsSummary.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListIndexersResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListIndexesResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListKnowledgeBasesResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListKnowledgeSourcesResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListSkillsetsResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListSynonymMapsResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LuceneStandardAnalyzer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LuceneStandardTokenizer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LuceneStandardTokenizerV2.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MagnitudeScoringFunction.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MagnitudeScoringParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MappingCharFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MarkdownHeaderDepth.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MarkdownParsingSubmode.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MergeSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MicrosoftLanguageStemmingTokenizer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MicrosoftLanguageTokenizer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MicrosoftStemmingTokenizerLanguage.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MicrosoftTokenizerLanguage.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/NGramTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/NGramTokenFilterV2.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/NGramTokenizer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/NativeBlobSoftDeleteDeletionDetectionPolicy.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/OcrSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/OcrSkillLanguage.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/OutputFieldMappingEntry.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PIIDetectionSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PIIDetectionSkillMaskingMode.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PathHierarchyTokenizerV2.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternAnalyzer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternCaptureTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternReplaceCharFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternReplaceTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternTokenizer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PermissionFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PhoneticEncoder.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PhoneticTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryAnswerResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryAnswerType.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryCaptionResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryCaptionType.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryDebugMode.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryLanguage.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryResultDocumentInnerHit.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryResultDocumentRerankerInput.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryResultDocumentSemanticField.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryResultDocumentSubscores.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryRewritesDebugInfo.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryRewritesType.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryRewritesValuesDebugInfo.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QuerySpellerType.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryType.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RankingOrder.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RegexFlags.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RemoteSharePointKnowledgeSource.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RemoteSharePointKnowledgeSourceParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RemoteSharePointKnowledgeSourceParams.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RequestOptions.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RescoringOptions.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ResourceCounter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScalarQuantizationCompressionConfiguration.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScalarQuantizationParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringFunction.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringFunctionAggregation.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringFunctionInterpolation.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringProfile.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringStatistics.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchAlias.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchDocumentsResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchField.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchFieldDataType.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndex.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSource.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSourceParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSourceParametersSearchFieldsItem.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSourceParametersSourceDataFieldsItem.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSourceParams.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexPermissionFilterOption.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerCache.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataContainer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataIdentity.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataNoneIdentity.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataSource.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataSourceType.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataUserAssignedIdentity.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerError.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerIndexProjectionSelector.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerIndexProjections.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerIndexProjectionsParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStore.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreBlobProjectionSelector.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreFileProjectionSelector.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreObjectProjectionSelector.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreProjection.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreProjectionSelector.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreTableProjectionSelector.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerLimits.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerSkillset.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerStatus.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerWarning.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchMode.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchOptions.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchRequest.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchResourceEncryptionKey.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchScoreThreshold.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticConfiguration.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticDebugInfo.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticErrorMode.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticErrorReason.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticField.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticFieldState.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticPrioritizedFields.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticQueryRewritesResultType.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticSearch.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticSearchResultsType.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SentimentSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SentimentSkillLanguage.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SentimentSkillV3.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ServiceCounters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ServiceIndexersRuntime.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ServiceLimits.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ServiceStatistics.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ShaperSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SharePointSensitivityLabelInfo.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ShingleTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/Similarity.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SingleVectorFieldResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SkillNames.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SnowballTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SnowballTokenFilterLanguage.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SoftDeleteColumnDeletionDetectionPolicy.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SplitSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SplitSkillEncoderModelName.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SplitSkillLanguage.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SplitSkillUnit.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SqlIntegratedChangeTrackingPolicy.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StemmerOverrideTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StemmerTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StemmerTokenFilterLanguage.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StopAnalyzer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StopwordsList.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StopwordsTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SuggestDocumentsResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SuggestOptions.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SuggestRequest.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SuggestResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/Suggester.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SynchronizationState.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SynonymMap.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SynonymTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TagScoringFunction.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TagScoringParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TextResult.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TextSplitMode.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TextTranslationSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TextTranslationSkillLanguage.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TextWeights.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TokenCharacterKind.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TokenFilterName.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TruncateTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/UaxUrlEmailTokenizer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/UniqueTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorEncodingFormat.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorFilterMode.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorQuery.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorQueryKind.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearch.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchAlgorithmConfiguration.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchAlgorithmKind.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchAlgorithmMetric.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchCompressionConfiguration.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchCompressionKind.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchCompressionRescoreStorageMethod.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchCompressionTargetDataType.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchProfile.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchVectorizer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchVectorizerKind.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSimilarityThreshold.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorThreshold.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorThresholdKind.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorizableImageBinaryQuery.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorizableImageUrlQuery.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorizableTextQuery.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorizedQuery.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorsDebugInfo.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VisionVectorizeSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VisualFeature.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebApiParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebApiSkill.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebApiVectorizer.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSource.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSourceDomain.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSourceDomains.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSourceParameters.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSourceParams.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WordDelimiterTokenFilter.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/package-info.java create mode 100644 sdk/search/azure-search-documents/search/src/main/java/com/azure/search/package-info.java delete mode 100644 sdk/search/azure-search-documents/src/main/java/module-info.java diff --git a/sdk/search/azure-search-documents/pom.xml b/sdk/search/azure-search-documents/pom.xml index 6b2f7beeeda1..c78615854dba 100644 --- a/sdk/search/azure-search-documents/pom.xml +++ b/sdk/search/azure-search-documents/pom.xml @@ -107,4 +107,22 @@ test + + + + + org.revapi + revapi-maven-plugin + + + com.azure:azure-search-documents:11.7.10 + + + com.azure:azure-search-documents:11.8.0-beta.9 + + true + + + + diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Aliases.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Aliases.java new file mode 100644 index 000000000000..65dfb0b12c73 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Aliases.java @@ -0,0 +1,491 @@ +// 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; + +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.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.models.ErrorResponseException; +import com.azure.search.models.ListAliasesResult; +import com.azure.search.models.RequestOptions; +import com.azure.search.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 Aliases { + /** + * The proxy service used to perform REST calls. + */ + private final AliasesService service; + + /** + * The service client containing this operation class. + */ + private final SearchClient client; + + /** + * Initializes an instance of Aliases. + * + * @param client the instance of the service client containing this operation class. + */ + Aliases(SearchClient client) { + this.service = RestProxy.create(AliasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchClientAliases to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SearchClientAliases") + 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, @BodyParam("application/json") SearchAlias alias, + @HeaderParam("Accept") String accept, 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); + + @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, + @BodyParam("application/json") SearchAlias alias, @HeaderParam("Accept") String accept, 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); + + @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); + } + + /** + * 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) { + return FluxUtil.withContext(context -> createWithResponseAsync(alias, requestOptions, 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"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.create(this.client.getEndpoint(), xMsClientRequestId, this.client.getApiVersion(), alias, accept, + 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())); + } + + /** + * 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"; + 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. + * @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)); + } + + /** + * 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) { + return FluxUtil.withContext(context -> createOrUpdateWithResponseAsync(aliasName, alias, ifMatch, ifNoneMatch, + 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. + * @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"; + 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(), alias, accept, 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())); + } + + /** + * 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) { + return FluxUtil + .withContext(context -> deleteWithResponseAsync(aliasName, ifMatch, ifNoneMatch, requestOptions, 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"; + 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()); + } + + /** + * 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) { + return FluxUtil.withContext(context -> getWithResponseAsync(aliasName, requestOptions, 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"; + 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())); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/DataSources.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/DataSources.java new file mode 100644 index 000000000000..401f098f1822 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/DataSources.java @@ -0,0 +1,545 @@ +// 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; + +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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.search.models.ErrorResponseException; +import com.azure.search.models.ListDataSourcesResult; +import com.azure.search.models.RequestOptions; +import com.azure.search.models.SearchIndexerDataSource; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DataSources. + */ +public final class DataSources { + /** + * The proxy service used to perform REST calls. + */ + private final DataSourcesService service; + + /** + * The service client containing this operation class. + */ + private final SearchClient client; + + /** + * Initializes an instance of DataSources. + * + * @param client the instance of the service client containing this operation class. + */ + DataSources(SearchClient client) { + this.service + = RestProxy.create(DataSourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchClientDataSources to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SearchClientDataSources") + public interface DataSourcesService { + @Put("/datasources('{dataSourceName}')") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @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, + @QueryParam("ignoreResetRequirements") Boolean skipIndexerResetRequirementForCache, + @BodyParam("application/json") SearchIndexerDataSource dataSource, @HeaderParam("Accept") String accept, + Context context); + + @Delete("/datasources('{dataSourceName}')") + @ExpectedResponses({ 204, 404 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @PathParam("dataSourceName") String dataSourceName, + @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("/datasources('{dataSourceName}')") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @PathParam("dataSourceName") String dataSourceName, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Get("/datasources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("$select") String select, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Post("/datasources") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SearchIndexerDataSource dataSource, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates a new datasource or updates a datasource if it already exists. + * + * @param dataSourceName The name of the datasource to create or update. + * @param dataSource The definition of the datasource 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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a datasource definition, which can be used to configure an indexer along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync(String dataSourceName, + SearchIndexerDataSource dataSource, String ifMatch, String ifNoneMatch, + Boolean skipIndexerResetRequirementForCache, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> createOrUpdateWithResponseAsync(dataSourceName, dataSource, ifMatch, + ifNoneMatch, skipIndexerResetRequirementForCache, requestOptions, context)); + } + + /** + * Creates a new datasource or updates a datasource if it already exists. + * + * @param dataSourceName The name of the datasource to create or update. + * @param dataSource The definition of the datasource 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 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. + * @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 a datasource definition, which can be used to configure an indexer along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync(String dataSourceName, + SearchIndexerDataSource dataSource, String ifMatch, String ifNoneMatch, + Boolean skipIndexerResetRequirementForCache, RequestOptions requestOptions, Context context) { + final String prefer = "return=representation"; + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.createOrUpdate(this.client.getEndpoint(), dataSourceName, xMsClientRequestId, ifMatch, + ifNoneMatch, prefer, this.client.getApiVersion(), skipIndexerResetRequirementForCache, dataSource, accept, + context); + } + + /** + * Creates a new datasource or updates a datasource if it already exists. + * + * @param dataSourceName The name of the datasource to create or update. + * @param dataSource The definition of the datasource 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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a datasource definition, which can be used to configure an indexer on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String dataSourceName, SearchIndexerDataSource dataSource, + String ifMatch, String ifNoneMatch, Boolean skipIndexerResetRequirementForCache, + RequestOptions requestOptions) { + return createOrUpdateWithResponseAsync(dataSourceName, dataSource, ifMatch, ifNoneMatch, + skipIndexerResetRequirementForCache, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new datasource or updates a datasource if it already exists. + * + * @param dataSourceName The name of the datasource to create or update. + * @param dataSource The definition of the datasource 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 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. + * @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 a datasource definition, which can be used to configure an indexer on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String dataSourceName, SearchIndexerDataSource 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())); + } + + /** + * Deletes a datasource. + * + * @param dataSourceName The name of the datasource 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 dataSourceName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> deleteWithResponseAsync(dataSourceName, ifMatch, ifNoneMatch, requestOptions, context)); + } + + /** + * Deletes a datasource. + * + * @param dataSourceName The name of the datasource 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 dataSourceName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.delete(this.client.getEndpoint(), dataSourceName, xMsClientRequestId, ifMatch, ifNoneMatch, + this.client.getApiVersion(), accept, context); + } + + /** + * Deletes a datasource. + * + * @param dataSourceName The name of the datasource 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 dataSourceName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions) { + return deleteWithResponseAsync(dataSourceName, ifMatch, ifNoneMatch, requestOptions) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a datasource. + * + * @param dataSourceName The name of the datasource 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 dataSourceName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions, Context context) { + return deleteWithResponseAsync(dataSourceName, ifMatch, ifNoneMatch, requestOptions, context) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Retrieves a datasource definition. + * + * @param dataSourceName The name of the datasource 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 a datasource definition, which can be used to configure an indexer along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String dataSourceName, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> getWithResponseAsync(dataSourceName, requestOptions, context)); + } + + /** + * Retrieves a datasource definition. + * + * @param dataSourceName The name of the datasource 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 a datasource definition, which can be used to configure an indexer along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String dataSourceName, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.get(this.client.getEndpoint(), dataSourceName, xMsClientRequestId, this.client.getApiVersion(), + accept, context); + } + + /** + * Retrieves a datasource definition. + * + * @param dataSourceName The name of the datasource 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 a datasource definition, which can be used to configure an indexer on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String dataSourceName, RequestOptions requestOptions) { + return getWithResponseAsync(dataSourceName, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves a datasource definition. + * + * @param dataSourceName The name of the datasource 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 a datasource definition, which can be used to configure an indexer on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String dataSourceName, RequestOptions requestOptions, + Context context) { + return getWithResponseAsync(dataSourceName, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Lists all datasources available for a search service. + * + * @param select Selects which top-level properties of the data sources to retrieve. Specified as a comma-separated + * list of JSON property names, or '*' for all properties. The default is all properties. + * @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 Datasources request along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(String select, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> listWithResponseAsync(select, requestOptions, context)); + } + + /** + * Lists all datasources available for a search service. + * + * @param select Selects which top-level properties of the data sources to retrieve. Specified as a comma-separated + * list of JSON property names, or '*' for all properties. The default is all properties. + * @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 Datasources request along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(String select, RequestOptions requestOptions, + Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.list(this.client.getEndpoint(), select, xMsClientRequestId, this.client.getApiVersion(), accept, + context); + } + + /** + * Lists all datasources available for a search service. + * + * @param select Selects which top-level properties of the data sources to retrieve. Specified as a comma-separated + * list of JSON property names, or '*' for all properties. The default is all properties. + * @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 Datasources request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listAsync(String select, RequestOptions requestOptions) { + return listWithResponseAsync(select, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Lists all datasources available for a search service. + * + * @param select Selects which top-level properties of the data sources to retrieve. Specified as a comma-separated + * list of JSON property names, or '*' for all properties. The default is all properties. + * @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 Datasources request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listAsync(String select, RequestOptions requestOptions, Context context) { + return listWithResponseAsync(select, requestOptions, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new datasource. + * + * @param dataSource The definition of the datasource 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 a datasource definition, which can be used to configure an indexer along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(SearchIndexerDataSource dataSource, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> createWithResponseAsync(dataSource, requestOptions, context)); + } + + /** + * Creates a new datasource. + * + * @param dataSource The definition of the datasource 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 a datasource definition, which can be used to configure an indexer along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(SearchIndexerDataSource dataSource, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.create(this.client.getEndpoint(), xMsClientRequestId, this.client.getApiVersion(), dataSource, + accept, context); + } + + /** + * Creates a new datasource. + * + * @param dataSource The definition of the datasource 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 a datasource definition, which can be used to configure an indexer on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync(SearchIndexerDataSource dataSource, + RequestOptions requestOptions) { + return createWithResponseAsync(dataSource, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new datasource. + * + * @param dataSource The definition of the datasource 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 a datasource definition, which can be used to configure an indexer on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync(SearchIndexerDataSource dataSource, RequestOptions requestOptions, + Context context) { + return createWithResponseAsync(dataSource, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Documents.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Documents.java new file mode 100644 index 000000000000..1755cfd4dc65 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Documents.java @@ -0,0 +1,1271 @@ +// 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; + +import com.azure.core.annotation.BodyParam; +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.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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.search.models.AutocompleteMode; +import com.azure.search.models.AutocompleteOptions; +import com.azure.search.models.AutocompleteRequest; +import com.azure.search.models.AutocompleteResult; +import com.azure.search.models.ErrorResponseException; +import com.azure.search.models.IndexBatchImpl; +import com.azure.search.models.IndexDocumentsResult; +import com.azure.search.models.QueryAnswerType; +import com.azure.search.models.QueryCaptionType; +import com.azure.search.models.QueryDebugMode; +import com.azure.search.models.QueryLanguage; +import com.azure.search.models.QueryRewritesType; +import com.azure.search.models.QuerySpellerType; +import com.azure.search.models.QueryType; +import com.azure.search.models.RequestOptions; +import com.azure.search.models.ScoringStatistics; +import com.azure.search.models.SearchDocumentsResult; +import com.azure.search.models.SearchMode; +import com.azure.search.models.SearchOptions; +import com.azure.search.models.SearchRequest; +import com.azure.search.models.SemanticErrorMode; +import com.azure.search.models.SuggestDocumentsResult; +import com.azure.search.models.SuggestOptions; +import com.azure.search.models.SuggestRequest; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Documents. + */ +public final class Documents { + /** + * The proxy service used to perform REST calls. + */ + private final DocumentsService service; + + /** + * The service client containing this operation class. + */ + private final SearchClient client; + + /** + * Initializes an instance of Documents. + * + * @param client the instance of the service client containing this operation class. + */ + Documents(SearchClient client) { + this.service + = RestProxy.create(DocumentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchClientDocuments to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}/indexes('{indexName}')") + @ServiceInterface(name = "SearchClientDocuments") + public interface DocumentsService { + @Get("/docs/$count") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> count(@HostParam("endpoint") String endpoint, @HostParam("indexName") String indexName, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Get("/docs") + @ExpectedResponses({ 200, 206 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> searchGet(@HostParam("endpoint") String endpoint, + @HostParam("indexName") String indexName, @QueryParam("search") String searchText, + @QueryParam("$count") Boolean includeTotalResultCount, + @QueryParam(value = "facet", multipleQueryParams = true) List facets, + @QueryParam("$filter") String filter, @QueryParam("highlight") String highlightFields, + @QueryParam("highlightPostTag") String highlightPostTag, + @QueryParam("highlightPreTag") String highlightPreTag, + @QueryParam("minimumCoverage") Double minimumCoverage, @QueryParam("$orderby") String orderBy, + @QueryParam("queryType") QueryType queryType, + @QueryParam(value = "scoringParameter", multipleQueryParams = true) List scoringParameters, + @QueryParam("scoringProfile") String scoringProfile, @QueryParam("searchFields") String searchFields, + @QueryParam("searchMode") SearchMode searchMode, + @QueryParam("scoringStatistics") ScoringStatistics scoringStatistics, + @QueryParam("sessionId") String sessionId, @QueryParam("$select") String select, + @QueryParam("$skip") Integer skip, @QueryParam("$top") Integer top, + @QueryParam("api-version") String apiVersion, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("semanticConfiguration") String semanticConfiguration, + @QueryParam("semanticErrorHandling") SemanticErrorMode semanticErrorHandling, + @QueryParam("semanticMaxWaitInMilliseconds") Integer semanticMaxWaitInMilliseconds, + @QueryParam("answers") QueryAnswerType answers, @QueryParam("captions") QueryCaptionType captions, + @QueryParam("semanticQuery") String semanticQuery, + @QueryParam("queryRewrites") QueryRewritesType queryRewrites, @QueryParam("debug") QueryDebugMode debug, + @QueryParam("queryLanguage") QueryLanguage queryLanguage, @QueryParam("speller") QuerySpellerType speller, + @QueryParam("semanticFields") String semanticFields, + @HeaderParam("x-ms-query-source-authorization") String xMsQuerySourceAuthorization, + @HeaderParam("x-ms-enable-elevated-read") Boolean xMsEnableElevatedRead, + @HeaderParam("Accept") String accept, Context context); + + @Post("/docs/search.post.search") + @ExpectedResponses({ 200, 206 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> searchPost(@HostParam("endpoint") String endpoint, + @HostParam("indexName") String indexName, @QueryParam("api-version") String apiVersion, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @HeaderParam("x-ms-query-source-authorization") String xMsQuerySourceAuthorization, + @HeaderParam("x-ms-enable-elevated-read") Boolean xMsEnableElevatedRead, + @BodyParam("application/json") SearchRequest searchRequest, @HeaderParam("Accept") String accept, + Context context); + + @Get("/docs('{key}')") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono>> get(@HostParam("endpoint") String endpoint, + @HostParam("indexName") String indexName, @PathParam("key") String key, + @QueryParam("$select") String selectedFields, @QueryParam("api-version") String apiVersion, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @HeaderParam("x-ms-query-source-authorization") String xMsQuerySourceAuthorization, + @HeaderParam("x-ms-enable-elevated-read") Boolean xMsEnableElevatedRead, + @HeaderParam("Accept") String accept, Context context); + + @Get("/docs/search.suggest") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> suggestGet(@HostParam("endpoint") String endpoint, + @HostParam("indexName") String indexName, @QueryParam("search") String searchText, + @QueryParam("suggesterName") String suggesterName, @QueryParam("$filter") String filter, + @QueryParam("fuzzy") Boolean useFuzzyMatching, @QueryParam("highlightPostTag") String highlightPostTag, + @QueryParam("highlightPreTag") String highlightPreTag, + @QueryParam("minimumCoverage") Double minimumCoverage, @QueryParam("$orderby") String orderBy, + @QueryParam("searchFields") String searchFields, @QueryParam("$select") String select, + @QueryParam("$top") Integer top, @QueryParam("api-version") String apiVersion, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, @HeaderParam("Accept") String accept, + Context context); + + @Post("/docs/search.post.suggest") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> suggestPost(@HostParam("endpoint") String endpoint, + @HostParam("indexName") String indexName, @QueryParam("api-version") String apiVersion, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @BodyParam("application/json") SuggestRequest suggestRequest, @HeaderParam("Accept") String accept, + Context context); + + @Post("/docs/search.index") + @ExpectedResponses({ 200, 207 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> index(@HostParam("endpoint") String endpoint, + @HostParam("indexName") String indexName, @QueryParam("api-version") String apiVersion, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @BodyParam("application/json") IndexBatchImpl batch, @HeaderParam("Accept") String accept, Context context); + + @Get("/docs/search.autocomplete") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> autocompleteGet(@HostParam("endpoint") String endpoint, + @HostParam("indexName") String indexName, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @QueryParam("search") String searchText, + @QueryParam("suggesterName") String suggesterName, + @QueryParam("autocompleteMode") AutocompleteMode autocompleteMode, @QueryParam("$filter") String filter, + @QueryParam("fuzzy") Boolean useFuzzyMatching, @QueryParam("highlightPostTag") String highlightPostTag, + @QueryParam("highlightPreTag") String highlightPreTag, + @QueryParam("minimumCoverage") Double minimumCoverage, @QueryParam("searchFields") String searchFields, + @QueryParam("$top") Integer top, @HeaderParam("Accept") String accept, Context context); + + @Post("/docs/search.post.autocomplete") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> autocompletePost(@HostParam("endpoint") String endpoint, + @HostParam("indexName") String indexName, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AutocompleteRequest autocompleteRequest, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Queries the number of documents in the index. + * + * @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 response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> countWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> countWithResponseAsync(requestOptions, context)); + } + + /** + * Queries the number of documents in the index. + * + * @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 response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> countWithResponseAsync(RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.count(this.client.getEndpoint(), this.client.getIndexName(), xMsClientRequestId, + this.client.getApiVersion(), accept, context); + } + + /** + * Queries the number of documents in the index. + * + * @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 response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono countAsync(RequestOptions requestOptions) { + return countWithResponseAsync(requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Queries the number of documents in the index. + * + * @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 response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono countAsync(RequestOptions requestOptions, Context context) { + return countWithResponseAsync(requestOptions, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Searches for documents in the index. + * + * @param searchText A full-text search query expression; Use "*" or omit this parameter to match all documents. + * @param xMsQuerySourceAuthorization Token identifying the user for which the query is being executed. This token + * is used to enforce security restrictions on documents. + * @param xMsEnableElevatedRead A value that enables elevated read that bypass document level permission checks for + * the query operation. + * @param searchOptions Parameter group. + * @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 containing search results from an index along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> searchGetWithResponseAsync(String searchText, + String xMsQuerySourceAuthorization, Boolean xMsEnableElevatedRead, SearchOptions searchOptions, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> searchGetWithResponseAsync(searchText, xMsQuerySourceAuthorization, + xMsEnableElevatedRead, searchOptions, requestOptions, context)); + } + + /** + * Searches for documents in the index. + * + * @param searchText A full-text search query expression; Use "*" or omit this parameter to match all documents. + * @param xMsQuerySourceAuthorization Token identifying the user for which the query is being executed. This token + * is used to enforce security restrictions on documents. + * @param xMsEnableElevatedRead A value that enables elevated read that bypass document level permission checks for + * the query operation. + * @param searchOptions Parameter group. + * @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 containing search results from an index along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> searchGetWithResponseAsync(String searchText, + String xMsQuerySourceAuthorization, Boolean xMsEnableElevatedRead, SearchOptions searchOptions, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + Boolean includeTotalResultCountInternal = null; + if (searchOptions != null) { + includeTotalResultCountInternal = searchOptions.isIncludeTotalResultCount(); + } + Boolean includeTotalResultCount = includeTotalResultCountInternal; + List facetsInternal = null; + if (searchOptions != null) { + facetsInternal = searchOptions.getFacets(); + } + List facets = facetsInternal; + String filterInternal = null; + if (searchOptions != null) { + filterInternal = searchOptions.getFilter(); + } + String filter = filterInternal; + List highlightFieldsInternal = null; + if (searchOptions != null) { + highlightFieldsInternal = searchOptions.getHighlightFields(); + } + List highlightFields = highlightFieldsInternal; + String highlightPostTagInternal = null; + if (searchOptions != null) { + highlightPostTagInternal = searchOptions.getHighlightPostTag(); + } + String highlightPostTag = highlightPostTagInternal; + String highlightPreTagInternal = null; + if (searchOptions != null) { + highlightPreTagInternal = searchOptions.getHighlightPreTag(); + } + String highlightPreTag = highlightPreTagInternal; + Double minimumCoverageInternal = null; + if (searchOptions != null) { + minimumCoverageInternal = searchOptions.getMinimumCoverage(); + } + Double minimumCoverage = minimumCoverageInternal; + List orderByInternal = null; + if (searchOptions != null) { + orderByInternal = searchOptions.getOrderBy(); + } + List orderBy = orderByInternal; + QueryType queryTypeInternal = null; + if (searchOptions != null) { + queryTypeInternal = searchOptions.getQueryType(); + } + QueryType queryType = queryTypeInternal; + List scoringParametersInternal = null; + if (searchOptions != null) { + scoringParametersInternal = searchOptions.getScoringParameters(); + } + List scoringParameters = scoringParametersInternal; + String scoringProfileInternal = null; + if (searchOptions != null) { + scoringProfileInternal = searchOptions.getScoringProfile(); + } + String scoringProfile = scoringProfileInternal; + List searchFieldsInternal = null; + if (searchOptions != null) { + searchFieldsInternal = searchOptions.getSearchFields(); + } + List searchFields = searchFieldsInternal; + SearchMode searchModeInternal = null; + if (searchOptions != null) { + searchModeInternal = searchOptions.getSearchMode(); + } + SearchMode searchMode = searchModeInternal; + ScoringStatistics scoringStatisticsInternal = null; + if (searchOptions != null) { + scoringStatisticsInternal = searchOptions.getScoringStatistics(); + } + ScoringStatistics scoringStatistics = scoringStatisticsInternal; + String sessionIdInternal = null; + if (searchOptions != null) { + sessionIdInternal = searchOptions.getSessionId(); + } + String sessionId = sessionIdInternal; + List selectInternal = null; + if (searchOptions != null) { + selectInternal = searchOptions.getSelect(); + } + List select = selectInternal; + Integer skipInternal = null; + if (searchOptions != null) { + skipInternal = searchOptions.getSkip(); + } + Integer skip = skipInternal; + Integer topInternal = null; + if (searchOptions != null) { + topInternal = searchOptions.getTop(); + } + Integer top = topInternal; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + String semanticConfigurationInternal = null; + if (searchOptions != null) { + semanticConfigurationInternal = searchOptions.getSemanticConfiguration(); + } + String semanticConfiguration = semanticConfigurationInternal; + SemanticErrorMode semanticErrorHandlingInternal = null; + if (searchOptions != null) { + semanticErrorHandlingInternal = searchOptions.getSemanticErrorHandling(); + } + SemanticErrorMode semanticErrorHandling = semanticErrorHandlingInternal; + Integer semanticMaxWaitInMillisecondsInternal = null; + if (searchOptions != null) { + semanticMaxWaitInMillisecondsInternal = searchOptions.getSemanticMaxWaitInMilliseconds(); + } + Integer semanticMaxWaitInMilliseconds = semanticMaxWaitInMillisecondsInternal; + QueryAnswerType answersInternal = null; + if (searchOptions != null) { + answersInternal = searchOptions.getAnswers(); + } + QueryAnswerType answers = answersInternal; + QueryCaptionType captionsInternal = null; + if (searchOptions != null) { + captionsInternal = searchOptions.getCaptions(); + } + QueryCaptionType captions = captionsInternal; + String semanticQueryInternal = null; + if (searchOptions != null) { + semanticQueryInternal = searchOptions.getSemanticQuery(); + } + String semanticQuery = semanticQueryInternal; + QueryRewritesType queryRewritesInternal = null; + if (searchOptions != null) { + queryRewritesInternal = searchOptions.getQueryRewrites(); + } + QueryRewritesType queryRewrites = queryRewritesInternal; + QueryDebugMode debugInternal = null; + if (searchOptions != null) { + debugInternal = searchOptions.getDebug(); + } + QueryDebugMode debug = debugInternal; + QueryLanguage queryLanguageInternal = null; + if (searchOptions != null) { + queryLanguageInternal = searchOptions.getQueryLanguage(); + } + QueryLanguage queryLanguage = queryLanguageInternal; + QuerySpellerType spellerInternal = null; + if (searchOptions != null) { + spellerInternal = searchOptions.getSpeller(); + } + QuerySpellerType speller = spellerInternal; + List semanticFieldsInternal = null; + if (searchOptions != null) { + semanticFieldsInternal = searchOptions.getSemanticFields(); + } + List semanticFields = semanticFieldsInternal; + List facetsConverted = (facets == null) + ? new ArrayList<>() + : facets.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + String highlightFieldsConverted = (highlightFields == null) + ? null + : highlightFields.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + String orderByConverted = (orderBy == null) + ? null + : orderBy.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + List scoringParametersConverted = (scoringParameters == null) + ? new ArrayList<>() + : scoringParameters.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + String searchFieldsConverted = (searchFields == null) + ? null + : searchFields.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + String selectConverted = (select == null) + ? null + : select.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + String semanticFieldsConverted = (semanticFields == null) + ? null + : semanticFields.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.searchGet(this.client.getEndpoint(), this.client.getIndexName(), searchText, + includeTotalResultCount, facetsConverted, filter, highlightFieldsConverted, highlightPostTag, + highlightPreTag, minimumCoverage, orderByConverted, queryType, scoringParametersConverted, scoringProfile, + searchFieldsConverted, searchMode, scoringStatistics, sessionId, selectConverted, skip, top, + this.client.getApiVersion(), xMsClientRequestId, semanticConfiguration, semanticErrorHandling, + semanticMaxWaitInMilliseconds, answers, captions, semanticQuery, queryRewrites, debug, queryLanguage, + speller, semanticFieldsConverted, xMsQuerySourceAuthorization, xMsEnableElevatedRead, accept, context); + } + + /** + * Searches for documents in the index. + * + * @param searchText A full-text search query expression; Use "*" or omit this parameter to match all documents. + * @param xMsQuerySourceAuthorization Token identifying the user for which the query is being executed. This token + * is used to enforce security restrictions on documents. + * @param xMsEnableElevatedRead A value that enables elevated read that bypass document level permission checks for + * the query operation. + * @param searchOptions Parameter group. + * @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 containing search results from an index on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono searchGetAsync(String searchText, String xMsQuerySourceAuthorization, + Boolean xMsEnableElevatedRead, SearchOptions searchOptions, RequestOptions requestOptions) { + return searchGetWithResponseAsync(searchText, xMsQuerySourceAuthorization, xMsEnableElevatedRead, searchOptions, + requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Searches for documents in the index. + * + * @param searchText A full-text search query expression; Use "*" or omit this parameter to match all documents. + * @param xMsQuerySourceAuthorization Token identifying the user for which the query is being executed. This token + * is used to enforce security restrictions on documents. + * @param xMsEnableElevatedRead A value that enables elevated read that bypass document level permission checks for + * the query operation. + * @param searchOptions Parameter group. + * @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 containing search results from an index on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono searchGetAsync(String searchText, String xMsQuerySourceAuthorization, + Boolean xMsEnableElevatedRead, SearchOptions searchOptions, RequestOptions requestOptions, Context context) { + return searchGetWithResponseAsync(searchText, xMsQuerySourceAuthorization, xMsEnableElevatedRead, searchOptions, + requestOptions, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Searches for documents in the index. + * + * @param searchRequest The definition of the Search request. + * @param xMsQuerySourceAuthorization Token identifying the user for which the query is being executed. This token + * is used to enforce security restrictions on documents. + * @param xMsEnableElevatedRead A value that enables elevated read that bypass document level permission checks for + * the query operation. + * @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 containing search results from an index along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> searchPostWithResponseAsync(SearchRequest searchRequest, + String xMsQuerySourceAuthorization, Boolean xMsEnableElevatedRead, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> searchPostWithResponseAsync(searchRequest, xMsQuerySourceAuthorization, + xMsEnableElevatedRead, requestOptions, context)); + } + + /** + * Searches for documents in the index. + * + * @param searchRequest The definition of the Search request. + * @param xMsQuerySourceAuthorization Token identifying the user for which the query is being executed. This token + * is used to enforce security restrictions on documents. + * @param xMsEnableElevatedRead A value that enables elevated read that bypass document level permission checks for + * the query operation. + * @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 containing search results from an index along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> searchPostWithResponseAsync(SearchRequest searchRequest, + String xMsQuerySourceAuthorization, Boolean xMsEnableElevatedRead, RequestOptions requestOptions, + Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.searchPost(this.client.getEndpoint(), this.client.getIndexName(), this.client.getApiVersion(), + xMsClientRequestId, xMsQuerySourceAuthorization, xMsEnableElevatedRead, searchRequest, accept, context); + } + + /** + * Searches for documents in the index. + * + * @param searchRequest The definition of the Search request. + * @param xMsQuerySourceAuthorization Token identifying the user for which the query is being executed. This token + * is used to enforce security restrictions on documents. + * @param xMsEnableElevatedRead A value that enables elevated read that bypass document level permission checks for + * the query operation. + * @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 containing search results from an index on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono searchPostAsync(SearchRequest searchRequest, String xMsQuerySourceAuthorization, + Boolean xMsEnableElevatedRead, RequestOptions requestOptions) { + return searchPostWithResponseAsync(searchRequest, xMsQuerySourceAuthorization, xMsEnableElevatedRead, + requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Searches for documents in the index. + * + * @param searchRequest The definition of the Search request. + * @param xMsQuerySourceAuthorization Token identifying the user for which the query is being executed. This token + * is used to enforce security restrictions on documents. + * @param xMsEnableElevatedRead A value that enables elevated read that bypass document level permission checks for + * the query operation. + * @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 containing search results from an index on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono searchPostAsync(SearchRequest searchRequest, String xMsQuerySourceAuthorization, + Boolean xMsEnableElevatedRead, RequestOptions requestOptions, Context context) { + return searchPostWithResponseAsync(searchRequest, xMsQuerySourceAuthorization, xMsEnableElevatedRead, + requestOptions, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves a document from the index. + * + * @param key The key of the document to retrieve. + * @param selectedFields List of field names to retrieve for the document; Any field not retrieved will be missing + * from the returned document. + * @param xMsQuerySourceAuthorization Token identifying the user for which the query is being executed. This token + * is used to enforce security restrictions on documents. + * @param xMsEnableElevatedRead A value that enables elevated read that bypass document level permission checks for + * the query operation. + * @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 document retrieved via a document lookup operation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> getWithResponseAsync(String key, List selectedFields, + String xMsQuerySourceAuthorization, Boolean xMsEnableElevatedRead, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> getWithResponseAsync(key, selectedFields, xMsQuerySourceAuthorization, + xMsEnableElevatedRead, requestOptions, context)); + } + + /** + * Retrieves a document from the index. + * + * @param key The key of the document to retrieve. + * @param selectedFields List of field names to retrieve for the document; Any field not retrieved will be missing + * from the returned document. + * @param xMsQuerySourceAuthorization Token identifying the user for which the query is being executed. This token + * is used to enforce security restrictions on documents. + * @param xMsEnableElevatedRead A value that enables elevated read that bypass document level permission checks for + * the query operation. + * @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 document retrieved via a document lookup operation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> getWithResponseAsync(String key, List selectedFields, + String xMsQuerySourceAuthorization, Boolean xMsEnableElevatedRead, RequestOptions requestOptions, + Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + String selectedFieldsConverted = (selectedFields == null) + ? null + : selectedFields.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.get(this.client.getEndpoint(), this.client.getIndexName(), key, selectedFieldsConverted, + this.client.getApiVersion(), xMsClientRequestId, xMsQuerySourceAuthorization, xMsEnableElevatedRead, accept, + context); + } + + /** + * Retrieves a document from the index. + * + * @param key The key of the document to retrieve. + * @param selectedFields List of field names to retrieve for the document; Any field not retrieved will be missing + * from the returned document. + * @param xMsQuerySourceAuthorization Token identifying the user for which the query is being executed. This token + * is used to enforce security restrictions on documents. + * @param xMsEnableElevatedRead A value that enables elevated read that bypass document level permission checks for + * the query operation. + * @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 document retrieved via a document lookup operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAsync(String key, List selectedFields, + String xMsQuerySourceAuthorization, Boolean xMsEnableElevatedRead, RequestOptions requestOptions) { + return getWithResponseAsync(key, selectedFields, xMsQuerySourceAuthorization, xMsEnableElevatedRead, + requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves a document from the index. + * + * @param key The key of the document to retrieve. + * @param selectedFields List of field names to retrieve for the document; Any field not retrieved will be missing + * from the returned document. + * @param xMsQuerySourceAuthorization Token identifying the user for which the query is being executed. This token + * is used to enforce security restrictions on documents. + * @param xMsEnableElevatedRead A value that enables elevated read that bypass document level permission checks for + * the query operation. + * @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 document retrieved via a document lookup operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAsync(String key, List selectedFields, + String xMsQuerySourceAuthorization, Boolean xMsEnableElevatedRead, RequestOptions requestOptions, + Context context) { + return getWithResponseAsync(key, selectedFields, xMsQuerySourceAuthorization, xMsEnableElevatedRead, + requestOptions, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Suggests documents in the index that match the given partial query text. + * + * @param searchText The search text to use to suggest documents. Must be at least 1 character, and no more than 100 + * characters. + * @param suggesterName The name of the suggester as specified in the suggesters collection that's part of the index + * definition. + * @param suggestOptions Parameter group. + * @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 containing suggestion query results from an index along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> suggestGetWithResponseAsync(String searchText, String suggesterName, + SuggestOptions suggestOptions, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> suggestGetWithResponseAsync(searchText, suggesterName, suggestOptions, requestOptions, context)); + } + + /** + * Suggests documents in the index that match the given partial query text. + * + * @param searchText The search text to use to suggest documents. Must be at least 1 character, and no more than 100 + * characters. + * @param suggesterName The name of the suggester as specified in the suggesters collection that's part of the index + * definition. + * @param suggestOptions Parameter group. + * @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 containing suggestion query results from an index along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> suggestGetWithResponseAsync(String searchText, String suggesterName, + SuggestOptions suggestOptions, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + String filterInternal = null; + if (suggestOptions != null) { + filterInternal = suggestOptions.getFilter(); + } + String filter = filterInternal; + Boolean useFuzzyMatchingInternal = null; + if (suggestOptions != null) { + useFuzzyMatchingInternal = suggestOptions.isUseFuzzyMatching(); + } + Boolean useFuzzyMatching = useFuzzyMatchingInternal; + String highlightPostTagInternal = null; + if (suggestOptions != null) { + highlightPostTagInternal = suggestOptions.getHighlightPostTag(); + } + String highlightPostTag = highlightPostTagInternal; + String highlightPreTagInternal = null; + if (suggestOptions != null) { + highlightPreTagInternal = suggestOptions.getHighlightPreTag(); + } + String highlightPreTag = highlightPreTagInternal; + Double minimumCoverageInternal = null; + if (suggestOptions != null) { + minimumCoverageInternal = suggestOptions.getMinimumCoverage(); + } + Double minimumCoverage = minimumCoverageInternal; + List orderByInternal = null; + if (suggestOptions != null) { + orderByInternal = suggestOptions.getOrderBy(); + } + List orderBy = orderByInternal; + List searchFieldsInternal = null; + if (suggestOptions != null) { + searchFieldsInternal = suggestOptions.getSearchFields(); + } + List searchFields = searchFieldsInternal; + List selectInternal = null; + if (suggestOptions != null) { + selectInternal = suggestOptions.getSelect(); + } + List select = selectInternal; + Integer topInternal = null; + if (suggestOptions != null) { + topInternal = suggestOptions.getTop(); + } + Integer top = topInternal; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + String orderByConverted = (orderBy == null) + ? null + : orderBy.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + String searchFieldsConverted = (searchFields == null) + ? null + : searchFields.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + String selectConverted = (select == null) + ? null + : select.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.suggestGet(this.client.getEndpoint(), this.client.getIndexName(), searchText, suggesterName, + filter, useFuzzyMatching, highlightPostTag, highlightPreTag, minimumCoverage, orderByConverted, + searchFieldsConverted, selectConverted, top, this.client.getApiVersion(), xMsClientRequestId, accept, + context); + } + + /** + * Suggests documents in the index that match the given partial query text. + * + * @param searchText The search text to use to suggest documents. Must be at least 1 character, and no more than 100 + * characters. + * @param suggesterName The name of the suggester as specified in the suggesters collection that's part of the index + * definition. + * @param suggestOptions Parameter group. + * @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 containing suggestion query results from an index on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono suggestGetAsync(String searchText, String suggesterName, + SuggestOptions suggestOptions, RequestOptions requestOptions) { + return suggestGetWithResponseAsync(searchText, suggesterName, suggestOptions, requestOptions) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Suggests documents in the index that match the given partial query text. + * + * @param searchText The search text to use to suggest documents. Must be at least 1 character, and no more than 100 + * characters. + * @param suggesterName The name of the suggester as specified in the suggesters collection that's part of the index + * definition. + * @param suggestOptions Parameter group. + * @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 containing suggestion query results from an index on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono suggestGetAsync(String searchText, String suggesterName, + SuggestOptions suggestOptions, RequestOptions requestOptions, Context context) { + return suggestGetWithResponseAsync(searchText, suggesterName, suggestOptions, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Suggests documents in the index that match the given partial query text. + * + * @param suggestRequest The Suggest request. + * @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 containing suggestion query results from an index along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> suggestPostWithResponseAsync(SuggestRequest suggestRequest, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> suggestPostWithResponseAsync(suggestRequest, requestOptions, context)); + } + + /** + * Suggests documents in the index that match the given partial query text. + * + * @param suggestRequest The Suggest request. + * @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 containing suggestion query results from an index along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> suggestPostWithResponseAsync(SuggestRequest suggestRequest, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.suggestPost(this.client.getEndpoint(), this.client.getIndexName(), this.client.getApiVersion(), + xMsClientRequestId, suggestRequest, accept, context); + } + + /** + * Suggests documents in the index that match the given partial query text. + * + * @param suggestRequest The Suggest request. + * @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 containing suggestion query results from an index on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono suggestPostAsync(SuggestRequest suggestRequest, RequestOptions requestOptions) { + return suggestPostWithResponseAsync(suggestRequest, requestOptions) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Suggests documents in the index that match the given partial query text. + * + * @param suggestRequest The Suggest request. + * @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 containing suggestion query results from an index on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono suggestPostAsync(SuggestRequest suggestRequest, RequestOptions requestOptions, + Context context) { + return suggestPostWithResponseAsync(suggestRequest, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Sends a batch of document write actions to the index. + * + * @param batch The batch of index actions. + * @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 containing the status of operations for all documents in the indexing request along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> indexWithResponseAsync(IndexBatchImpl batch, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> indexWithResponseAsync(batch, requestOptions, context)); + } + + /** + * Sends a batch of document write actions to the index. + * + * @param batch The batch of index actions. + * @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 containing the status of operations for all documents in the indexing request along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> indexWithResponseAsync(IndexBatchImpl batch, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.index(this.client.getEndpoint(), this.client.getIndexName(), this.client.getApiVersion(), + xMsClientRequestId, batch, accept, context); + } + + /** + * Sends a batch of document write actions to the index. + * + * @param batch The batch of index actions. + * @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 containing the status of operations for all documents in the indexing request on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono indexAsync(IndexBatchImpl batch, RequestOptions requestOptions) { + return indexWithResponseAsync(batch, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Sends a batch of document write actions to the index. + * + * @param batch The batch of index actions. + * @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 containing the status of operations for all documents in the indexing request on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono indexAsync(IndexBatchImpl batch, RequestOptions requestOptions, Context context) { + return indexWithResponseAsync(batch, requestOptions, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Autocompletes incomplete query terms based on input text and matching terms in the index. + * + * @param searchText The incomplete term which should be auto-completed. + * @param suggesterName The name of the suggester as specified in the suggesters collection that's part of the index + * definition. + * @param requestOptions Parameter group. + * @param autocompleteOptions 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 result of Autocomplete query along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> autocompleteGetWithResponseAsync(String searchText, String suggesterName, + RequestOptions requestOptions, AutocompleteOptions autocompleteOptions) { + return FluxUtil.withContext(context -> autocompleteGetWithResponseAsync(searchText, suggesterName, + requestOptions, autocompleteOptions, context)); + } + + /** + * Autocompletes incomplete query terms based on input text and matching terms in the index. + * + * @param searchText The incomplete term which should be auto-completed. + * @param suggesterName The name of the suggester as specified in the suggesters collection that's part of the index + * definition. + * @param requestOptions Parameter group. + * @param autocompleteOptions 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 result of Autocomplete query along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> autocompleteGetWithResponseAsync(String searchText, String suggesterName, + RequestOptions requestOptions, AutocompleteOptions autocompleteOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + AutocompleteMode autocompleteModeInternal = null; + if (autocompleteOptions != null) { + autocompleteModeInternal = autocompleteOptions.getAutocompleteMode(); + } + AutocompleteMode autocompleteMode = autocompleteModeInternal; + String filterInternal = null; + if (autocompleteOptions != null) { + filterInternal = autocompleteOptions.getFilter(); + } + String filter = filterInternal; + Boolean useFuzzyMatchingInternal = null; + if (autocompleteOptions != null) { + useFuzzyMatchingInternal = autocompleteOptions.isUseFuzzyMatching(); + } + Boolean useFuzzyMatching = useFuzzyMatchingInternal; + String highlightPostTagInternal = null; + if (autocompleteOptions != null) { + highlightPostTagInternal = autocompleteOptions.getHighlightPostTag(); + } + String highlightPostTag = highlightPostTagInternal; + String highlightPreTagInternal = null; + if (autocompleteOptions != null) { + highlightPreTagInternal = autocompleteOptions.getHighlightPreTag(); + } + String highlightPreTag = highlightPreTagInternal; + Double minimumCoverageInternal = null; + if (autocompleteOptions != null) { + minimumCoverageInternal = autocompleteOptions.getMinimumCoverage(); + } + Double minimumCoverage = minimumCoverageInternal; + List searchFieldsInternal = null; + if (autocompleteOptions != null) { + searchFieldsInternal = autocompleteOptions.getSearchFields(); + } + List searchFields = searchFieldsInternal; + Integer topInternal = null; + if (autocompleteOptions != null) { + topInternal = autocompleteOptions.getTop(); + } + Integer top = topInternal; + String searchFieldsConverted = (searchFields == null) + ? null + : searchFields.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.autocompleteGet(this.client.getEndpoint(), this.client.getIndexName(), xMsClientRequestId, + this.client.getApiVersion(), searchText, suggesterName, autocompleteMode, filter, useFuzzyMatching, + highlightPostTag, highlightPreTag, minimumCoverage, searchFieldsConverted, top, accept, context); + } + + /** + * Autocompletes incomplete query terms based on input text and matching terms in the index. + * + * @param searchText The incomplete term which should be auto-completed. + * @param suggesterName The name of the suggester as specified in the suggesters collection that's part of the index + * definition. + * @param requestOptions Parameter group. + * @param autocompleteOptions 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 result of Autocomplete query on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono autocompleteGetAsync(String searchText, String suggesterName, + RequestOptions requestOptions, AutocompleteOptions autocompleteOptions) { + return autocompleteGetWithResponseAsync(searchText, suggesterName, requestOptions, autocompleteOptions) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Autocompletes incomplete query terms based on input text and matching terms in the index. + * + * @param searchText The incomplete term which should be auto-completed. + * @param suggesterName The name of the suggester as specified in the suggesters collection that's part of the index + * definition. + * @param requestOptions Parameter group. + * @param autocompleteOptions 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 result of Autocomplete query on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono autocompleteGetAsync(String searchText, String suggesterName, + RequestOptions requestOptions, AutocompleteOptions autocompleteOptions, Context context) { + return autocompleteGetWithResponseAsync(searchText, suggesterName, requestOptions, autocompleteOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Autocompletes incomplete query terms based on input text and matching terms in the index. + * + * @param autocompleteRequest The definition of the Autocomplete request. + * @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 result of Autocomplete query along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> autocompletePostWithResponseAsync(AutocompleteRequest autocompleteRequest, + RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> autocompletePostWithResponseAsync(autocompleteRequest, requestOptions, context)); + } + + /** + * Autocompletes incomplete query terms based on input text and matching terms in the index. + * + * @param autocompleteRequest The definition of the Autocomplete request. + * @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 result of Autocomplete query along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> autocompletePostWithResponseAsync(AutocompleteRequest autocompleteRequest, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.autocompletePost(this.client.getEndpoint(), this.client.getIndexName(), xMsClientRequestId, + this.client.getApiVersion(), autocompleteRequest, accept, context); + } + + /** + * Autocompletes incomplete query terms based on input text and matching terms in the index. + * + * @param autocompleteRequest The definition of the Autocomplete request. + * @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 result of Autocomplete query on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono autocompletePostAsync(AutocompleteRequest autocompleteRequest, + RequestOptions requestOptions) { + return autocompletePostWithResponseAsync(autocompleteRequest, requestOptions) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Autocompletes incomplete query terms based on input text and matching terms in the index. + * + * @param autocompleteRequest The definition of the Autocomplete request. + * @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 result of Autocomplete query on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono autocompletePostAsync(AutocompleteRequest autocompleteRequest, + RequestOptions requestOptions, Context context) { + return autocompletePostWithResponseAsync(autocompleteRequest, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Indexers.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Indexers.java new file mode 100644 index 000000000000..39b5c8490359 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Indexers.java @@ -0,0 +1,960 @@ +// 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; + +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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.search.models.DocumentKeysOrIds; +import com.azure.search.models.ErrorResponseException; +import com.azure.search.models.IndexerResyncBody; +import com.azure.search.models.ListIndexersResult; +import com.azure.search.models.RequestOptions; +import com.azure.search.models.SearchIndexer; +import com.azure.search.models.SearchIndexerStatus; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Indexers. + */ +public final class Indexers { + /** + * The proxy service used to perform REST calls. + */ + private final IndexersService service; + + /** + * The service client containing this operation class. + */ + private final SearchClient client; + + /** + * Initializes an instance of Indexers. + * + * @param client the instance of the service client containing this operation class. + */ + Indexers(SearchClient client) { + this.service = RestProxy.create(IndexersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchClientIndexers to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SearchClientIndexers") + public interface IndexersService { + @Post("/indexers('{indexerName}')/search.reset") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> reset(@HostParam("endpoint") String endpoint, @PathParam("indexerName") String indexerName, + @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, @BodyParam("application/json") DocumentKeysOrIds keysOrIds, + @HeaderParam("Accept") String accept, Context context); + + @Post("/indexers('{indexerName}')/search.resync") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> resync(@HostParam("endpoint") String endpoint, + @PathParam("indexerName") String indexerName, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") IndexerResyncBody indexerResync, @HeaderParam("Accept") String accept, + Context context); + + @Post("/indexers('{indexerName}')/search.run") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> run(@HostParam("endpoint") String endpoint, @PathParam("indexerName") String indexerName, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Put("/indexers('{indexerName}')") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @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, + @QueryParam("ignoreResetRequirements") Boolean skipIndexerResetRequirementForCache, + @QueryParam("disableCacheReprocessingChangeDetection") Boolean disableCacheReprocessingChangeDetection, + @BodyParam("application/json") SearchIndexer indexer, @HeaderParam("Accept") String accept, + Context context); + + @Delete("/indexers('{indexerName}')") + @ExpectedResponses({ 204, 404 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @PathParam("indexerName") String indexerName, + @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("/indexers('{indexerName}')") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @PathParam("indexerName") String indexerName, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Get("/indexers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("$select") String select, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Post("/indexers") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") SearchIndexer indexer, + @HeaderParam("Accept") String accept, Context context); + + @Get("/indexers('{indexerName}')/search.status") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> getStatus(@HostParam("endpoint") String endpoint, + @PathParam("indexerName") String indexerName, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Resets the change tracking state associated with an indexer. + * + * @param indexerName The name of the indexer 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> resetWithResponseAsync(String indexerName, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> resetWithResponseAsync(indexerName, requestOptions, context)); + } + + /** + * Resets the change tracking state associated with an indexer. + * + * @param indexerName The name of the indexer 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> resetWithResponseAsync(String indexerName, RequestOptions requestOptions, + Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.reset(this.client.getEndpoint(), indexerName, xMsClientRequestId, this.client.getApiVersion(), + accept, context); + } + + /** + * Resets the change tracking state associated with an indexer. + * + * @param indexerName The name of the indexer 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 resetAsync(String indexerName, RequestOptions requestOptions) { + return resetWithResponseAsync(indexerName, requestOptions).flatMap(ignored -> Mono.empty()); + } + + /** + * Resets the change tracking state associated with an indexer. + * + * @param indexerName The name of the indexer 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 resetAsync(String indexerName, RequestOptions requestOptions, Context context) { + return resetWithResponseAsync(indexerName, 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. + * @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) { + return FluxUtil.withContext( + context -> resetDocsWithResponseAsync(indexerName, overwrite, keysOrIds, requestOptions, 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"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.resetDocs(this.client.getEndpoint(), indexerName, overwrite, xMsClientRequestId, + this.client.getApiVersion(), keysOrIds, accept, 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()); + } + + /** + * Resync selective options from the datasource to be re-ingested by the indexer. + * + * @param indexerName The name of the indexer to resync for. + * @param indexerResync The indexerResync 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> resyncWithResponseAsync(String indexerName, IndexerResyncBody indexerResync, + RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> resyncWithResponseAsync(indexerName, indexerResync, requestOptions, context)); + } + + /** + * Resync selective options from the datasource to be re-ingested by the indexer. + * + * @param indexerName The name of the indexer to resync for. + * @param indexerResync The indexerResync 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> resyncWithResponseAsync(String indexerName, IndexerResyncBody indexerResync, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.resync(this.client.getEndpoint(), indexerName, xMsClientRequestId, this.client.getApiVersion(), + indexerResync, accept, context); + } + + /** + * Resync selective options from the datasource to be re-ingested by the indexer. + * + * @param indexerName The name of the indexer to resync for. + * @param indexerResync The indexerResync 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 resyncAsync(String indexerName, IndexerResyncBody indexerResync, RequestOptions requestOptions) { + return resyncWithResponseAsync(indexerName, indexerResync, requestOptions).flatMap(ignored -> Mono.empty()); + } + + /** + * Resync selective options from the datasource to be re-ingested by the indexer. + * + * @param indexerName The name of the indexer to resync for. + * @param indexerResync The indexerResync 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 resyncAsync(String indexerName, IndexerResyncBody indexerResync, RequestOptions requestOptions, + Context context) { + return resyncWithResponseAsync(indexerName, indexerResync, requestOptions, context) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Runs an indexer on-demand. + * + * @param indexerName The name of the indexer to run. + * @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> runWithResponseAsync(String indexerName, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> runWithResponseAsync(indexerName, requestOptions, context)); + } + + /** + * Runs an indexer on-demand. + * + * @param indexerName The name of the indexer to run. + * @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> runWithResponseAsync(String indexerName, RequestOptions requestOptions, + Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.run(this.client.getEndpoint(), indexerName, xMsClientRequestId, this.client.getApiVersion(), + accept, context); + } + + /** + * Runs an indexer on-demand. + * + * @param indexerName The name of the indexer to run. + * @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 runAsync(String indexerName, RequestOptions requestOptions) { + return runWithResponseAsync(indexerName, requestOptions).flatMap(ignored -> Mono.empty()); + } + + /** + * Runs an indexer on-demand. + * + * @param indexerName The name of the indexer to run. + * @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 runAsync(String indexerName, RequestOptions requestOptions, Context context) { + return runWithResponseAsync(indexerName, requestOptions, context).flatMap(ignored -> Mono.empty()); + } + + /** + * Creates a new indexer or updates an indexer if it already exists. + * + * @param indexerName The name of the indexer to create or update. + * @param indexer The definition of the indexer 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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an indexer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync(String indexerName, SearchIndexer indexer, + String ifMatch, String ifNoneMatch, Boolean skipIndexerResetRequirementForCache, + Boolean disableCacheReprocessingChangeDetection, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> createOrUpdateWithResponseAsync(indexerName, indexer, ifMatch, ifNoneMatch, + skipIndexerResetRequirementForCache, disableCacheReprocessingChangeDetection, requestOptions, context)); + } + + /** + * Creates a new indexer or updates an indexer if it already exists. + * + * @param indexerName The name of the indexer to create or update. + * @param indexer The definition of the indexer 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 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. + * @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 indexer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync(String indexerName, SearchIndexer indexer, + String ifMatch, String ifNoneMatch, Boolean skipIndexerResetRequirementForCache, + Boolean disableCacheReprocessingChangeDetection, RequestOptions requestOptions, Context context) { + final String prefer = "return=representation"; + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.createOrUpdate(this.client.getEndpoint(), indexerName, xMsClientRequestId, ifMatch, ifNoneMatch, + prefer, this.client.getApiVersion(), skipIndexerResetRequirementForCache, + disableCacheReprocessingChangeDetection, indexer, accept, context); + } + + /** + * Creates a new indexer or updates an indexer if it already exists. + * + * @param indexerName The name of the indexer to create or update. + * @param indexer The definition of the indexer 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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents an indexer on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String indexerName, SearchIndexer indexer, String ifMatch, + String ifNoneMatch, Boolean skipIndexerResetRequirementForCache, + Boolean disableCacheReprocessingChangeDetection, RequestOptions requestOptions) { + return createOrUpdateWithResponseAsync(indexerName, indexer, ifMatch, ifNoneMatch, + skipIndexerResetRequirementForCache, disableCacheReprocessingChangeDetection, requestOptions) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new indexer or updates an indexer if it already exists. + * + * @param indexerName The name of the indexer to create or update. + * @param indexer The definition of the indexer 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 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. + * @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 indexer on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String indexerName, SearchIndexer indexer, String ifMatch, + 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())); + } + + /** + * Deletes an indexer. + * + * @param indexerName The name of the indexer 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 indexerName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> deleteWithResponseAsync(indexerName, ifMatch, ifNoneMatch, requestOptions, context)); + } + + /** + * Deletes an indexer. + * + * @param indexerName The name of the indexer 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 indexerName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.delete(this.client.getEndpoint(), indexerName, xMsClientRequestId, ifMatch, ifNoneMatch, + this.client.getApiVersion(), accept, context); + } + + /** + * Deletes an indexer. + * + * @param indexerName The name of the indexer 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 indexerName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions) { + return deleteWithResponseAsync(indexerName, ifMatch, ifNoneMatch, requestOptions) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes an indexer. + * + * @param indexerName The name of the indexer 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 indexerName, String ifMatch, String ifNoneMatch, RequestOptions requestOptions, + Context context) { + return deleteWithResponseAsync(indexerName, ifMatch, ifNoneMatch, requestOptions, context) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Retrieves an indexer definition. + * + * @param indexerName The name of the indexer 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 indexer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String indexerName, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> getWithResponseAsync(indexerName, requestOptions, context)); + } + + /** + * Retrieves an indexer definition. + * + * @param indexerName The name of the indexer 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 indexer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String indexerName, RequestOptions requestOptions, + Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.get(this.client.getEndpoint(), indexerName, xMsClientRequestId, this.client.getApiVersion(), + accept, context); + } + + /** + * Retrieves an indexer definition. + * + * @param indexerName The name of the indexer 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 indexer on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String indexerName, RequestOptions requestOptions) { + return getWithResponseAsync(indexerName, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves an indexer definition. + * + * @param indexerName The name of the indexer 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 indexer on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String indexerName, RequestOptions requestOptions, Context context) { + return getWithResponseAsync(indexerName, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Lists all indexers available for a search service. + * + * @param select Selects which top-level properties of the indexers to retrieve. Specified as a comma-separated list + * of JSON property names, or '*' for all properties. The default is all properties. + * @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 Indexers request along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(String select, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> listWithResponseAsync(select, requestOptions, context)); + } + + /** + * Lists all indexers available for a search service. + * + * @param select Selects which top-level properties of the indexers to retrieve. Specified as a comma-separated list + * of JSON property names, or '*' for all properties. The default is all properties. + * @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 Indexers request along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(String select, RequestOptions requestOptions, + Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.list(this.client.getEndpoint(), select, xMsClientRequestId, this.client.getApiVersion(), accept, + context); + } + + /** + * Lists all indexers available for a search service. + * + * @param select Selects which top-level properties of the indexers to retrieve. Specified as a comma-separated list + * of JSON property names, or '*' for all properties. The default is all properties. + * @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 Indexers request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listAsync(String select, RequestOptions requestOptions) { + return listWithResponseAsync(select, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Lists all indexers available for a search service. + * + * @param select Selects which top-level properties of the indexers to retrieve. Specified as a comma-separated list + * of JSON property names, or '*' for all properties. The default is all properties. + * @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 Indexers request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listAsync(String select, RequestOptions requestOptions, Context context) { + return listWithResponseAsync(select, requestOptions, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new indexer. + * + * @param indexer The definition of the indexer 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 indexer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(SearchIndexer indexer, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> createWithResponseAsync(indexer, requestOptions, context)); + } + + /** + * Creates a new indexer. + * + * @param indexer The definition of the indexer 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 indexer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(SearchIndexer indexer, RequestOptions requestOptions, + Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.create(this.client.getEndpoint(), xMsClientRequestId, this.client.getApiVersion(), indexer, + accept, context); + } + + /** + * Creates a new indexer. + * + * @param indexer The definition of the indexer 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 indexer on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync(SearchIndexer indexer, RequestOptions requestOptions) { + return createWithResponseAsync(indexer, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new indexer. + * + * @param indexer The definition of the indexer 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 indexer on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync(SearchIndexer indexer, RequestOptions requestOptions, Context context) { + return createWithResponseAsync(indexer, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns the current status and execution history of an indexer. + * + * @param indexerName The name of the indexer for which to retrieve status. + * @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 the current status and execution history of an indexer along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getStatusWithResponseAsync(String indexerName, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> getStatusWithResponseAsync(indexerName, requestOptions, context)); + } + + /** + * Returns the current status and execution history of an indexer. + * + * @param indexerName The name of the indexer for which to retrieve status. + * @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 the current status and execution history of an indexer along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getStatusWithResponseAsync(String indexerName, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.getStatus(this.client.getEndpoint(), indexerName, xMsClientRequestId, + this.client.getApiVersion(), accept, context); + } + + /** + * Returns the current status and execution history of an indexer. + * + * @param indexerName The name of the indexer for which to retrieve status. + * @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 the current status and execution history of an indexer on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getStatusAsync(String indexerName, RequestOptions requestOptions) { + return getStatusWithResponseAsync(indexerName, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns the current status and execution history of an indexer. + * + * @param indexerName The name of the indexer for which to retrieve status. + * @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 the current status and execution history of an indexer on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getStatusAsync(String indexerName, RequestOptions requestOptions, + Context context) { + return getStatusWithResponseAsync(indexerName, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Indexes.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Indexes.java new file mode 100644 index 000000000000..f2b4bf9b31fb --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Indexes.java @@ -0,0 +1,691 @@ +// 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; + +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.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.implementation.models.AnalyzeResult; +import com.azure.search.models.AnalyzeRequest; +import com.azure.search.models.ErrorResponseException; +import com.azure.search.models.GetIndexStatisticsResult; +import com.azure.search.models.ListIndexesResult; +import com.azure.search.models.RequestOptions; +import com.azure.search.models.SearchIndex; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Indexes. + */ +public final class Indexes { + /** + * The proxy service used to perform REST calls. + */ + private final IndexesService service; + + /** + * The service client containing this operation class. + */ + private final SearchClient client; + + /** + * Initializes an instance of Indexes. + * + * @param client the instance of the service client containing this operation class. + */ + Indexes(SearchClient client) { + this.service = RestProxy.create(IndexesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchClientIndexes to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SearchClientIndexes") + public interface IndexesService { + @Post("/indexes") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") SearchIndex index, + @HeaderParam("Accept") String accept, Context context); + + @Get("/indexes") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("$select") String select, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Put("/indexes('{indexName}')") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @PathParam("indexName") String indexName, @QueryParam("allowIndexDowntime") Boolean allowIndexDowntime, + @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, @BodyParam("application/json") SearchIndex index, + @HeaderParam("Accept") String accept, Context context); + + @Delete("/indexes('{indexName}')") + @ExpectedResponses({ 204, 404 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> delete(@HostParam("endpoint") String endpoint, @PathParam("indexName") String indexName, + @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("/indexes('{indexName}')") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @PathParam("indexName") String indexName, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Get("/indexes('{indexName}')/search.stats") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> getStatistics(@HostParam("endpoint") String endpoint, + @PathParam("indexName") String indexName, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Post("/indexes('{indexName}')/search.analyze") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> analyze(@HostParam("endpoint") String endpoint, + @PathParam("indexName") String indexName, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") AnalyzeRequest request, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Creates a new search index. + * + * @param index The definition of the index 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 a search index definition, which describes the fields and search behavior of an index along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(SearchIndex index, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> createWithResponseAsync(index, requestOptions, context)); + } + + /** + * Creates a new search index. + * + * @param index The definition of the index 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 a search index definition, which describes the fields and search behavior of an index along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(SearchIndex index, RequestOptions requestOptions, + Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.create(this.client.getEndpoint(), xMsClientRequestId, this.client.getApiVersion(), index, accept, + context); + } + + /** + * Creates a new search index. + * + * @param index The definition of the index 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 a search index definition, which describes the fields and search behavior of an index on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync(SearchIndex index, RequestOptions requestOptions) { + return createWithResponseAsync(index, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new search index. + * + * @param index The definition of the index 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 a search index definition, which describes the fields and search behavior of an index on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync(SearchIndex index, RequestOptions requestOptions, Context context) { + return createWithResponseAsync(index, requestOptions, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Lists all indexes available for a search service. + * + * @param select Selects which top-level properties of the index definitions to retrieve. Specified as a + * comma-separated list of JSON property names, or '*' for all properties. The default is all properties. + * @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 Indexes request along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listSinglePageAsync(String select, RequestOptions requestOptions, + Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service + .list(this.client.getEndpoint(), select, xMsClientRequestId, this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getIndexes(), null, null)); + } + + /** + * Lists all indexes available for a search service. + * + * @param select Selects which top-level properties of the index definitions to retrieve. Specified as a + * comma-separated list of JSON property names, or '*' for all properties. The default is all properties. + * @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 Indexes request as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(String select, RequestOptions requestOptions, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(select, requestOptions, context)); + } + + /** + * Creates a new search index or updates an index if it already exists. + * + * @param indexName The definition of the index to create or update. + * @param index The definition of the index to create or update. + * @param allowIndexDowntime Allows new analyzers, tokenizers, token filters, or char filters to be added to an + * index by taking the index offline for at least a few seconds. This temporarily causes indexing and query requests + * to fail. Performance and write availability of the index can be impaired for several minutes after the index is + * updated, or longer for very large indexes. + * @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 a search index definition, which describes the fields and search behavior of an index along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync(String indexName, SearchIndex index, + Boolean allowIndexDowntime, String ifMatch, String ifNoneMatch, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> createOrUpdateWithResponseAsync(indexName, index, allowIndexDowntime, + ifMatch, ifNoneMatch, requestOptions, context)); + } + + /** + * Creates a new search index or updates an index if it already exists. + * + * @param indexName The definition of the index to create or update. + * @param index The definition of the index to create or update. + * @param allowIndexDowntime Allows new analyzers, tokenizers, token filters, or char filters to be added to an + * index by taking the index offline for at least a few seconds. This temporarily causes indexing and query requests + * to fail. Performance and write availability of the index can be impaired for several minutes after the index is + * updated, or longer for very large indexes. + * @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 a search index definition, which describes the fields and search behavior of an index along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync(String indexName, SearchIndex index, + Boolean allowIndexDowntime, String ifMatch, String ifNoneMatch, RequestOptions requestOptions, + Context context) { + final String prefer = "return=representation"; + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.createOrUpdate(this.client.getEndpoint(), indexName, allowIndexDowntime, xMsClientRequestId, + ifMatch, ifNoneMatch, prefer, this.client.getApiVersion(), index, accept, context); + } + + /** + * Creates a new search index or updates an index if it already exists. + * + * @param indexName The definition of the index to create or update. + * @param index The definition of the index to create or update. + * @param allowIndexDowntime Allows new analyzers, tokenizers, token filters, or char filters to be added to an + * index by taking the index offline for at least a few seconds. This temporarily causes indexing and query requests + * to fail. Performance and write availability of the index can be impaired for several minutes after the index is + * updated, or longer for very large indexes. + * @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 a search index definition, which describes the fields and search behavior of an index on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String indexName, SearchIndex index, Boolean allowIndexDowntime, + String ifMatch, String ifNoneMatch, RequestOptions requestOptions) { + return createOrUpdateWithResponseAsync(indexName, index, allowIndexDowntime, ifMatch, ifNoneMatch, + requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new search index or updates an index if it already exists. + * + * @param indexName The definition of the index to create or update. + * @param index The definition of the index to create or update. + * @param allowIndexDowntime Allows new analyzers, tokenizers, token filters, or char filters to be added to an + * index by taking the index offline for at least a few seconds. This temporarily causes indexing and query requests + * to fail. Performance and write availability of the index can be impaired for several minutes after the index is + * updated, or longer for very large indexes. + * @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 a search index definition, which describes the fields and search behavior of an index on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String indexName, SearchIndex index, Boolean allowIndexDowntime, + String ifMatch, String ifNoneMatch, RequestOptions requestOptions, Context context) { + return createOrUpdateWithResponseAsync(indexName, index, allowIndexDowntime, ifMatch, ifNoneMatch, + requestOptions, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Deletes a search index and all the documents it contains. This operation is permanent, with no recovery option. + * Make sure you have a master copy of your index definition, data ingestion code, and a backup of the primary data + * source in case you need to re-build the index. + * + * @param indexName The name of the index 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 indexName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> deleteWithResponseAsync(indexName, ifMatch, ifNoneMatch, requestOptions, context)); + } + + /** + * Deletes a search index and all the documents it contains. This operation is permanent, with no recovery option. + * Make sure you have a master copy of your index definition, data ingestion code, and a backup of the primary data + * source in case you need to re-build the index. + * + * @param indexName The name of the index 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 indexName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.delete(this.client.getEndpoint(), indexName, xMsClientRequestId, ifMatch, ifNoneMatch, + this.client.getApiVersion(), accept, context); + } + + /** + * Deletes a search index and all the documents it contains. This operation is permanent, with no recovery option. + * Make sure you have a master copy of your index definition, data ingestion code, and a backup of the primary data + * source in case you need to re-build the index. + * + * @param indexName The name of the index 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 indexName, String ifMatch, String ifNoneMatch, RequestOptions requestOptions) { + return deleteWithResponseAsync(indexName, ifMatch, ifNoneMatch, requestOptions) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a search index and all the documents it contains. This operation is permanent, with no recovery option. + * Make sure you have a master copy of your index definition, data ingestion code, and a backup of the primary data + * source in case you need to re-build the index. + * + * @param indexName The name of the index 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 indexName, String ifMatch, String ifNoneMatch, RequestOptions requestOptions, + Context context) { + return deleteWithResponseAsync(indexName, ifMatch, ifNoneMatch, requestOptions, context) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Retrieves an index definition. + * + * @param indexName The name of the index 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 a search index definition, which describes the fields and search behavior of an index along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String indexName, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> getWithResponseAsync(indexName, requestOptions, context)); + } + + /** + * Retrieves an index definition. + * + * @param indexName The name of the index 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 a search index definition, which describes the fields and search behavior of an index along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String indexName, RequestOptions requestOptions, + Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.get(this.client.getEndpoint(), indexName, xMsClientRequestId, this.client.getApiVersion(), + accept, context); + } + + /** + * Retrieves an index definition. + * + * @param indexName The name of the index 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 a search index definition, which describes the fields and search behavior of an index on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String indexName, RequestOptions requestOptions) { + return getWithResponseAsync(indexName, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves an index definition. + * + * @param indexName The name of the index 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 a search index definition, which describes the fields and search behavior of an index on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String indexName, RequestOptions requestOptions, Context context) { + return getWithResponseAsync(indexName, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns statistics for the given index, including a document count and storage usage. + * + * @param indexName The name of the index for which to retrieve statistics. + * @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 statistics for a given index along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getStatisticsWithResponseAsync(String indexName, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> getStatisticsWithResponseAsync(indexName, requestOptions, context)); + } + + /** + * Returns statistics for the given index, including a document count and storage usage. + * + * @param indexName The name of the index for which to retrieve statistics. + * @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 statistics for a given index along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getStatisticsWithResponseAsync(String indexName, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.getStatistics(this.client.getEndpoint(), indexName, xMsClientRequestId, + this.client.getApiVersion(), accept, context); + } + + /** + * Returns statistics for the given index, including a document count and storage usage. + * + * @param indexName The name of the index for which to retrieve statistics. + * @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 statistics for a given index on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getStatisticsAsync(String indexName, RequestOptions requestOptions) { + return getStatisticsWithResponseAsync(indexName, requestOptions) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns statistics for the given index, including a document count and storage usage. + * + * @param indexName The name of the index for which to retrieve statistics. + * @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 statistics for a given index on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getStatisticsAsync(String indexName, RequestOptions requestOptions, + Context context) { + return getStatisticsWithResponseAsync(indexName, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Shows how an analyzer breaks text into tokens. + * + * @param indexName The name of the index for which to test an analyzer. + * @param request The text and analyzer or analysis components to test. + * @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 result of testing an analyzer on text along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> analyzeWithResponseAsync(String indexName, AnalyzeRequest request, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> analyzeWithResponseAsync(indexName, request, requestOptions, context)); + } + + /** + * Shows how an analyzer breaks text into tokens. + * + * @param indexName The name of the index for which to test an analyzer. + * @param request The text and analyzer or analysis components to test. + * @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 result of testing an analyzer on text along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> analyzeWithResponseAsync(String indexName, AnalyzeRequest request, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.analyze(this.client.getEndpoint(), indexName, xMsClientRequestId, this.client.getApiVersion(), + request, accept, context); + } + + /** + * Shows how an analyzer breaks text into tokens. + * + * @param indexName The name of the index for which to test an analyzer. + * @param request The text and analyzer or analysis components to test. + * @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 result of testing an analyzer on text on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono analyzeAsync(String indexName, AnalyzeRequest request, RequestOptions requestOptions) { + return analyzeWithResponseAsync(indexName, request, requestOptions) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Shows how an analyzer breaks text into tokens. + * + * @param indexName The name of the index for which to test an analyzer. + * @param request The text and analyzer or analysis components to test. + * @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 result of testing an analyzer on text on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono analyzeAsync(String indexName, AnalyzeRequest request, RequestOptions requestOptions, + Context context) { + return analyzeWithResponseAsync(indexName, request, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/KnowledgeBases.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/KnowledgeBases.java new file mode 100644 index 000000000000..1f5f6a14e5fa --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/KnowledgeBases.java @@ -0,0 +1,483 @@ +// 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; + +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.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.models.ErrorResponseException; +import com.azure.search.models.KnowledgeBase; +import com.azure.search.models.ListKnowledgeBasesResult; +import com.azure.search.models.RequestOptions; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in KnowledgeBases. + */ +public final class KnowledgeBases { + /** + * The proxy service used to perform REST calls. + */ + private final KnowledgeBasesService service; + + /** + * The service client containing this operation class. + */ + private final SearchClient client; + + /** + * Initializes an instance of KnowledgeBases. + * + * @param client the instance of the service client containing this operation class. + */ + KnowledgeBases(SearchClient client) { + this.service + = RestProxy.create(KnowledgeBasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchClientKnowledgeBases to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SearchClientKnowledgeBases") + public interface KnowledgeBasesService { + @Put("/knowledgebases('{knowledgeBaseName}')") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @PathParam("knowledgeBaseName") String knowledgeBaseName, + @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, @BodyParam("application/json") KnowledgeBase knowledgeBase, + @HeaderParam("Accept") String accept, Context context); + + @Delete("/knowledgebases('{knowledgeBaseName}')") + @ExpectedResponses({ 204, 404 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @PathParam("knowledgeBaseName") String knowledgeBaseName, + @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("/knowledgebases('{knowledgeBaseName}')") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @PathParam("knowledgeBaseName") String knowledgeBaseName, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Get("/knowledgebases") + @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); + + @Post("/knowledgebases") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") KnowledgeBase knowledgeBase, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Creates a new knowledge base or updates an knowledge base if it already exists. + * + * @param knowledgeBaseName The name of the knowledge base to create or update. + * @param knowledgeBase The definition of the knowledge base 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 the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync(String knowledgeBaseName, + KnowledgeBase knowledgeBase, String ifMatch, String ifNoneMatch, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> createOrUpdateWithResponseAsync(knowledgeBaseName, knowledgeBase, + ifMatch, ifNoneMatch, requestOptions, context)); + } + + /** + * Creates a new knowledge base or updates an knowledge base if it already exists. + * + * @param knowledgeBaseName The name of the knowledge base to create or update. + * @param knowledgeBase The definition of the knowledge base 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 the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync(String knowledgeBaseName, + KnowledgeBase knowledgeBase, String ifMatch, String ifNoneMatch, RequestOptions requestOptions, + Context context) { + final String prefer = "return=representation"; + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.createOrUpdate(this.client.getEndpoint(), knowledgeBaseName, xMsClientRequestId, ifMatch, + ifNoneMatch, prefer, this.client.getApiVersion(), knowledgeBase, accept, context); + } + + /** + * Creates a new knowledge base or updates an knowledge base if it already exists. + * + * @param knowledgeBaseName The name of the knowledge base to create or update. + * @param knowledgeBase The definition of the knowledge base 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 the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String knowledgeBaseName, KnowledgeBase knowledgeBase, + String ifMatch, String ifNoneMatch, RequestOptions requestOptions) { + return createOrUpdateWithResponseAsync(knowledgeBaseName, knowledgeBase, ifMatch, ifNoneMatch, requestOptions) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new knowledge base or updates an knowledge base if it already exists. + * + * @param knowledgeBaseName The name of the knowledge base to create or update. + * @param knowledgeBase The definition of the knowledge base 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 the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String knowledgeBaseName, KnowledgeBase knowledgeBase, + String ifMatch, String ifNoneMatch, RequestOptions requestOptions, Context context) { + return createOrUpdateWithResponseAsync(knowledgeBaseName, knowledgeBase, ifMatch, ifNoneMatch, requestOptions, + context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Deletes an existing knowledge base. + * + * @param knowledgeBaseName The name of the knowledge base 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 knowledgeBaseName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> deleteWithResponseAsync(knowledgeBaseName, ifMatch, ifNoneMatch, requestOptions, context)); + } + + /** + * Deletes an existing knowledge base. + * + * @param knowledgeBaseName The name of the knowledge base 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 knowledgeBaseName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.delete(this.client.getEndpoint(), knowledgeBaseName, xMsClientRequestId, ifMatch, ifNoneMatch, + this.client.getApiVersion(), accept, context); + } + + /** + * Deletes an existing knowledge base. + * + * @param knowledgeBaseName The name of the knowledge base 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 knowledgeBaseName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions) { + return deleteWithResponseAsync(knowledgeBaseName, ifMatch, ifNoneMatch, requestOptions) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes an existing knowledge base. + * + * @param knowledgeBaseName The name of the knowledge base 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 knowledgeBaseName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions, Context context) { + return deleteWithResponseAsync(knowledgeBaseName, ifMatch, ifNoneMatch, requestOptions, context) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Retrieves an knowledge base definition. + * + * @param knowledgeBaseName The name of the knowledge base 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 the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String knowledgeBaseName, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> getWithResponseAsync(knowledgeBaseName, requestOptions, context)); + } + + /** + * Retrieves an knowledge base definition. + * + * @param knowledgeBaseName The name of the knowledge base 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 the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String knowledgeBaseName, RequestOptions requestOptions, + Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.get(this.client.getEndpoint(), knowledgeBaseName, xMsClientRequestId, + this.client.getApiVersion(), accept, context); + } + + /** + * Retrieves an knowledge base definition. + * + * @param knowledgeBaseName The name of the knowledge base 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 the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String knowledgeBaseName, RequestOptions requestOptions) { + return getWithResponseAsync(knowledgeBaseName, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves an knowledge base definition. + * + * @param knowledgeBaseName The name of the knowledge base 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 the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String knowledgeBaseName, RequestOptions requestOptions, Context context) { + return getWithResponseAsync(knowledgeBaseName, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Lists all knowledge bases 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 the response body 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"; + 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().getKnowledgeBases(), null, null)); + } + + /** + * Lists all knowledge bases 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 the paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(RequestOptions requestOptions, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(requestOptions, context)); + } + + /** + * Creates a new knowledge base. + * + * @param knowledgeBase The definition of the knowledge base 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 the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(KnowledgeBase knowledgeBase, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> createWithResponseAsync(knowledgeBase, requestOptions, context)); + } + + /** + * Creates a new knowledge base. + * + * @param knowledgeBase The definition of the knowledge base 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 the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(KnowledgeBase knowledgeBase, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.create(this.client.getEndpoint(), xMsClientRequestId, this.client.getApiVersion(), knowledgeBase, + accept, context); + } + + /** + * Creates a new knowledge base. + * + * @param knowledgeBase The definition of the knowledge base 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 the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync(KnowledgeBase knowledgeBase, RequestOptions requestOptions) { + return createWithResponseAsync(knowledgeBase, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new knowledge base. + * + * @param knowledgeBase The definition of the knowledge base 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 the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync(KnowledgeBase knowledgeBase, RequestOptions requestOptions, + Context context) { + return createWithResponseAsync(knowledgeBase, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/KnowledgeRetrievals.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/KnowledgeRetrievals.java new file mode 100644 index 000000000000..cdc3fe3b8fd8 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/KnowledgeRetrievals.java @@ -0,0 +1,161 @@ +// 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; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.search.models.ErrorResponseException; +import com.azure.search.models.KnowledgeBaseRetrievalRequest; +import com.azure.search.models.KnowledgeBaseRetrievalResponse; +import com.azure.search.models.RequestOptions; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in KnowledgeRetrievals. + */ +public final class KnowledgeRetrievals { + /** + * The proxy service used to perform REST calls. + */ + private final KnowledgeRetrievalsService service; + + /** + * The service client containing this operation class. + */ + private final SearchClient client; + + /** + * Initializes an instance of KnowledgeRetrievals. + * + * @param client the instance of the service client containing this operation class. + */ + KnowledgeRetrievals(SearchClient client) { + this.service = RestProxy.create(KnowledgeRetrievalsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchClientKnowledgeRetrievals to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}/knowledgebases('{knowledgeBaseName}')") + @ServiceInterface(name = "SearchClientKnowledgeRetrievals") + public interface KnowledgeRetrievalsService { + @Post("/retrieve") + @ExpectedResponses({ 200, 206 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> retrieve(@HostParam("endpoint") String endpoint, + @HostParam("knowledgeBaseName") String knowledgeBaseName, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("x-ms-query-source-authorization") String xMsQuerySourceAuthorization, + @BodyParam("application/json") KnowledgeBaseRetrievalRequest retrievalRequest, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * KnowledgeBase retrieves relevant data from backing stores. + * + * @param retrievalRequest The retrieval request to process. + * @param xMsQuerySourceAuthorization Token identifying the user for which the query is being executed. This token + * is used to enforce security restrictions on documents. + * @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 output contract for the retrieval response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> retrieveWithResponseAsync( + KnowledgeBaseRetrievalRequest retrievalRequest, String xMsQuerySourceAuthorization, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> retrieveWithResponseAsync(retrievalRequest, xMsQuerySourceAuthorization, + requestOptions, context)); + } + + /** + * KnowledgeBase retrieves relevant data from backing stores. + * + * @param retrievalRequest The retrieval request to process. + * @param xMsQuerySourceAuthorization Token identifying the user for which the query is being executed. This token + * is used to enforce security restrictions on documents. + * @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 output contract for the retrieval response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> retrieveWithResponseAsync( + KnowledgeBaseRetrievalRequest retrievalRequest, String xMsQuerySourceAuthorization, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.retrieve(this.client.getEndpoint(), this.client.getKnowledgeBaseName(), xMsClientRequestId, + this.client.getApiVersion(), xMsQuerySourceAuthorization, retrievalRequest, accept, context); + } + + /** + * KnowledgeBase retrieves relevant data from backing stores. + * + * @param retrievalRequest The retrieval request to process. + * @param xMsQuerySourceAuthorization Token identifying the user for which the query is being executed. This token + * is used to enforce security restrictions on documents. + * @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 output contract for the retrieval response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono retrieveAsync(KnowledgeBaseRetrievalRequest retrievalRequest, + String xMsQuerySourceAuthorization, RequestOptions requestOptions) { + return retrieveWithResponseAsync(retrievalRequest, xMsQuerySourceAuthorization, requestOptions) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * KnowledgeBase retrieves relevant data from backing stores. + * + * @param retrievalRequest The retrieval request to process. + * @param xMsQuerySourceAuthorization Token identifying the user for which the query is being executed. This token + * is used to enforce security restrictions on documents. + * @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 output contract for the retrieval response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono retrieveAsync(KnowledgeBaseRetrievalRequest retrievalRequest, + String xMsQuerySourceAuthorization, RequestOptions requestOptions, Context context) { + return retrieveWithResponseAsync(retrievalRequest, xMsQuerySourceAuthorization, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/KnowledgeSources.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/KnowledgeSources.java new file mode 100644 index 000000000000..90b18accc143 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/KnowledgeSources.java @@ -0,0 +1,574 @@ +// 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; + +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.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.models.ErrorResponseException; +import com.azure.search.models.KnowledgeSource; +import com.azure.search.models.KnowledgeSourceStatus; +import com.azure.search.models.ListKnowledgeSourcesResult; +import com.azure.search.models.RequestOptions; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in KnowledgeSources. + */ +public final class KnowledgeSources { + /** + * The proxy service used to perform REST calls. + */ + private final KnowledgeSourcesService service; + + /** + * The service client containing this operation class. + */ + private final SearchClient client; + + /** + * Initializes an instance of KnowledgeSources. + * + * @param client the instance of the service client containing this operation class. + */ + KnowledgeSources(SearchClient client) { + this.service + = RestProxy.create(KnowledgeSourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchClientKnowledgeSources to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SearchClientKnowledgeSources") + public interface KnowledgeSourcesService { + @Put("/knowledgesources('{sourceName}')") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @PathParam("sourceName") String sourceName, @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, + @BodyParam("application/json") KnowledgeSource knowledgeSource, @HeaderParam("Accept") String accept, + Context context); + + @Delete("/knowledgesources('{sourceName}')") + @ExpectedResponses({ 204, 404 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> delete(@HostParam("endpoint") String endpoint, @PathParam("sourceName") String sourceName, + @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("/knowledgesources('{sourceName}')") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @PathParam("sourceName") String sourceName, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Get("/knowledgesources") + @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); + + @Post("/knowledgesources") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") KnowledgeSource knowledgeSource, @HeaderParam("Accept") String accept, + Context context); + + @Get("/knowledgesources('{sourceName}')/status") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> getStatus(@HostParam("endpoint") String endpoint, + @PathParam("sourceName") String sourceName, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Creates a new knowledge source or updates an knowledge source if it already exists. + * + * @param sourceName The name of the knowledge source to create or update. + * @param knowledgeSource The definition of the knowledge source 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 a knowledge source definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync(String sourceName, + KnowledgeSource knowledgeSource, String ifMatch, String ifNoneMatch, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> createOrUpdateWithResponseAsync(sourceName, knowledgeSource, ifMatch, + ifNoneMatch, requestOptions, context)); + } + + /** + * Creates a new knowledge source or updates an knowledge source if it already exists. + * + * @param sourceName The name of the knowledge source to create or update. + * @param knowledgeSource The definition of the knowledge source 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 a knowledge source definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync(String sourceName, + KnowledgeSource knowledgeSource, String ifMatch, String ifNoneMatch, RequestOptions requestOptions, + Context context) { + final String prefer = "return=representation"; + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.createOrUpdate(this.client.getEndpoint(), sourceName, xMsClientRequestId, ifMatch, ifNoneMatch, + prefer, this.client.getApiVersion(), knowledgeSource, accept, context); + } + + /** + * Creates a new knowledge source or updates an knowledge source if it already exists. + * + * @param sourceName The name of the knowledge source to create or update. + * @param knowledgeSource The definition of the knowledge source 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 a knowledge source definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String sourceName, KnowledgeSource knowledgeSource, String ifMatch, + String ifNoneMatch, RequestOptions requestOptions) { + return createOrUpdateWithResponseAsync(sourceName, knowledgeSource, ifMatch, ifNoneMatch, requestOptions) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new knowledge source or updates an knowledge source if it already exists. + * + * @param sourceName The name of the knowledge source to create or update. + * @param knowledgeSource The definition of the knowledge source 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 a knowledge source definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String sourceName, KnowledgeSource knowledgeSource, String ifMatch, + String ifNoneMatch, RequestOptions requestOptions, Context context) { + return createOrUpdateWithResponseAsync(sourceName, knowledgeSource, ifMatch, ifNoneMatch, requestOptions, + context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Deletes an existing knowledge source. + * + * @param sourceName The name of the knowledge source 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 sourceName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> deleteWithResponseAsync(sourceName, ifMatch, ifNoneMatch, requestOptions, context)); + } + + /** + * Deletes an existing knowledge source. + * + * @param sourceName The name of the knowledge source 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 sourceName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.delete(this.client.getEndpoint(), sourceName, xMsClientRequestId, ifMatch, ifNoneMatch, + this.client.getApiVersion(), accept, context); + } + + /** + * Deletes an existing knowledge source. + * + * @param sourceName The name of the knowledge source 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 sourceName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions) { + return deleteWithResponseAsync(sourceName, ifMatch, ifNoneMatch, requestOptions) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes an existing knowledge source. + * + * @param sourceName The name of the knowledge source 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 sourceName, String ifMatch, String ifNoneMatch, RequestOptions requestOptions, + Context context) { + return deleteWithResponseAsync(sourceName, ifMatch, ifNoneMatch, requestOptions, context) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Retrieves a knowledge source definition. + * + * @param sourceName The name of the knowledge source 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 a knowledge source definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String sourceName, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> getWithResponseAsync(sourceName, requestOptions, context)); + } + + /** + * Retrieves a knowledge source definition. + * + * @param sourceName The name of the knowledge source 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 a knowledge source definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String sourceName, RequestOptions requestOptions, + Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.get(this.client.getEndpoint(), sourceName, xMsClientRequestId, this.client.getApiVersion(), + accept, context); + } + + /** + * Retrieves a knowledge source definition. + * + * @param sourceName The name of the knowledge source 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 a knowledge source definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String sourceName, RequestOptions requestOptions) { + return getWithResponseAsync(sourceName, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves a knowledge source definition. + * + * @param sourceName The name of the knowledge source 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 a knowledge source definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String sourceName, RequestOptions requestOptions, Context context) { + return getWithResponseAsync(sourceName, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Lists all knowledge sources 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 the response body 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"; + 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().getKnowledgeSources(), null, null)); + } + + /** + * Lists all knowledge sources 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 the paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(RequestOptions requestOptions, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(requestOptions, context)); + } + + /** + * Creates a new knowledge source. + * + * @param knowledgeSource The definition of the knowledge source 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 a knowledge source definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(KnowledgeSource knowledgeSource, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> createWithResponseAsync(knowledgeSource, requestOptions, context)); + } + + /** + * Creates a new knowledge source. + * + * @param knowledgeSource The definition of the knowledge source 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 a knowledge source definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(KnowledgeSource knowledgeSource, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.create(this.client.getEndpoint(), xMsClientRequestId, this.client.getApiVersion(), + knowledgeSource, accept, context); + } + + /** + * Creates a new knowledge source. + * + * @param knowledgeSource The definition of the knowledge source 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 a knowledge source definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync(KnowledgeSource knowledgeSource, RequestOptions requestOptions) { + return createWithResponseAsync(knowledgeSource, requestOptions) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new knowledge source. + * + * @param knowledgeSource The definition of the knowledge source 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 a knowledge source definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync(KnowledgeSource knowledgeSource, RequestOptions requestOptions, + Context context) { + return createWithResponseAsync(knowledgeSource, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns the current status and synchronization history of a knowledge source. + * + * @param sourceName The name of the knowledge source for which to retrieve status. + * @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 the status and synchronization history of a knowledge source along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getStatusWithResponseAsync(String sourceName, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> getStatusWithResponseAsync(sourceName, requestOptions, context)); + } + + /** + * Returns the current status and synchronization history of a knowledge source. + * + * @param sourceName The name of the knowledge source for which to retrieve status. + * @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 the status and synchronization history of a knowledge source along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getStatusWithResponseAsync(String sourceName, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.getStatus(this.client.getEndpoint(), sourceName, xMsClientRequestId, this.client.getApiVersion(), + accept, context); + } + + /** + * Returns the current status and synchronization history of a knowledge source. + * + * @param sourceName The name of the knowledge source for which to retrieve status. + * @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 the status and synchronization history of a knowledge source on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getStatusAsync(String sourceName, RequestOptions requestOptions) { + return getStatusWithResponseAsync(sourceName, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns the current status and synchronization history of a knowledge source. + * + * @param sourceName The name of the knowledge source for which to retrieve status. + * @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 the status and synchronization history of a knowledge source on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getStatusAsync(String sourceName, RequestOptions requestOptions, + Context context) { + return getStatusWithResponseAsync(sourceName, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/SearchClient.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/SearchClient.java new file mode 100644 index 000000000000..5a52280a0232 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/SearchClient.java @@ -0,0 +1,462 @@ +// 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; + +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.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.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.PagedFlux; +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.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.search.models.ErrorResponseException; +import com.azure.search.models.IndexStatisticsSummary; +import com.azure.search.models.ListIndexStatsSummary; +import com.azure.search.models.RequestOptions; +import com.azure.search.models.ServiceStatistics; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the SearchClient type. + */ +public final class SearchClient { + /** + * The proxy service used to perform REST calls. + */ + private final SearchClientService service; + + /** + * The endpoint URL of the search service. + */ + private final String endpoint; + + /** + * Gets The endpoint URL of the search service. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * The name of the knowledge base. + */ + private final String knowledgeBaseName; + + /** + * Gets The name of the knowledge base. + * + * @return the knowledgeBaseName value. + */ + public String getKnowledgeBaseName() { + return this.knowledgeBaseName; + } + + /** + * The name of the index. + */ + private final String indexName; + + /** + * Gets The name of the index. + * + * @return the indexName value. + */ + public String getIndexName() { + return this.indexName; + } + + /** + * Api Version. + */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + public SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The KnowledgeRetrievals object to access its operations. + */ + private final KnowledgeRetrievals knowledgeRetrievals; + + /** + * Gets the KnowledgeRetrievals object to access its operations. + * + * @return the KnowledgeRetrievals object. + */ + public KnowledgeRetrievals getKnowledgeRetrievals() { + return this.knowledgeRetrievals; + } + + /** + * The KnowledgeBases object to access its operations. + */ + private final KnowledgeBases knowledgeBases; + + /** + * Gets the KnowledgeBases object to access its operations. + * + * @return the KnowledgeBases object. + */ + public KnowledgeBases getKnowledgeBases() { + return this.knowledgeBases; + } + + /** + * The KnowledgeSources object to access its operations. + */ + private final KnowledgeSources knowledgeSources; + + /** + * Gets the KnowledgeSources object to access its operations. + * + * @return the KnowledgeSources object. + */ + public KnowledgeSources getKnowledgeSources() { + return this.knowledgeSources; + } + + /** + * The DataSources object to access its operations. + */ + private final DataSources dataSources; + + /** + * Gets the DataSources object to access its operations. + * + * @return the DataSources object. + */ + public DataSources getDataSources() { + return this.dataSources; + } + + /** + * The Indexers object to access its operations. + */ + private final Indexers indexers; + + /** + * Gets the Indexers object to access its operations. + * + * @return the Indexers object. + */ + public Indexers getIndexers() { + return this.indexers; + } + + /** + * The Skillsets object to access its operations. + */ + private final Skillsets skillsets; + + /** + * Gets the Skillsets object to access its operations. + * + * @return the Skillsets object. + */ + public Skillsets getSkillsets() { + return this.skillsets; + } + + /** + * The SynonymMaps object to access its operations. + */ + private final SynonymMaps synonymMaps; + + /** + * Gets the SynonymMaps object to access its operations. + * + * @return the SynonymMaps object. + */ + public SynonymMaps getSynonymMaps() { + return this.synonymMaps; + } + + /** + * The Indexes object to access its operations. + */ + private final Indexes indexes; + + /** + * Gets the Indexes object to access its operations. + * + * @return the Indexes object. + */ + public Indexes getIndexes() { + return this.indexes; + } + + /** + * The Aliases object to access its operations. + */ + private final Aliases aliases; + + /** + * Gets the Aliases object to access its operations. + * + * @return the Aliases object. + */ + public Aliases getAliases() { + return this.aliases; + } + + /** + * The Documents object to access its operations. + */ + private final Documents documents; + + /** + * Gets the Documents object to access its operations. + * + * @return the Documents object. + */ + public Documents getDocuments() { + return this.documents; + } + + /** + * Initializes an instance of SearchClient client. + * + * @param endpoint The endpoint URL of the search service. + * @param knowledgeBaseName The name of the knowledge base. + * @param indexName The name of the index. + * @param apiVersion Api Version. + */ + SearchClient(String endpoint, String knowledgeBaseName, String indexName, String apiVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, knowledgeBaseName, indexName, apiVersion); + } + + /** + * Initializes an instance of SearchClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint The endpoint URL of the search service. + * @param knowledgeBaseName The name of the knowledge base. + * @param indexName The name of the index. + * @param apiVersion Api Version. + */ + SearchClient(HttpPipeline httpPipeline, String endpoint, String knowledgeBaseName, String indexName, + String apiVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, knowledgeBaseName, indexName, + apiVersion); + } + + /** + * Initializes an instance of SearchClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint The endpoint URL of the search service. + * @param knowledgeBaseName The name of the knowledge base. + * @param indexName The name of the index. + * @param apiVersion Api Version. + */ + SearchClient(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + String knowledgeBaseName, String indexName, String apiVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.knowledgeBaseName = knowledgeBaseName; + this.indexName = indexName; + this.apiVersion = apiVersion; + this.knowledgeRetrievals = new KnowledgeRetrievals(this); + this.knowledgeBases = new KnowledgeBases(this); + this.knowledgeSources = new KnowledgeSources(this); + this.dataSources = new DataSources(this); + this.indexers = new Indexers(this); + this.skillsets = new Skillsets(this); + this.synonymMaps = new SynonymMaps(this); + this.indexes = new Indexes(this); + this.aliases = new Aliases(this); + this.documents = new Documents(this); + this.service = RestProxy.create(SearchClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for SearchClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SearchClient") + public interface SearchClientService { + @Get("/servicestats") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> getServiceStatistics(@HostParam("endpoint") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Get("/indexstats") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> getIndexStatsSummary(@HostParam("endpoint") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets service level statistics 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 service level statistics for a search service along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getServiceStatisticsWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> getServiceStatisticsWithResponseAsync(requestOptions, context)); + } + + /** + * Gets service level statistics 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 service level statistics for a search service along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getServiceStatisticsWithResponseAsync(RequestOptions requestOptions, + Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.getServiceStatistics(this.getEndpoint(), xMsClientRequestId, this.getApiVersion(), accept, + context); + } + + /** + * Gets service level statistics 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 service level statistics for a search service on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getServiceStatisticsAsync(RequestOptions requestOptions) { + return getServiceStatisticsWithResponseAsync(requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets service level statistics 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 service level statistics for a search service on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getServiceStatisticsAsync(RequestOptions requestOptions, Context context) { + return getServiceStatisticsWithResponseAsync(requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves a summary of statistics for all indexes in the 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 request to retrieve stats summary of all indexes along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> + getIndexStatsSummarySinglePageAsync(RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service + .getIndexStatsSummary(this.getEndpoint(), xMsClientRequestId, this.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getIndexesStatistics(), null, null)); + } + + /** + * Retrieves a summary of statistics for all indexes in the 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 request to retrieve stats summary of all indexes as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getIndexStatsSummaryAsync(RequestOptions requestOptions, Context context) { + return new PagedFlux<>(() -> getIndexStatsSummarySinglePageAsync(requestOptions, context)); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/SearchClientBuilder.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/SearchClientBuilder.java new file mode 100644 index 000000000000..41c850211cd1 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/SearchClientBuilder.java @@ -0,0 +1,346 @@ +// 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; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the SearchClient type. + */ +@ServiceClientBuilder(serviceClients = { SearchClient.class }) +public final class SearchClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = new HashMap<>(); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the SearchClientBuilder. + */ + @Generated + public SearchClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SearchClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SearchClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SearchClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SearchClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SearchClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SearchClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SearchClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SearchClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The name of the knowledge base. + */ + @Generated + private String knowledgeBaseName; + + /** + * Sets The name of the knowledge base. + * + * @param knowledgeBaseName the knowledgeBaseName value. + * @return the SearchClientBuilder. + */ + @Generated + public SearchClientBuilder knowledgeBaseName(String knowledgeBaseName) { + this.knowledgeBaseName = knowledgeBaseName; + return this; + } + + /* + * The name of the index. + */ + @Generated + private String indexName; + + /** + * Sets The name of the index. + * + * @param indexName the indexName value. + * @return the SearchClientBuilder. + */ + @Generated + public SearchClientBuilder indexName(String indexName) { + this.indexName = indexName; + return this; + } + + /* + * Api Version + */ + @Generated + private String apiVersion; + + /** + * Sets Api Version. + * + * @param apiVersion the apiVersion value. + * @return the SearchClientBuilder. + */ + @Generated + public SearchClientBuilder apiVersion(String apiVersion) { + this.apiVersion = apiVersion; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + @Generated + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the SearchClientBuilder. + */ + @Generated + public SearchClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the SearchClientBuilder. + */ + @Generated + public SearchClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of SearchClient with the provided parameters. + * + * @return an instance of SearchClient. + */ + @Generated + public SearchClient buildClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localApiVersion = (apiVersion != null) ? apiVersion : "2025-11-01-preview"; + SerializerAdapter localSerializerAdapter + = (serializerAdapter != null) ? serializerAdapter : JacksonAdapter.createDefaultSerializerAdapter(); + SearchClient client = new SearchClient(localPipeline, localSerializerAdapter, this.endpoint, + this.knowledgeBaseName, this.indexName, localApiVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + Objects.requireNonNull(knowledgeBaseName, "'knowledgeBaseName' cannot be null."); + Objects.requireNonNull(indexName, "'indexName' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + private static final ClientLogger LOGGER = new ClientLogger(SearchClientBuilder.class); +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Skillsets.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Skillsets.java new file mode 100644 index 000000000000..83f1918047f0 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/Skillsets.java @@ -0,0 +1,625 @@ +// 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; + +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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.search.models.ErrorResponseException; +import com.azure.search.models.ListSkillsetsResult; +import com.azure.search.models.RequestOptions; +import com.azure.search.models.SearchIndexerSkillset; +import com.azure.search.models.SkillNames; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Skillsets. + */ +public final class Skillsets { + /** + * The proxy service used to perform REST calls. + */ + private final SkillsetsService service; + + /** + * The service client containing this operation class. + */ + private final SearchClient client; + + /** + * Initializes an instance of Skillsets. + * + * @param client the instance of the service client containing this operation class. + */ + Skillsets(SearchClient client) { + this.service + = RestProxy.create(SkillsetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchClientSkillsets to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SearchClientSkillsets") + public interface SkillsetsService { + @Put("/skillsets('{skillsetName}')") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @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, + @QueryParam("ignoreResetRequirements") Boolean skipIndexerResetRequirementForCache, + @QueryParam("disableCacheReprocessingChangeDetection") Boolean disableCacheReprocessingChangeDetection, + @BodyParam("application/json") SearchIndexerSkillset skillset, @HeaderParam("Accept") String accept, + Context context); + + @Delete("/skillsets('{skillsetName}')") + @ExpectedResponses({ 204, 404 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @PathParam("skillsetName") String skillsetName, + @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("/skillsets('{skillsetName}')") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> get(@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, Context context); + + @Get("/skillsets") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("$select") String select, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Post("/skillsets") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") SearchIndexerSkillset skillset, + @HeaderParam("Accept") String accept, 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, @BodyParam("application/json") SkillNames skillNames, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Creates a new skillset in a search service or updates the skillset if it already exists. + * + * @param skillsetName The name of the skillset to create or update. + * @param skillset The skillset containing one or more skills to create or update in a search service. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of skills along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync(String skillsetName, + SearchIndexerSkillset skillset, String ifMatch, String ifNoneMatch, Boolean skipIndexerResetRequirementForCache, + Boolean disableCacheReprocessingChangeDetection, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> createOrUpdateWithResponseAsync(skillsetName, skillset, ifMatch, ifNoneMatch, + skipIndexerResetRequirementForCache, disableCacheReprocessingChangeDetection, requestOptions, context)); + } + + /** + * Creates a new skillset in a search service or updates the skillset if it already exists. + * + * @param skillsetName The name of the skillset to create or update. + * @param skillset The skillset containing one or more skills to create or update in a search service. + * @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 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. + * @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 list of skills along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync(String skillsetName, + SearchIndexerSkillset skillset, String ifMatch, String ifNoneMatch, Boolean skipIndexerResetRequirementForCache, + Boolean disableCacheReprocessingChangeDetection, RequestOptions requestOptions, Context context) { + final String prefer = "return=representation"; + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.createOrUpdate(this.client.getEndpoint(), skillsetName, xMsClientRequestId, ifMatch, ifNoneMatch, + prefer, this.client.getApiVersion(), skipIndexerResetRequirementForCache, + disableCacheReprocessingChangeDetection, skillset, accept, context); + } + + /** + * Creates a new skillset in a search service or updates the skillset if it already exists. + * + * @param skillsetName The name of the skillset to create or update. + * @param skillset The skillset containing one or more skills to create or update in a search service. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of skills on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String skillsetName, SearchIndexerSkillset skillset, + 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())); + } + + /** + * Creates a new skillset in a search service or updates the skillset if it already exists. + * + * @param skillsetName The name of the skillset to create or update. + * @param skillset The skillset containing one or more skills to create or update in a search service. + * @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 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. + * @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 list of skills on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String skillsetName, SearchIndexerSkillset skillset, + 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())); + } + + /** + * Deletes a skillset in a search service. + * + * @param skillsetName The name of the skillset 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 skillsetName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> deleteWithResponseAsync(skillsetName, ifMatch, ifNoneMatch, requestOptions, context)); + } + + /** + * Deletes a skillset in a search service. + * + * @param skillsetName The name of the skillset 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 skillsetName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.delete(this.client.getEndpoint(), skillsetName, xMsClientRequestId, ifMatch, ifNoneMatch, + this.client.getApiVersion(), accept, context); + } + + /** + * Deletes a skillset in a search service. + * + * @param skillsetName The name of the skillset 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 skillsetName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions) { + return deleteWithResponseAsync(skillsetName, ifMatch, ifNoneMatch, requestOptions) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a skillset in a search service. + * + * @param skillsetName The name of the skillset 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 skillsetName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions, Context context) { + return deleteWithResponseAsync(skillsetName, ifMatch, ifNoneMatch, requestOptions, context) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Retrieves a skillset in a search service. + * + * @param skillsetName The name of the skillset 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 a list of skills along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String skillsetName, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> getWithResponseAsync(skillsetName, requestOptions, context)); + } + + /** + * Retrieves a skillset in a search service. + * + * @param skillsetName The name of the skillset 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 a list of skills along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String skillsetName, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.get(this.client.getEndpoint(), skillsetName, xMsClientRequestId, this.client.getApiVersion(), + accept, context); + } + + /** + * Retrieves a skillset in a search service. + * + * @param skillsetName The name of the skillset 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 a list of skills on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String skillsetName, RequestOptions requestOptions) { + return getWithResponseAsync(skillsetName, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves a skillset in a search service. + * + * @param skillsetName The name of the skillset 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 a list of skills on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String skillsetName, RequestOptions requestOptions, Context context) { + return getWithResponseAsync(skillsetName, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * List all skillsets in a search service. + * + * @param select Selects which top-level properties of the skillsets to retrieve. Specified as a comma-separated + * list of JSON property names, or '*' for all properties. The default is all properties. + * @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 skillset request along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(String select, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> listWithResponseAsync(select, requestOptions, context)); + } + + /** + * List all skillsets in a search service. + * + * @param select Selects which top-level properties of the skillsets to retrieve. Specified as a comma-separated + * list of JSON property names, or '*' for all properties. The default is all properties. + * @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 skillset request along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(String select, RequestOptions requestOptions, + Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.list(this.client.getEndpoint(), select, xMsClientRequestId, this.client.getApiVersion(), accept, + context); + } + + /** + * List all skillsets in a search service. + * + * @param select Selects which top-level properties of the skillsets to retrieve. Specified as a comma-separated + * list of JSON property names, or '*' for all properties. The default is all properties. + * @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 skillset request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listAsync(String select, RequestOptions requestOptions) { + return listWithResponseAsync(select, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * List all skillsets in a search service. + * + * @param select Selects which top-level properties of the skillsets to retrieve. Specified as a comma-separated + * list of JSON property names, or '*' for all properties. The default is all properties. + * @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 skillset request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listAsync(String select, RequestOptions requestOptions, Context context) { + return listWithResponseAsync(select, requestOptions, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new skillset in a search service. + * + * @param skillset The skillset containing one or more skills to create in 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 a list of skills along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(SearchIndexerSkillset skillset, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> createWithResponseAsync(skillset, requestOptions, context)); + } + + /** + * Creates a new skillset in a search service. + * + * @param skillset The skillset containing one or more skills to create in 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 a list of skills along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(SearchIndexerSkillset skillset, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.create(this.client.getEndpoint(), xMsClientRequestId, this.client.getApiVersion(), skillset, + accept, context); + } + + /** + * Creates a new skillset in a search service. + * + * @param skillset The skillset containing one or more skills to create in 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 a list of skills on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync(SearchIndexerSkillset skillset, RequestOptions requestOptions) { + return createWithResponseAsync(skillset, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new skillset in a search service. + * + * @param skillset The skillset containing one or more skills to create in 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 a list of skills on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync(SearchIndexerSkillset skillset, RequestOptions requestOptions, + Context context) { + return createWithResponseAsync(skillset, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.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) { + return FluxUtil + .withContext(context -> resetSkillsWithResponseAsync(skillsetName, skillNames, requestOptions, 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"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.resetSkills(this.client.getEndpoint(), skillsetName, xMsClientRequestId, + this.client.getApiVersion(), skillNames, accept, 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()); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/SynonymMaps.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/SynonymMaps.java new file mode 100644 index 000000000000..3315d78d5d66 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/SynonymMaps.java @@ -0,0 +1,515 @@ +// 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; + +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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.search.models.ErrorResponseException; +import com.azure.search.models.ListSynonymMapsResult; +import com.azure.search.models.RequestOptions; +import com.azure.search.models.SynonymMap; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SynonymMaps. + */ +public final class SynonymMaps { + /** + * The proxy service used to perform REST calls. + */ + private final SynonymMapsService service; + + /** + * The service client containing this operation class. + */ + private final SearchClient client; + + /** + * Initializes an instance of SynonymMaps. + * + * @param client the instance of the service client containing this operation class. + */ + SynonymMaps(SearchClient client) { + this.service + = RestProxy.create(SynonymMapsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchClientSynonymMaps to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SearchClientSynonymMaps") + public interface SynonymMapsService { + @Put("/synonymmaps('{synonymMapName}')") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @PathParam("synonymMapName") String synonymMapName, + @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, @BodyParam("application/json") SynonymMap synonymMap, + @HeaderParam("Accept") String accept, Context context); + + @Delete("/synonymmaps('{synonymMapName}')") + @ExpectedResponses({ 204, 404 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @PathParam("synonymMapName") String synonymMapName, + @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("/synonymmaps('{synonymMapName}')") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @PathParam("synonymMapName") String synonymMapName, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Get("/synonymmaps") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("$select") String select, @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Post("/synonymmaps") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID xMsClientRequestId, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") SynonymMap synonymMap, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Creates a new synonym map or updates a synonym map if it already exists. + * + * @param synonymMapName The name of the synonym map to create or update. + * @param synonymMap The definition of the synonym map 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 a synonym map definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync(String synonymMapName, SynonymMap synonymMap, + String ifMatch, String ifNoneMatch, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> createOrUpdateWithResponseAsync(synonymMapName, synonymMap, ifMatch, + ifNoneMatch, requestOptions, context)); + } + + /** + * Creates a new synonym map or updates a synonym map if it already exists. + * + * @param synonymMapName The name of the synonym map to create or update. + * @param synonymMap The definition of the synonym map 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 a synonym map definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync(String synonymMapName, SynonymMap synonymMap, + String ifMatch, String ifNoneMatch, RequestOptions requestOptions, Context context) { + final String prefer = "return=representation"; + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.createOrUpdate(this.client.getEndpoint(), synonymMapName, xMsClientRequestId, ifMatch, + ifNoneMatch, prefer, this.client.getApiVersion(), synonymMap, accept, context); + } + + /** + * Creates a new synonym map or updates a synonym map if it already exists. + * + * @param synonymMapName The name of the synonym map to create or update. + * @param synonymMap The definition of the synonym map 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 a synonym map definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String synonymMapName, SynonymMap synonymMap, String ifMatch, + String ifNoneMatch, RequestOptions requestOptions) { + return createOrUpdateWithResponseAsync(synonymMapName, synonymMap, ifMatch, ifNoneMatch, requestOptions) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new synonym map or updates a synonym map if it already exists. + * + * @param synonymMapName The name of the synonym map to create or update. + * @param synonymMap The definition of the synonym map 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 a synonym map definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String synonymMapName, SynonymMap synonymMap, String ifMatch, + String ifNoneMatch, RequestOptions requestOptions, Context context) { + return createOrUpdateWithResponseAsync(synonymMapName, synonymMap, ifMatch, ifNoneMatch, requestOptions, + context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Deletes a synonym map. + * + * @param synonymMapName The name of the synonym map 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 synonymMapName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> deleteWithResponseAsync(synonymMapName, ifMatch, ifNoneMatch, requestOptions, context)); + } + + /** + * Deletes a synonym map. + * + * @param synonymMapName The name of the synonym map 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 synonymMapName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.delete(this.client.getEndpoint(), synonymMapName, xMsClientRequestId, ifMatch, ifNoneMatch, + this.client.getApiVersion(), accept, context); + } + + /** + * Deletes a synonym map. + * + * @param synonymMapName The name of the synonym map 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 synonymMapName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions) { + return deleteWithResponseAsync(synonymMapName, ifMatch, ifNoneMatch, requestOptions) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a synonym map. + * + * @param synonymMapName The name of the synonym map 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 synonymMapName, String ifMatch, String ifNoneMatch, + RequestOptions requestOptions, Context context) { + return deleteWithResponseAsync(synonymMapName, ifMatch, ifNoneMatch, requestOptions, context) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Retrieves a synonym map definition. + * + * @param synonymMapName The name of the synonym map 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 a synonym map definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String synonymMapName, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> getWithResponseAsync(synonymMapName, requestOptions, context)); + } + + /** + * Retrieves a synonym map definition. + * + * @param synonymMapName The name of the synonym map 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 a synonym map definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String synonymMapName, RequestOptions requestOptions, + Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.get(this.client.getEndpoint(), synonymMapName, xMsClientRequestId, this.client.getApiVersion(), + accept, context); + } + + /** + * Retrieves a synonym map definition. + * + * @param synonymMapName The name of the synonym map 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 a synonym map definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String synonymMapName, RequestOptions requestOptions) { + return getWithResponseAsync(synonymMapName, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves a synonym map definition. + * + * @param synonymMapName The name of the synonym map 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 a synonym map definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String synonymMapName, RequestOptions requestOptions, Context context) { + return getWithResponseAsync(synonymMapName, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Lists all synonym maps available for a search service. + * + * @param select Selects which top-level properties of the synonym maps to retrieve. Specified as a comma-separated + * list of JSON property names, or '*' for all properties. The default is all properties. + * @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 SynonymMaps request along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(String select, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> listWithResponseAsync(select, requestOptions, context)); + } + + /** + * Lists all synonym maps available for a search service. + * + * @param select Selects which top-level properties of the synonym maps to retrieve. Specified as a comma-separated + * list of JSON property names, or '*' for all properties. The default is all properties. + * @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 SynonymMaps request along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(String select, RequestOptions requestOptions, + Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.list(this.client.getEndpoint(), select, xMsClientRequestId, this.client.getApiVersion(), accept, + context); + } + + /** + * Lists all synonym maps available for a search service. + * + * @param select Selects which top-level properties of the synonym maps to retrieve. Specified as a comma-separated + * list of JSON property names, or '*' for all properties. The default is all properties. + * @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 SynonymMaps request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listAsync(String select, RequestOptions requestOptions) { + return listWithResponseAsync(select, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Lists all synonym maps available for a search service. + * + * @param select Selects which top-level properties of the synonym maps to retrieve. Specified as a comma-separated + * list of JSON property names, or '*' for all properties. The default is all properties. + * @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 SynonymMaps request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listAsync(String select, RequestOptions requestOptions, Context context) { + return listWithResponseAsync(select, requestOptions, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new synonym map. + * + * @param synonymMap The definition of the synonym map 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 a synonym map definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(SynonymMap synonymMap, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> createWithResponseAsync(synonymMap, requestOptions, context)); + } + + /** + * Creates a new synonym map. + * + * @param synonymMap The definition of the synonym map 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 a synonym map definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(SynonymMap synonymMap, RequestOptions requestOptions, + Context context) { + final String accept = "application/json"; + UUID xMsClientRequestIdInternal = null; + if (requestOptions != null) { + xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); + } + UUID xMsClientRequestId = xMsClientRequestIdInternal; + return service.create(this.client.getEndpoint(), xMsClientRequestId, this.client.getApiVersion(), synonymMap, + accept, context); + } + + /** + * Creates a new synonym map. + * + * @param synonymMap The definition of the synonym map 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 a synonym map definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync(SynonymMap synonymMap, RequestOptions requestOptions) { + return createWithResponseAsync(synonymMap, requestOptions).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new synonym map. + * + * @param synonymMap The definition of the synonym map 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 a synonym map definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync(SynonymMap synonymMap, RequestOptions requestOptions, Context context) { + return createWithResponseAsync(synonymMap, requestOptions, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/implementation/models/AnalyzeResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/implementation/models/AnalyzeResult.java new file mode 100644 index 000000000000..8033f3d62d4b --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/implementation/models/AnalyzeResult.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.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.search.models.AnalyzedTokenInfo; +import java.io.IOException; +import java.util.List; + +/** + * The result of testing an analyzer on text. + */ +@Fluent +public final class AnalyzeResult implements JsonSerializable { + /* + * The list of tokens returned by the analyzer specified in the request. + */ + @Generated + private List tokens; + + /** + * Creates an instance of AnalyzeResult class. + */ + @Generated + public AnalyzeResult() { + } + + /** + * Get the tokens property: The list of tokens returned by the analyzer specified in the request. + * + * @return the tokens value. + */ + @Generated + public List getTokens() { + return this.tokens; + } + + /** + * Set the tokens property: The list of tokens returned by the analyzer specified in the request. + * + * @param tokens the tokens value to set. + * @return the AnalyzeResult object itself. + */ + @Generated + public AnalyzeResult setTokens(List tokens) { + this.tokens = tokens; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("tokens", this.tokens, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AnalyzeResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AnalyzeResult 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 AnalyzeResult. + */ + @Generated + public static AnalyzeResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AnalyzeResult deserializedAnalyzeResult = new AnalyzeResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tokens".equals(fieldName)) { + List tokens = reader.readArray(reader1 -> AnalyzedTokenInfo.fromJson(reader1)); + deserializedAnalyzeResult.tokens = tokens; + } else { + reader.skipChildren(); + } + } + + return deserializedAnalyzeResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/implementation/models/package-info.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/implementation/models/package-info.java new file mode 100644 index 000000000000..5c7816fd3772 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/implementation/models/package-info.java @@ -0,0 +1,10 @@ +// 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 containing the data models for SearchClient. + * Client that can be used to query an knowledge base. + */ +package com.azure.search.implementation.models; diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIFoundryModelCatalogName.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIFoundryModelCatalogName.java new file mode 100644 index 000000000000..1edb64a955fe --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIFoundryModelCatalogName.java @@ -0,0 +1,93 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The name of the embedding model from the Azure AI Foundry Catalog that will be called. + */ +public final class AIFoundryModelCatalogName extends ExpandableStringEnum { + /** + * Static value OpenAI-CLIP-Image-Text-Embeddings-vit-base-patch32 for AIFoundryModelCatalogName. + */ + @Generated + public static final AIFoundryModelCatalogName 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 AIFoundryModelCatalogName. + */ + @Generated + public static final AIFoundryModelCatalogName 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 AIFoundryModelCatalogName. + */ + @Generated + public static final AIFoundryModelCatalogName FACEBOOK_DINO_V2IMAGE_EMBEDDINGS_VI_TBASE + = fromString("Facebook-DinoV2-Image-Embeddings-ViT-Base"); + + /** + * Static value Facebook-DinoV2-Image-Embeddings-ViT-Giant for AIFoundryModelCatalogName. + */ + @Generated + public static final AIFoundryModelCatalogName FACEBOOK_DINO_V2IMAGE_EMBEDDINGS_VI_TGIANT + = fromString("Facebook-DinoV2-Image-Embeddings-ViT-Giant"); + + /** + * Static value Cohere-embed-v3-english for AIFoundryModelCatalogName. + */ + @Generated + public static final AIFoundryModelCatalogName COHERE_EMBED_V3ENGLISH = fromString("Cohere-embed-v3-english"); + + /** + * Static value Cohere-embed-v3-multilingual for AIFoundryModelCatalogName. + */ + @Generated + public static final AIFoundryModelCatalogName COHERE_EMBED_V3MULTILINGUAL + = fromString("Cohere-embed-v3-multilingual"); + + /** + * Cohere embed v4 model for generating embeddings from both text and images. + */ + @Generated + public static final AIFoundryModelCatalogName COHERE_EMBED_V4 = fromString("Cohere-embed-v4"); + + /** + * Creates a new instance of AIFoundryModelCatalogName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public AIFoundryModelCatalogName() { + } + + /** + * Creates or finds a AIFoundryModelCatalogName from its string representation. + * + * @param name a name to look for. + * @return the corresponding AIFoundryModelCatalogName. + */ + @Generated + public static AIFoundryModelCatalogName fromString(String name) { + return fromString(name, AIFoundryModelCatalogName.class); + } + + /** + * Gets known AIFoundryModelCatalogName values. + * + * @return known AIFoundryModelCatalogName values. + */ + @Generated + public static Collection values() { + return values(AIFoundryModelCatalogName.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServices.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServices.java new file mode 100644 index 000000000000..44f8bae23c5c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServices.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Parameters for Azure Blob Storage knowledge source. + */ +@Fluent +public final class AIServices implements JsonSerializable { + /* + * The URI of the AI Services endpoint. + */ + @Generated + private String uri; + + /* + * The API key for accessing AI Services. + */ + @Generated + private String apiKey; + + /** + * Creates an instance of AIServices class. + */ + @Generated + public AIServices() { + } + + /** + * Get the uri property: The URI of the AI Services endpoint. + * + * @return the uri value. + */ + @Generated + public String getUri() { + return this.uri; + } + + /** + * Set the uri property: The URI of the AI Services endpoint. + * + * @param uri the uri value to set. + * @return the AIServices object itself. + */ + @Generated + public AIServices setUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the apiKey property: The API key for accessing AI Services. + * + * @return the apiKey value. + */ + @Generated + public String getApiKey() { + return this.apiKey; + } + + /** + * Set the apiKey property: The API key for accessing AI Services. + * + * @param apiKey the apiKey value to set. + * @return the AIServices object itself. + */ + @Generated + public AIServices setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("uri", this.uri); + jsonWriter.writeStringField("apiKey", this.apiKey); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AIServices from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AIServices 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 AIServices. + */ + @Generated + public static AIServices fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AIServices deserializedAIServices = new AIServices(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("uri".equals(fieldName)) { + deserializedAIServices.uri = reader.getString(); + } else if ("apiKey".equals(fieldName)) { + deserializedAIServices.apiKey = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAIServices; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServicesAccountIdentity.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServicesAccountIdentity.java new file mode 100644 index 000000000000..8a017f7a997b --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServicesAccountIdentity.java @@ -0,0 +1,164 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The multi-region account of an Azure AI service resource that's attached to a skillset. + */ +@Fluent +public final class AIServicesAccountIdentity extends CognitiveServicesAccount { + /* + * A URI fragment specifying the type of Azure AI service resource attached to a skillset. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.AIServicesByIdentity"; + + /* + * The user-assigned managed identity used for connections to AI Service. If not specified, the system-assigned + * managed identity is used. On updates to the skillset, if the identity is unspecified, the value remains + * unchanged. If set to "none", the value of this property is cleared. + */ + @Generated + private SearchIndexerDataIdentity identity; + + /* + * The subdomain url for the corresponding AI Service. + */ + @Generated + private String subdomainUrl; + + /** + * Creates an instance of AIServicesAccountIdentity class. + */ + @Generated + public AIServicesAccountIdentity() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of Azure AI service resource attached to a + * skillset. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the identity property: The user-assigned managed identity used for connections to AI Service. If not + * specified, the system-assigned managed identity is used. On updates to the skillset, if the identity is + * unspecified, the value remains unchanged. If set to "none", the value of this property is cleared. + * + * @return the identity value. + */ + @Generated + public SearchIndexerDataIdentity getIdentity() { + return this.identity; + } + + /** + * Set the identity property: The user-assigned managed identity used for connections to AI Service. If not + * specified, the system-assigned managed identity is used. On updates to the skillset, 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 AIServicesAccountIdentity object itself. + */ + @Generated + public AIServicesAccountIdentity setIdentity(SearchIndexerDataIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the subdomainUrl property: The subdomain url for the corresponding AI Service. + * + * @return the subdomainUrl value. + */ + @Generated + public String getSubdomainUrl() { + return this.subdomainUrl; + } + + /** + * Set the subdomainUrl property: The subdomain url for the corresponding AI Service. + * + * @param subdomainUrl the subdomainUrl value to set. + * @return the AIServicesAccountIdentity object itself. + */ + @Generated + public AIServicesAccountIdentity setSubdomainUrl(String subdomainUrl) { + this.subdomainUrl = subdomainUrl; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AIServicesAccountIdentity setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", getDescription()); + jsonWriter.writeStringField("subdomainUrl", this.subdomainUrl); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AIServicesAccountIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AIServicesAccountIdentity 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 AIServicesAccountIdentity. + */ + @Generated + public static AIServicesAccountIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AIServicesAccountIdentity deserializedAIServicesAccountIdentity = new AIServicesAccountIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedAIServicesAccountIdentity.setDescription(reader.getString()); + } else if ("subdomainUrl".equals(fieldName)) { + deserializedAIServicesAccountIdentity.subdomainUrl = reader.getString(); + } else if ("@odata.type".equals(fieldName)) { + deserializedAIServicesAccountIdentity.odataType = reader.getString(); + } else if ("identity".equals(fieldName)) { + deserializedAIServicesAccountIdentity.identity = SearchIndexerDataIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAIServicesAccountIdentity; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServicesAccountKey.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServicesAccountKey.java new file mode 100644 index 000000000000..b98bdcfddf0f --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServicesAccountKey.java @@ -0,0 +1,159 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The account key of an Azure AI service resource that's attached to a skillset, to be used with the resource's + * subdomain. + */ +@Fluent +public final class AIServicesAccountKey extends CognitiveServicesAccount { + /* + * A URI fragment specifying the type of Azure AI service resource attached to a skillset. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.AIServicesByKey"; + + /* + * The key used to provision the Azure AI service resource attached to a skillset. + */ + @Generated + private String key; + + /* + * The subdomain url for the corresponding AI Service. + */ + @Generated + private String subdomainUrl; + + /** + * Creates an instance of AIServicesAccountKey class. + */ + @Generated + public AIServicesAccountKey() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of Azure AI service resource attached to a + * skillset. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the key property: The key used to provision the Azure AI service resource attached to a skillset. + * + * @return the key value. + */ + @Generated + public String getKey() { + return this.key; + } + + /** + * Set the key property: The key used to provision the Azure AI service resource attached to a skillset. + * + * @param key the key value to set. + * @return the AIServicesAccountKey object itself. + */ + @Generated + public AIServicesAccountKey setKey(String key) { + this.key = key; + return this; + } + + /** + * Get the subdomainUrl property: The subdomain url for the corresponding AI Service. + * + * @return the subdomainUrl value. + */ + @Generated + public String getSubdomainUrl() { + return this.subdomainUrl; + } + + /** + * Set the subdomainUrl property: The subdomain url for the corresponding AI Service. + * + * @param subdomainUrl the subdomainUrl value to set. + * @return the AIServicesAccountKey object itself. + */ + @Generated + public AIServicesAccountKey setSubdomainUrl(String subdomainUrl) { + this.subdomainUrl = subdomainUrl; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AIServicesAccountKey setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", getDescription()); + jsonWriter.writeStringField("key", this.key); + jsonWriter.writeStringField("subdomainUrl", this.subdomainUrl); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AIServicesAccountKey from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AIServicesAccountKey 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 AIServicesAccountKey. + */ + @Generated + public static AIServicesAccountKey fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AIServicesAccountKey deserializedAIServicesAccountKey = new AIServicesAccountKey(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedAIServicesAccountKey.setDescription(reader.getString()); + } else if ("key".equals(fieldName)) { + deserializedAIServicesAccountKey.key = reader.getString(); + } else if ("subdomainUrl".equals(fieldName)) { + deserializedAIServicesAccountKey.subdomainUrl = reader.getString(); + } else if ("@odata.type".equals(fieldName)) { + deserializedAIServicesAccountKey.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAIServicesAccountKey; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServicesVisionParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServicesVisionParameters.java new file mode 100644 index 000000000000..00326ba7b08a --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServicesVisionParameters.java @@ -0,0 +1,198 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +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 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. + */ + @Generated + private String modelVersion; + + /* + * The resource URI of the AI Services resource. + */ + @Generated + private String resourceUri; + + /* + * API key of the designated AI Services resource. + */ + @Generated + 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. + */ + @Generated + private SearchIndexerDataIdentity authIdentity; + + /** + * Creates an instance of AIServicesVisionParameters class. + */ + @Generated + public AIServicesVisionParameters() { + } + + /** + * 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. + */ + @Generated + public String getModelVersion() { + return this.modelVersion; + } + + /** + * Set 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. + * + * @param modelVersion the modelVersion value to set. + * @return the AIServicesVisionParameters object itself. + */ + @Generated + public AIServicesVisionParameters setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + return this; + } + + /** + * Get the resourceUri property: The resource URI of the AI Services resource. + * + * @return the resourceUri value. + */ + @Generated + public String getResourceUri() { + return this.resourceUri; + } + + /** + * Set the resourceUri property: The resource URI of the AI Services resource. + * + * @param resourceUri the resourceUri value to set. + * @return the AIServicesVisionParameters object itself. + */ + @Generated + public AIServicesVisionParameters setResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + /** + * Get the apiKey property: API key of the designated AI Services resource. + * + * @return the apiKey value. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + public AIServicesVisionParameters setAuthIdentity(SearchIndexerDataIdentity authIdentity) { + this.authIdentity = authIdentity; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + public static AIServicesVisionParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AIServicesVisionParameters deserializedAIServicesVisionParameters = new AIServicesVisionParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("modelVersion".equals(fieldName)) { + deserializedAIServicesVisionParameters.modelVersion = reader.getString(); + } else if ("resourceUri".equals(fieldName)) { + deserializedAIServicesVisionParameters.resourceUri = reader.getString(); + } else if ("apiKey".equals(fieldName)) { + deserializedAIServicesVisionParameters.apiKey = reader.getString(); + } else if ("authIdentity".equals(fieldName)) { + deserializedAIServicesVisionParameters.authIdentity = SearchIndexerDataIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAIServicesVisionParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServicesVisionVectorizer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServicesVisionVectorizer.java new file mode 100644 index 000000000000..e5dd4820ec7b --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AIServicesVisionVectorizer.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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. + */ + @Generated + private VectorSearchVectorizerKind kind = VectorSearchVectorizerKind.AISERVICES_VISION; + + /* + * Contains the parameters specific to AI Services Vision embedding vectorization. + */ + @Generated + private AIServicesVisionParameters aIServicesVisionParameters; + + /** + * Creates an instance of AIServicesVisionVectorizer class. + */ + @Generated + public AIServicesVisionVectorizer() { + } + + /** + * Get the kind property: The name of the kind of vectorization method being configured for use with vector search. + * + * @return the kind value. + */ + @Generated + @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. + */ + @Generated + 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. + */ + @Generated + public AIServicesVisionVectorizer + setAIServicesVisionParameters(AIServicesVisionParameters aIServicesVisionParameters) { + this.aIServicesVisionParameters = aIServicesVisionParameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AIServicesVisionVectorizer setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + 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. + */ + @Generated + public static AIServicesVisionVectorizer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AIServicesVisionVectorizer deserializedAIServicesVisionVectorizer = new AIServicesVisionVectorizer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedAIServicesVisionVectorizer.setName(reader.getString()); + } else if ("kind".equals(fieldName)) { + deserializedAIServicesVisionVectorizer.kind + = VectorSearchVectorizerKind.fromString(reader.getString()); + } else if ("aiServicesVisionParameters".equals(fieldName)) { + deserializedAIServicesVisionVectorizer.aIServicesVisionParameters + = AIServicesVisionParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAIServicesVisionVectorizer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AMLParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AMLParameters.java new file mode 100644 index 000000000000..658298ee1c20 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AMLParameters.java @@ -0,0 +1,266 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 AMLParameters 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. + */ + @Generated + private String scoringUri; + + /* + * (Required for key authentication) The key for the AML service. + */ + @Generated + 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}. + */ + @Generated + private String resourceId; + + /* + * (Optional) When specified, indicates the timeout for the http client making the API call. + */ + @Generated + private Duration timeout; + + /* + * (Optional for token authentication). The region the AML service is deployed in. + */ + @Generated + private String region; + + /* + * The name of the embedding model from the Azure AI Foundry Catalog that is deployed at the provided endpoint. + */ + @Generated + private AIFoundryModelCatalogName modelName; + + /** + * Creates an instance of AMLParameters class. + */ + @Generated + public AMLParameters() { + } + + /** + * 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. + */ + @Generated + 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 AMLParameters object itself. + */ + @Generated + public AMLParameters 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. + */ + @Generated + 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 AMLParameters object itself. + */ + @Generated + public AMLParameters 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. + */ + @Generated + 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 AMLParameters object itself. + */ + @Generated + public AMLParameters 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. + */ + @Generated + 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 AMLParameters object itself. + */ + @Generated + public AMLParameters 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. + */ + @Generated + 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 AMLParameters object itself. + */ + @Generated + public AMLParameters setRegion(String region) { + this.region = region; + return this; + } + + /** + * Get the modelName property: The name of the embedding model from the Azure AI Foundry Catalog that is deployed at + * the provided endpoint. + * + * @return the modelName value. + */ + @Generated + public AIFoundryModelCatalogName getModelName() { + return this.modelName; + } + + /** + * Set the modelName property: The name of the embedding model from the Azure AI Foundry Catalog that is deployed at + * the provided endpoint. + * + * @param modelName the modelName value to set. + * @return the AMLParameters object itself. + */ + @Generated + public AMLParameters setModelName(AIFoundryModelCatalogName modelName) { + this.modelName = modelName; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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 AMLParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AMLParameters 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 AMLParameters. + */ + @Generated + public static AMLParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AMLParameters deserializedAMLParameters = new AMLParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("uri".equals(fieldName)) { + deserializedAMLParameters.scoringUri = reader.getString(); + } else if ("key".equals(fieldName)) { + deserializedAMLParameters.authenticationKey = reader.getString(); + } else if ("resourceId".equals(fieldName)) { + deserializedAMLParameters.resourceId = reader.getString(); + } else if ("timeout".equals(fieldName)) { + deserializedAMLParameters.timeout + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("region".equals(fieldName)) { + deserializedAMLParameters.region = reader.getString(); + } else if ("modelName".equals(fieldName)) { + deserializedAMLParameters.modelName = AIFoundryModelCatalogName.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAMLParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AMLVectorizer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AMLVectorizer.java new file mode 100644 index 000000000000..7f0d29cffd45 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AMLVectorizer.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 Foundry Model Catalog for generating the + * vector embedding of a query string. + */ +@Fluent +public final class AMLVectorizer extends VectorSearchVectorizer { + /* + * The name of the kind of vectorization method being configured for use with vector search. + */ + @Generated + private VectorSearchVectorizerKind kind = VectorSearchVectorizerKind.AML; + + /* + * Specifies the properties of the AML vectorizer. + */ + @Generated + private AMLParameters aMLParameters; + + /** + * Creates an instance of AMLVectorizer class. + */ + @Generated + public AMLVectorizer() { + } + + /** + * Get the kind property: The name of the kind of vectorization method being configured for use with vector search. + * + * @return the kind value. + */ + @Generated + @Override + public VectorSearchVectorizerKind getKind() { + return this.kind; + } + + /** + * Get the aMLParameters property: Specifies the properties of the AML vectorizer. + * + * @return the aMLParameters value. + */ + @Generated + public AMLParameters getAMLParameters() { + return this.aMLParameters; + } + + /** + * Set the aMLParameters property: Specifies the properties of the AML vectorizer. + * + * @param aMLParameters the aMLParameters value to set. + * @return the AMLVectorizer object itself. + */ + @Generated + public AMLVectorizer setAMLParameters(AMLParameters aMLParameters) { + this.aMLParameters = aMLParameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AMLVectorizer setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("amlParameters", this.aMLParameters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AMLVectorizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AMLVectorizer 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 AMLVectorizer. + */ + @Generated + public static AMLVectorizer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AMLVectorizer deserializedAMLVectorizer = new AMLVectorizer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedAMLVectorizer.setName(reader.getString()); + } else if ("kind".equals(fieldName)) { + deserializedAMLVectorizer.kind = VectorSearchVectorizerKind.fromString(reader.getString()); + } else if ("amlParameters".equals(fieldName)) { + deserializedAMLVectorizer.aMLParameters = AMLParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAMLVectorizer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AnalyzeRequest.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AnalyzeRequest.java new file mode 100644 index 000000000000..572f0a305f39 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AnalyzeRequest.java @@ -0,0 +1,268 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Specifies some text and analysis components used to break that text into tokens. + */ +@Fluent +public final class AnalyzeRequest implements JsonSerializable { + /* + * The text to break into tokens. + */ + @Generated + private String text; + + /* + * The name of the analyzer to use to break the given text. If this parameter is not specified, you must specify a + * tokenizer instead. The tokenizer and analyzer parameters are mutually exclusive. + */ + @Generated + private LexicalAnalyzerName analyzer; + + /* + * The name of the tokenizer to use to break the given text. If this parameter is not specified, you must specify an + * analyzer instead. The tokenizer and analyzer parameters are mutually exclusive. + */ + @Generated + private LexicalTokenizerName tokenizer; + + /* + * The name of the normalizer to use to normalize the given text. + */ + @Generated + 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. + */ + @Generated + private List tokenFilters; + + /* + * An optional list of character filters to use when breaking the given text. This parameter can only be set when + * using the tokenizer parameter. + */ + @Generated + private List charFilters; + + /** + * Creates an instance of AnalyzeRequest class. + */ + @Generated + public AnalyzeRequest() { + } + + /** + * Get the text property: The text to break into tokens. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Set the text property: The text to break into tokens. + * + * @param text the text value to set. + * @return the AnalyzeRequest object itself. + */ + @Generated + public AnalyzeRequest setText(String text) { + this.text = text; + return this; + } + + /** + * Get the analyzer property: The name of the analyzer to use to break the given text. If this parameter is not + * specified, you must specify a tokenizer instead. The tokenizer and analyzer parameters are mutually exclusive. + * + * @return the analyzer value. + */ + @Generated + public LexicalAnalyzerName getAnalyzer() { + return this.analyzer; + } + + /** + * Set the analyzer property: The name of the analyzer to use to break the given text. If this parameter is not + * specified, you must specify a tokenizer instead. The tokenizer and analyzer parameters are mutually exclusive. + * + * @param analyzer the analyzer value to set. + * @return the AnalyzeRequest object itself. + */ + @Generated + public AnalyzeRequest setAnalyzer(LexicalAnalyzerName analyzer) { + this.analyzer = analyzer; + return this; + } + + /** + * Get the tokenizer property: The name of the tokenizer to use to break the given text. If this parameter is not + * specified, you must specify an analyzer instead. The tokenizer and analyzer parameters are mutually exclusive. + * + * @return the tokenizer value. + */ + @Generated + public LexicalTokenizerName getTokenizer() { + return this.tokenizer; + } + + /** + * Set the tokenizer property: The name of the tokenizer to use to break the given text. If this parameter is not + * specified, you must specify an analyzer instead. The tokenizer and analyzer parameters are mutually exclusive. + * + * @param tokenizer the tokenizer value to set. + * @return the AnalyzeRequest object itself. + */ + @Generated + public AnalyzeRequest setTokenizer(LexicalTokenizerName tokenizer) { + this.tokenizer = tokenizer; + return this; + } + + /** + * Get the normalizer property: The name of the normalizer to use to normalize the given text. + * + * @return the normalizer value. + */ + @Generated + 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. + */ + @Generated + 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. + * + * @return the tokenFilters value. + */ + @Generated + public List getTokenFilters() { + return this.tokenFilters; + } + + /** + * Set 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. + * + * @param tokenFilters the tokenFilters value to set. + * @return the AnalyzeRequest object itself. + */ + @Generated + public AnalyzeRequest setTokenFilters(List tokenFilters) { + this.tokenFilters = tokenFilters; + return this; + } + + /** + * Get the charFilters property: An optional list of character filters to use when breaking the given text. This + * parameter can only be set when using the tokenizer parameter. + * + * @return the charFilters value. + */ + @Generated + public List getCharFilters() { + return this.charFilters; + } + + /** + * Set the charFilters property: An optional list of character filters to use when breaking the given text. This + * parameter can only be set when using the tokenizer parameter. + * + * @param charFilters the charFilters value to set. + * @return the AnalyzeRequest object itself. + */ + @Generated + public AnalyzeRequest setCharFilters(List charFilters) { + this.charFilters = charFilters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + 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, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AnalyzeRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AnalyzeRequest 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 AnalyzeRequest. + */ + @Generated + public static AnalyzeRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AnalyzeRequest deserializedAnalyzeRequest = new AnalyzeRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("text".equals(fieldName)) { + deserializedAnalyzeRequest.text = reader.getString(); + } else if ("analyzer".equals(fieldName)) { + deserializedAnalyzeRequest.analyzer = LexicalAnalyzerName.fromString(reader.getString()); + } else if ("tokenizer".equals(fieldName)) { + deserializedAnalyzeRequest.tokenizer = LexicalTokenizerName.fromString(reader.getString()); + } else if ("normalizer".equals(fieldName)) { + deserializedAnalyzeRequest.normalizer = LexicalNormalizerName.fromString(reader.getString()); + } else if ("tokenFilters".equals(fieldName)) { + List tokenFilters + = reader.readArray(reader1 -> TokenFilterName.fromString(reader1.getString())); + deserializedAnalyzeRequest.tokenFilters = tokenFilters; + } else if ("charFilters".equals(fieldName)) { + List charFilters + = reader.readArray(reader1 -> CharFilterName.fromString(reader1.getString())); + deserializedAnalyzeRequest.charFilters = charFilters; + } else { + reader.skipChildren(); + } + } + + return deserializedAnalyzeRequest; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AnalyzedTokenInfo.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AnalyzedTokenInfo.java new file mode 100644 index 000000000000..a2a66a12e3f1 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AnalyzedTokenInfo.java @@ -0,0 +1,139 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Information about a token returned by an analyzer. + */ +@Immutable +public final class AnalyzedTokenInfo implements JsonSerializable { + /* + * The token returned by the analyzer. + */ + @Generated + private String token; + + /* + * The index of the first character of the token in the input text. + */ + @Generated + private int startOffset; + + /* + * The index of the last character of the token in the input text. + */ + @Generated + private int endOffset; + + /* + * The position of the token in the input text relative to other tokens. The first token in the input text has + * position 0, the next has position 1, and so on. Depending on the analyzer used, some tokens might have the same + * position, for example if they are synonyms of each other. + */ + @Generated + private int position; + + /** + * Creates an instance of AnalyzedTokenInfo class. + */ + @Generated + public AnalyzedTokenInfo() { + } + + /** + * Get the token property: The token returned by the analyzer. + * + * @return the token value. + */ + @Generated + public String getToken() { + return this.token; + } + + /** + * Get the startOffset property: The index of the first character of the token in the input text. + * + * @return the startOffset value. + */ + @Generated + public int getStartOffset() { + return this.startOffset; + } + + /** + * Get the endOffset property: The index of the last character of the token in the input text. + * + * @return the endOffset value. + */ + @Generated + public int getEndOffset() { + return this.endOffset; + } + + /** + * Get the position property: The position of the token in the input text relative to other tokens. The first token + * in the input text has position 0, the next has position 1, and so on. Depending on the analyzer used, some tokens + * might have the same position, for example if they are synonyms of each other. + * + * @return the position value. + */ + @Generated + public int getPosition() { + return this.position; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AnalyzedTokenInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AnalyzedTokenInfo 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 AnalyzedTokenInfo. + */ + @Generated + public static AnalyzedTokenInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AnalyzedTokenInfo deserializedAnalyzedTokenInfo = new AnalyzedTokenInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("token".equals(fieldName)) { + deserializedAnalyzedTokenInfo.token = reader.getString(); + } else if ("startOffset".equals(fieldName)) { + deserializedAnalyzedTokenInfo.startOffset = reader.getInt(); + } else if ("endOffset".equals(fieldName)) { + deserializedAnalyzedTokenInfo.endOffset = reader.getInt(); + } else if ("position".equals(fieldName)) { + deserializedAnalyzedTokenInfo.position = reader.getInt(); + } else { + reader.skipChildren(); + } + } + + return deserializedAnalyzedTokenInfo; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AsciiFoldingTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AsciiFoldingTokenFilter.java new file mode 100644 index 000000000000..024eade2725c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AsciiFoldingTokenFilter.java @@ -0,0 +1,128 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * 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. This token filter is + * implemented using Apache Lucene. + */ +@Fluent +public final class AsciiFoldingTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.AsciiFoldingTokenFilter"; + + /* + * A value indicating whether the original token will be kept. Default is false. + */ + @Generated + private Boolean preserveOriginal; + + /** + * Creates an instance of AsciiFoldingTokenFilter class. + */ + @Generated + public AsciiFoldingTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the preserveOriginal property: A value indicating whether the original token will be kept. Default is false. + * + * @return the preserveOriginal value. + */ + @Generated + public Boolean isPreserveOriginal() { + return this.preserveOriginal; + } + + /** + * Set the preserveOriginal property: A value indicating whether the original token will be kept. Default is false. + * + * @param preserveOriginal the preserveOriginal value to set. + * @return the AsciiFoldingTokenFilter object itself. + */ + @Generated + public AsciiFoldingTokenFilter setPreserveOriginal(Boolean preserveOriginal) { + this.preserveOriginal = preserveOriginal; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AsciiFoldingTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeBooleanField("preserveOriginal", this.preserveOriginal); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AsciiFoldingTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AsciiFoldingTokenFilter 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 AsciiFoldingTokenFilter. + */ + @Generated + public static AsciiFoldingTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AsciiFoldingTokenFilter deserializedAsciiFoldingTokenFilter = new AsciiFoldingTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedAsciiFoldingTokenFilter.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedAsciiFoldingTokenFilter.odataType = reader.getString(); + } else if ("preserveOriginal".equals(fieldName)) { + deserializedAsciiFoldingTokenFilter.preserveOriginal = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedAsciiFoldingTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteItem.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteItem.java new file mode 100644 index 000000000000..2c3d53360f9d --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteItem.java @@ -0,0 +1,99 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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 result of Autocomplete requests. + */ +@Immutable +public final class AutocompleteItem implements JsonSerializable { + /* + * The completed term. + */ + @Generated + private String text; + + /* + * The query along with the completed term. + */ + @Generated + private String queryPlusText; + + /** + * Creates an instance of AutocompleteItem class. + */ + @Generated + public AutocompleteItem() { + } + + /** + * Get the text property: The completed term. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Get the queryPlusText property: The query along with the completed term. + * + * @return the queryPlusText value. + */ + @Generated + public String getQueryPlusText() { + return this.queryPlusText; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutocompleteItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutocompleteItem 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 AutocompleteItem. + */ + @Generated + public static AutocompleteItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutocompleteItem deserializedAutocompleteItem = new AutocompleteItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("text".equals(fieldName)) { + deserializedAutocompleteItem.text = reader.getString(); + } else if ("queryPlusText".equals(fieldName)) { + deserializedAutocompleteItem.queryPlusText = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAutocompleteItem; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteMode.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteMode.java new file mode 100644 index 000000000000..df323e29835b --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteMode.java @@ -0,0 +1,67 @@ +// 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.models; + +/** + * Specifies the mode for Autocomplete. The default is 'oneTerm'. Use 'twoTerms' to get shingles and + * 'oneTermWithContext' to use the current context in producing autocomplete terms. + */ +public enum AutocompleteMode { + /** + * Only one term is suggested. If the query has two terms, only the last term is completed. For example, if the + * input is 'washington medic', the suggested terms could include 'medicaid', 'medicare', and 'medicine'. + */ + ONE_TERM("oneTerm"), + + /** + * Matching two-term phrases in the index will be suggested. For example, if the input is 'medic', the suggested + * terms could include 'medicare coverage' and 'medical assistant'. + */ + TWO_TERMS("twoTerms"), + + /** + * Completes the last term in a query with two or more terms, where the last two terms are a phrase that exists in + * the index. For example, if the input is 'washington medic', the suggested terms could include 'washington + * medicaid' and 'washington medical'. + */ + ONE_TERM_WITH_CONTEXT("oneTermWithContext"); + + /** + * The actual serialized value for a AutocompleteMode instance. + */ + private final String value; + + AutocompleteMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutocompleteMode instance. + * + * @param value the serialized value to parse. + * @return the parsed AutocompleteMode object, or null if unable to parse. + */ + public static AutocompleteMode fromString(String value) { + if (value == null) { + return null; + } + AutocompleteMode[] items = AutocompleteMode.values(); + for (AutocompleteMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteOptions.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteOptions.java new file mode 100644 index 000000000000..bcf87d97a8a0 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteOptions.java @@ -0,0 +1,278 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import java.util.List; + +/** + * Parameter group. + */ +@Fluent +public final class AutocompleteOptions { + /* + * Specifies the mode for Autocomplete. The default is 'oneTerm'. Use 'twoTerms' to get shingles and + * 'oneTermWithContext' to use the current context while producing auto-completed terms. + */ + @Generated + private AutocompleteMode autocompleteMode; + + /* + * An OData expression that filters the documents used to produce completed terms for the Autocomplete result. + */ + @Generated + private String filter; + + /* + * A value indicating whether to use fuzzy matching for the autocomplete query. Default is false. When set to true, + * the query will find terms even if there's a substituted or missing character in the search text. While this + * provides a better experience in some scenarios, it comes at a performance cost as fuzzy autocomplete queries are + * slower and consume more resources. + */ + @Generated + private Boolean useFuzzyMatching; + + /* + * A string tag that is appended to hit highlights. Must be set with highlightPreTag. If omitted, hit highlighting + * is disabled. + */ + @Generated + private String highlightPostTag; + + /* + * A string tag that is prepended to hit highlights. Must be set with highlightPostTag. If omitted, hit highlighting + * is disabled. + */ + @Generated + private String highlightPreTag; + + /* + * A number between 0 and 100 indicating the percentage of the index that must be covered by an autocomplete query + * in order for the query to be reported as a success. This parameter can be useful for ensuring search availability + * even for services with only one replica. The default is 80. + */ + @Generated + private Double minimumCoverage; + + /* + * The list of field names to consider when querying for auto-completed terms. Target fields must be included in the + * specified suggester. + */ + @Generated + private List searchFields; + + /* + * The number of auto-completed terms to retrieve. This must be a value between 1 and 100. The default is 5. + */ + @Generated + private Integer top; + + /** + * Creates an instance of AutocompleteOptions class. + */ + @Generated + public AutocompleteOptions() { + } + + /** + * Get the autocompleteMode property: Specifies the mode for Autocomplete. The default is 'oneTerm'. Use 'twoTerms' + * to get shingles and 'oneTermWithContext' to use the current context while producing auto-completed terms. + * + * @return the autocompleteMode value. + */ + @Generated + public AutocompleteMode getAutocompleteMode() { + return this.autocompleteMode; + } + + /** + * Set the autocompleteMode property: Specifies the mode for Autocomplete. The default is 'oneTerm'. Use 'twoTerms' + * to get shingles and 'oneTermWithContext' to use the current context while producing auto-completed terms. + * + * @param autocompleteMode the autocompleteMode value to set. + * @return the AutocompleteOptions object itself. + */ + @Generated + public AutocompleteOptions setAutocompleteMode(AutocompleteMode autocompleteMode) { + this.autocompleteMode = autocompleteMode; + return this; + } + + /** + * Get the filter property: An OData expression that filters the documents used to produce completed terms for the + * Autocomplete result. + * + * @return the filter value. + */ + @Generated + public String getFilter() { + return this.filter; + } + + /** + * Set the filter property: An OData expression that filters the documents used to produce completed terms for the + * Autocomplete result. + * + * @param filter the filter value to set. + * @return the AutocompleteOptions object itself. + */ + @Generated + public AutocompleteOptions setFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get the useFuzzyMatching property: A value indicating whether to use fuzzy matching for the autocomplete query. + * Default is false. When set to true, the query will find terms even if there's a substituted or missing character + * in the search text. While this provides a better experience in some scenarios, it comes at a performance cost as + * fuzzy autocomplete queries are slower and consume more resources. + * + * @return the useFuzzyMatching value. + */ + @Generated + public Boolean isUseFuzzyMatching() { + return this.useFuzzyMatching; + } + + /** + * Set the useFuzzyMatching property: A value indicating whether to use fuzzy matching for the autocomplete query. + * Default is false. When set to true, the query will find terms even if there's a substituted or missing character + * in the search text. While this provides a better experience in some scenarios, it comes at a performance cost as + * fuzzy autocomplete queries are slower and consume more resources. + * + * @param useFuzzyMatching the useFuzzyMatching value to set. + * @return the AutocompleteOptions object itself. + */ + @Generated + public AutocompleteOptions setUseFuzzyMatching(Boolean useFuzzyMatching) { + this.useFuzzyMatching = useFuzzyMatching; + return this; + } + + /** + * Get the highlightPostTag property: A string tag that is appended to hit highlights. Must be set with + * highlightPreTag. If omitted, hit highlighting is disabled. + * + * @return the highlightPostTag value. + */ + @Generated + public String getHighlightPostTag() { + return this.highlightPostTag; + } + + /** + * Set the highlightPostTag property: A string tag that is appended to hit highlights. Must be set with + * highlightPreTag. If omitted, hit highlighting is disabled. + * + * @param highlightPostTag the highlightPostTag value to set. + * @return the AutocompleteOptions object itself. + */ + @Generated + public AutocompleteOptions setHighlightPostTag(String highlightPostTag) { + this.highlightPostTag = highlightPostTag; + return this; + } + + /** + * Get the highlightPreTag property: A string tag that is prepended to hit highlights. Must be set with + * highlightPostTag. If omitted, hit highlighting is disabled. + * + * @return the highlightPreTag value. + */ + @Generated + public String getHighlightPreTag() { + return this.highlightPreTag; + } + + /** + * Set the highlightPreTag property: A string tag that is prepended to hit highlights. Must be set with + * highlightPostTag. If omitted, hit highlighting is disabled. + * + * @param highlightPreTag the highlightPreTag value to set. + * @return the AutocompleteOptions object itself. + */ + @Generated + public AutocompleteOptions setHighlightPreTag(String highlightPreTag) { + this.highlightPreTag = highlightPreTag; + return this; + } + + /** + * Get the minimumCoverage property: A number between 0 and 100 indicating the percentage of the index that must be + * covered by an autocomplete query in order for the query to be reported as a success. This parameter can be useful + * for ensuring search availability even for services with only one replica. The default is 80. + * + * @return the minimumCoverage value. + */ + @Generated + public Double getMinimumCoverage() { + return this.minimumCoverage; + } + + /** + * Set the minimumCoverage property: A number between 0 and 100 indicating the percentage of the index that must be + * covered by an autocomplete query in order for the query to be reported as a success. This parameter can be useful + * for ensuring search availability even for services with only one replica. The default is 80. + * + * @param minimumCoverage the minimumCoverage value to set. + * @return the AutocompleteOptions object itself. + */ + @Generated + public AutocompleteOptions setMinimumCoverage(Double minimumCoverage) { + this.minimumCoverage = minimumCoverage; + return this; + } + + /** + * Get the searchFields property: The list of field names to consider when querying for auto-completed terms. Target + * fields must be included in the specified suggester. + * + * @return the searchFields value. + */ + @Generated + public List getSearchFields() { + return this.searchFields; + } + + /** + * Set the searchFields property: The list of field names to consider when querying for auto-completed terms. Target + * fields must be included in the specified suggester. + * + * @param searchFields the searchFields value to set. + * @return the AutocompleteOptions object itself. + */ + @Generated + public AutocompleteOptions setSearchFields(List searchFields) { + this.searchFields = searchFields; + return this; + } + + /** + * Get the top property: The number of auto-completed terms to retrieve. This must be a value between 1 and 100. The + * default is 5. + * + * @return the top value. + */ + @Generated + public Integer getTop() { + return this.top; + } + + /** + * Set the top property: The number of auto-completed terms to retrieve. This must be a value between 1 and 100. The + * default is 5. + * + * @param top the top value to set. + * @return the AutocompleteOptions object itself. + */ + @Generated + public AutocompleteOptions setTop(Integer top) { + this.top = top; + return this; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteRequest.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteRequest.java new file mode 100644 index 000000000000..db0e35a69c66 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteRequest.java @@ -0,0 +1,407 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Parameters for fuzzy matching, and other autocomplete query behaviors. + */ +@Fluent +public final class AutocompleteRequest implements JsonSerializable { + /* + * The search text on which to base autocomplete results. + */ + @Generated + private String searchText; + + /* + * Specifies the mode for Autocomplete. The default is 'oneTerm'. Use 'twoTerms' to get shingles and + * 'oneTermWithContext' to use the current context while producing auto-completed terms. + */ + @Generated + private AutocompleteMode autocompleteMode; + + /* + * An OData expression that filters the documents used to produce completed terms for the Autocomplete result. + */ + @Generated + private String filter; + + /* + * A value indicating whether to use fuzzy matching for the autocomplete query. Default is false. When set to true, + * the query will autocomplete terms even if there's a substituted or missing character in the search text. While + * this provides a better experience in some scenarios, it comes at a performance cost as fuzzy autocomplete queries + * are slower and consume more resources. + */ + @Generated + private Boolean useFuzzyMatching; + + /* + * A string tag that is appended to hit highlights. Must be set with highlightPreTag. If omitted, hit highlighting + * is disabled. + */ + @Generated + private String highlightPostTag; + + /* + * A string tag that is prepended to hit highlights. Must be set with highlightPostTag. If omitted, hit highlighting + * is disabled. + */ + @Generated + private String highlightPreTag; + + /* + * A number between 0 and 100 indicating the percentage of the index that must be covered by an autocomplete query + * in order for the query to be reported as a success. This parameter can be useful for ensuring search availability + * even for services with only one replica. The default is 80. + */ + @Generated + private Double minimumCoverage; + + /* + * The comma-separated list of field names to consider when querying for auto-completed terms. Target fields must be + * included in the specified suggester. + */ + @Generated + private String searchFields; + + /* + * The name of the suggester as specified in the suggesters collection that's part of the index definition. + */ + @Generated + private String suggesterName; + + /* + * The number of auto-completed terms to retrieve. This must be a value between 1 and 100. The default is 5. + */ + @Generated + private Integer top; + + /** + * Creates an instance of AutocompleteRequest class. + */ + @Generated + public AutocompleteRequest() { + } + + /** + * Get the searchText property: The search text on which to base autocomplete results. + * + * @return the searchText value. + */ + @Generated + public String getSearchText() { + return this.searchText; + } + + /** + * Set the searchText property: The search text on which to base autocomplete results. + * + * @param searchText the searchText value to set. + * @return the AutocompleteRequest object itself. + */ + @Generated + public AutocompleteRequest setSearchText(String searchText) { + this.searchText = searchText; + return this; + } + + /** + * Get the autocompleteMode property: Specifies the mode for Autocomplete. The default is 'oneTerm'. Use 'twoTerms' + * to get shingles and 'oneTermWithContext' to use the current context while producing auto-completed terms. + * + * @return the autocompleteMode value. + */ + @Generated + public AutocompleteMode getAutocompleteMode() { + return this.autocompleteMode; + } + + /** + * Set the autocompleteMode property: Specifies the mode for Autocomplete. The default is 'oneTerm'. Use 'twoTerms' + * to get shingles and 'oneTermWithContext' to use the current context while producing auto-completed terms. + * + * @param autocompleteMode the autocompleteMode value to set. + * @return the AutocompleteRequest object itself. + */ + @Generated + public AutocompleteRequest setAutocompleteMode(AutocompleteMode autocompleteMode) { + this.autocompleteMode = autocompleteMode; + return this; + } + + /** + * Get the filter property: An OData expression that filters the documents used to produce completed terms for the + * Autocomplete result. + * + * @return the filter value. + */ + @Generated + public String getFilter() { + return this.filter; + } + + /** + * Set the filter property: An OData expression that filters the documents used to produce completed terms for the + * Autocomplete result. + * + * @param filter the filter value to set. + * @return the AutocompleteRequest object itself. + */ + @Generated + public AutocompleteRequest setFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get the useFuzzyMatching property: A value indicating whether to use fuzzy matching for the autocomplete query. + * Default is false. When set to true, the query will autocomplete terms even if there's a substituted or missing + * character in the search text. While this provides a better experience in some scenarios, it comes at a + * performance cost as fuzzy autocomplete queries are slower and consume more resources. + * + * @return the useFuzzyMatching value. + */ + @Generated + public Boolean isUseFuzzyMatching() { + return this.useFuzzyMatching; + } + + /** + * Set the useFuzzyMatching property: A value indicating whether to use fuzzy matching for the autocomplete query. + * Default is false. When set to true, the query will autocomplete terms even if there's a substituted or missing + * character in the search text. While this provides a better experience in some scenarios, it comes at a + * performance cost as fuzzy autocomplete queries are slower and consume more resources. + * + * @param useFuzzyMatching the useFuzzyMatching value to set. + * @return the AutocompleteRequest object itself. + */ + @Generated + public AutocompleteRequest setUseFuzzyMatching(Boolean useFuzzyMatching) { + this.useFuzzyMatching = useFuzzyMatching; + return this; + } + + /** + * Get the highlightPostTag property: A string tag that is appended to hit highlights. Must be set with + * highlightPreTag. If omitted, hit highlighting is disabled. + * + * @return the highlightPostTag value. + */ + @Generated + public String getHighlightPostTag() { + return this.highlightPostTag; + } + + /** + * Set the highlightPostTag property: A string tag that is appended to hit highlights. Must be set with + * highlightPreTag. If omitted, hit highlighting is disabled. + * + * @param highlightPostTag the highlightPostTag value to set. + * @return the AutocompleteRequest object itself. + */ + @Generated + public AutocompleteRequest setHighlightPostTag(String highlightPostTag) { + this.highlightPostTag = highlightPostTag; + return this; + } + + /** + * Get the highlightPreTag property: A string tag that is prepended to hit highlights. Must be set with + * highlightPostTag. If omitted, hit highlighting is disabled. + * + * @return the highlightPreTag value. + */ + @Generated + public String getHighlightPreTag() { + return this.highlightPreTag; + } + + /** + * Set the highlightPreTag property: A string tag that is prepended to hit highlights. Must be set with + * highlightPostTag. If omitted, hit highlighting is disabled. + * + * @param highlightPreTag the highlightPreTag value to set. + * @return the AutocompleteRequest object itself. + */ + @Generated + public AutocompleteRequest setHighlightPreTag(String highlightPreTag) { + this.highlightPreTag = highlightPreTag; + return this; + } + + /** + * Get the minimumCoverage property: A number between 0 and 100 indicating the percentage of the index that must be + * covered by an autocomplete query in order for the query to be reported as a success. This parameter can be useful + * for ensuring search availability even for services with only one replica. The default is 80. + * + * @return the minimumCoverage value. + */ + @Generated + public Double getMinimumCoverage() { + return this.minimumCoverage; + } + + /** + * Set the minimumCoverage property: A number between 0 and 100 indicating the percentage of the index that must be + * covered by an autocomplete query in order for the query to be reported as a success. This parameter can be useful + * for ensuring search availability even for services with only one replica. The default is 80. + * + * @param minimumCoverage the minimumCoverage value to set. + * @return the AutocompleteRequest object itself. + */ + @Generated + public AutocompleteRequest setMinimumCoverage(Double minimumCoverage) { + this.minimumCoverage = minimumCoverage; + return this; + } + + /** + * Get the searchFields property: The comma-separated list of field names to consider when querying for + * auto-completed terms. Target fields must be included in the specified suggester. + * + * @return the searchFields value. + */ + @Generated + public String getSearchFields() { + return this.searchFields; + } + + /** + * Set the searchFields property: The comma-separated list of field names to consider when querying for + * auto-completed terms. Target fields must be included in the specified suggester. + * + * @param searchFields the searchFields value to set. + * @return the AutocompleteRequest object itself. + */ + @Generated + public AutocompleteRequest setSearchFields(String searchFields) { + this.searchFields = searchFields; + return this; + } + + /** + * Get the suggesterName property: The name of the suggester as specified in the suggesters collection that's part + * of the index definition. + * + * @return the suggesterName value. + */ + @Generated + public String getSuggesterName() { + return this.suggesterName; + } + + /** + * Set the suggesterName property: The name of the suggester as specified in the suggesters collection that's part + * of the index definition. + * + * @param suggesterName the suggesterName value to set. + * @return the AutocompleteRequest object itself. + */ + @Generated + public AutocompleteRequest setSuggesterName(String suggesterName) { + this.suggesterName = suggesterName; + return this; + } + + /** + * Get the top property: The number of auto-completed terms to retrieve. This must be a value between 1 and 100. The + * default is 5. + * + * @return the top value. + */ + @Generated + public Integer getTop() { + return this.top; + } + + /** + * Set the top property: The number of auto-completed terms to retrieve. This must be a value between 1 and 100. The + * default is 5. + * + * @param top the top value to set. + * @return the AutocompleteRequest object itself. + */ + @Generated + public AutocompleteRequest setTop(Integer top) { + this.top = top; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("search", this.searchText); + jsonWriter.writeStringField("suggesterName", this.suggesterName); + jsonWriter.writeStringField("autocompleteMode", + this.autocompleteMode == null ? null : this.autocompleteMode.toString()); + jsonWriter.writeStringField("filter", this.filter); + jsonWriter.writeBooleanField("fuzzy", this.useFuzzyMatching); + jsonWriter.writeStringField("highlightPostTag", this.highlightPostTag); + jsonWriter.writeStringField("highlightPreTag", this.highlightPreTag); + jsonWriter.writeNumberField("minimumCoverage", this.minimumCoverage); + jsonWriter.writeStringField("searchFields", this.searchFields); + jsonWriter.writeNumberField("top", this.top); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutocompleteRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutocompleteRequest 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 AutocompleteRequest. + */ + @Generated + public static AutocompleteRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutocompleteRequest deserializedAutocompleteRequest = new AutocompleteRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("search".equals(fieldName)) { + deserializedAutocompleteRequest.searchText = reader.getString(); + } else if ("suggesterName".equals(fieldName)) { + deserializedAutocompleteRequest.suggesterName = reader.getString(); + } else if ("autocompleteMode".equals(fieldName)) { + deserializedAutocompleteRequest.autocompleteMode = AutocompleteMode.fromString(reader.getString()); + } else if ("filter".equals(fieldName)) { + deserializedAutocompleteRequest.filter = reader.getString(); + } else if ("fuzzy".equals(fieldName)) { + deserializedAutocompleteRequest.useFuzzyMatching = reader.getNullable(JsonReader::getBoolean); + } else if ("highlightPostTag".equals(fieldName)) { + deserializedAutocompleteRequest.highlightPostTag = reader.getString(); + } else if ("highlightPreTag".equals(fieldName)) { + deserializedAutocompleteRequest.highlightPreTag = reader.getString(); + } else if ("minimumCoverage".equals(fieldName)) { + deserializedAutocompleteRequest.minimumCoverage = reader.getNullable(JsonReader::getDouble); + } else if ("searchFields".equals(fieldName)) { + deserializedAutocompleteRequest.searchFields = reader.getString(); + } else if ("top".equals(fieldName)) { + deserializedAutocompleteRequest.top = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedAutocompleteRequest; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteResult.java new file mode 100644 index 000000000000..4c49d7465335 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AutocompleteResult.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.models; + +import com.azure.core.annotation.Generated; +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 result of Autocomplete query. + */ +@Immutable +public final class AutocompleteResult implements JsonSerializable { + /* + * A value indicating the percentage of the index that was considered by the autocomplete request, or null if + * minimumCoverage was not specified in the request. + */ + @Generated + private Double coverage; + + /* + * The list of returned Autocompleted items. + */ + @Generated + private List results; + + /** + * Creates an instance of AutocompleteResult class. + */ + @Generated + public AutocompleteResult() { + } + + /** + * Get the coverage property: A value indicating the percentage of the index that was considered by the autocomplete + * request, or null if minimumCoverage was not specified in the request. + * + * @return the coverage value. + */ + @Generated + public Double getCoverage() { + return this.coverage; + } + + /** + * Get the results property: The list of returned Autocompleted items. + * + * @return the results value. + */ + @Generated + public List getResults() { + return this.results; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutocompleteResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutocompleteResult 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 AutocompleteResult. + */ + @Generated + public static AutocompleteResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutocompleteResult deserializedAutocompleteResult = new AutocompleteResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List results = reader.readArray(reader1 -> AutocompleteItem.fromJson(reader1)); + deserializedAutocompleteResult.results = results; + } else if ("@search.coverage".equals(fieldName)) { + deserializedAutocompleteResult.coverage = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedAutocompleteResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureActiveDirectoryApplicationCredentials.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureActiveDirectoryApplicationCredentials.java new file mode 100644 index 000000000000..0d1e45b81347 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureActiveDirectoryApplicationCredentials.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Credentials of a registered application created for your search service, used for authenticated access to the + * encryption keys stored in Azure Key Vault. + */ +@Fluent +public final class AzureActiveDirectoryApplicationCredentials + implements JsonSerializable { + /* + * An AAD Application ID that was granted the required access permissions to the Azure Key Vault that is to be used + * when encrypting your data at rest. The Application ID should not be confused with the Object ID for your AAD + * Application. + */ + @Generated + private String applicationId; + + /* + * The authentication key of the specified AAD application. + */ + @Generated + private String applicationSecret; + + /** + * Creates an instance of AzureActiveDirectoryApplicationCredentials class. + */ + @Generated + public AzureActiveDirectoryApplicationCredentials() { + } + + /** + * Get the applicationId property: An AAD Application ID that was granted the required access permissions to the + * Azure Key Vault that is to be used when encrypting your data at rest. The Application ID should not be confused + * with the Object ID for your AAD Application. + * + * @return the applicationId value. + */ + @Generated + public String getApplicationId() { + return this.applicationId; + } + + /** + * Set the applicationId property: An AAD Application ID that was granted the required access permissions to the + * Azure Key Vault that is to be used when encrypting your data at rest. The Application ID should not be confused + * with the Object ID for your AAD Application. + * + * @param applicationId the applicationId value to set. + * @return the AzureActiveDirectoryApplicationCredentials object itself. + */ + @Generated + public AzureActiveDirectoryApplicationCredentials setApplicationId(String applicationId) { + this.applicationId = applicationId; + return this; + } + + /** + * Get the applicationSecret property: The authentication key of the specified AAD application. + * + * @return the applicationSecret value. + */ + @Generated + public String getApplicationSecret() { + return this.applicationSecret; + } + + /** + * Set the applicationSecret property: The authentication key of the specified AAD application. + * + * @param applicationSecret the applicationSecret value to set. + * @return the AzureActiveDirectoryApplicationCredentials object itself. + */ + @Generated + public AzureActiveDirectoryApplicationCredentials setApplicationSecret(String applicationSecret) { + this.applicationSecret = applicationSecret; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("applicationId", this.applicationId); + jsonWriter.writeStringField("applicationSecret", this.applicationSecret); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureActiveDirectoryApplicationCredentials from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureActiveDirectoryApplicationCredentials 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 AzureActiveDirectoryApplicationCredentials. + */ + @Generated + public static AzureActiveDirectoryApplicationCredentials fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureActiveDirectoryApplicationCredentials deserializedAzureActiveDirectoryApplicationCredentials + = new AzureActiveDirectoryApplicationCredentials(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("applicationId".equals(fieldName)) { + deserializedAzureActiveDirectoryApplicationCredentials.applicationId = reader.getString(); + } else if ("applicationSecret".equals(fieldName)) { + deserializedAzureActiveDirectoryApplicationCredentials.applicationSecret = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureActiveDirectoryApplicationCredentials; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureBlobKnowledgeSource.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureBlobKnowledgeSource.java new file mode 100644 index 000000000000..d2abaa237a37 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureBlobKnowledgeSource.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Configuration for Azure Blob Storage knowledge source. + */ +@Fluent +public final class AzureBlobKnowledgeSource extends KnowledgeSource { + /* + * The type of the knowledge source. + */ + @Generated + private KnowledgeSourceKind kind = KnowledgeSourceKind.AZURE_BLOB; + + /* + * The type of the knowledge source. + */ + @Generated + private AzureBlobKnowledgeSourceParameters azureBlobParameters; + + /** + * Creates an instance of AzureBlobKnowledgeSource class. + */ + @Generated + public AzureBlobKnowledgeSource() { + } + + /** + * Get the kind property: The type of the knowledge source. + * + * @return the kind value. + */ + @Generated + @Override + public KnowledgeSourceKind getKind() { + return this.kind; + } + + /** + * Get the azureBlobParameters property: The type of the knowledge source. + * + * @return the azureBlobParameters value. + */ + @Generated + public AzureBlobKnowledgeSourceParameters getAzureBlobParameters() { + return this.azureBlobParameters; + } + + /** + * Set the azureBlobParameters property: The type of the knowledge source. + * + * @param azureBlobParameters the azureBlobParameters value to set. + * @return the AzureBlobKnowledgeSource object itself. + */ + @Generated + public AzureBlobKnowledgeSource setAzureBlobParameters(AzureBlobKnowledgeSourceParameters azureBlobParameters) { + this.azureBlobParameters = azureBlobParameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureBlobKnowledgeSource setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureBlobKnowledgeSource setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureBlobKnowledgeSource setETag(String eTag) { + super.setETag(eTag); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureBlobKnowledgeSource setEncryptionKey(SearchResourceEncryptionKey encryptionKey) { + super.setEncryptionKey(encryptionKey); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("description", getDescription()); + jsonWriter.writeStringField("@odata.etag", getETag()); + jsonWriter.writeJsonField("encryptionKey", getEncryptionKey()); + jsonWriter.writeJsonField("azureBlobParameters", this.azureBlobParameters); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureBlobKnowledgeSource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureBlobKnowledgeSource 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 AzureBlobKnowledgeSource. + */ + @Generated + public static AzureBlobKnowledgeSource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureBlobKnowledgeSource deserializedAzureBlobKnowledgeSource = new AzureBlobKnowledgeSource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedAzureBlobKnowledgeSource.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedAzureBlobKnowledgeSource.setDescription(reader.getString()); + } else if ("@odata.etag".equals(fieldName)) { + deserializedAzureBlobKnowledgeSource.setETag(reader.getString()); + } else if ("encryptionKey".equals(fieldName)) { + deserializedAzureBlobKnowledgeSource.setEncryptionKey(SearchResourceEncryptionKey.fromJson(reader)); + } else if ("azureBlobParameters".equals(fieldName)) { + deserializedAzureBlobKnowledgeSource.azureBlobParameters + = AzureBlobKnowledgeSourceParameters.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedAzureBlobKnowledgeSource.kind = KnowledgeSourceKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureBlobKnowledgeSource; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureBlobKnowledgeSourceParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureBlobKnowledgeSourceParameters.java new file mode 100644 index 000000000000..bbdbf2d7bd52 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureBlobKnowledgeSourceParameters.java @@ -0,0 +1,244 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.Map; + +/** + * Parameters for Azure Blob Storage knowledge source. + */ +@Fluent +public final class AzureBlobKnowledgeSourceParameters implements JsonSerializable { + /* + * Key-based connection string or the ResourceId format if using a managed identity. + */ + @Generated + private String connectionString; + + /* + * The name of the blob storage container. + */ + @Generated + private String containerName; + + /* + * Optional folder path within the container. + */ + @Generated + private String folderPath; + + /* + * Set to true if connecting to an ADLS Gen2 storage account. Default is false. + */ + @Generated + private Boolean isAdlsGen2; + + /* + * Consolidates all general ingestion settings. + */ + @Generated + private KnowledgeSourceIngestionParameters ingestionParameters; + + /* + * Resources created by the knowledge source. + */ + @Generated + private Map createdResources; + + /** + * Creates an instance of AzureBlobKnowledgeSourceParameters class. + */ + @Generated + public AzureBlobKnowledgeSourceParameters() { + } + + /** + * Get the connectionString property: Key-based connection string or the ResourceId format if using a managed + * identity. + * + * @return the connectionString value. + */ + @Generated + public String getConnectionString() { + return this.connectionString; + } + + /** + * Set the connectionString property: Key-based connection string or the ResourceId format if using a managed + * identity. + * + * @param connectionString the connectionString value to set. + * @return the AzureBlobKnowledgeSourceParameters object itself. + */ + @Generated + public AzureBlobKnowledgeSourceParameters setConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the containerName property: The name of the blob storage container. + * + * @return the containerName value. + */ + @Generated + public String getContainerName() { + return this.containerName; + } + + /** + * Set the containerName property: The name of the blob storage container. + * + * @param containerName the containerName value to set. + * @return the AzureBlobKnowledgeSourceParameters object itself. + */ + @Generated + public AzureBlobKnowledgeSourceParameters setContainerName(String containerName) { + this.containerName = containerName; + return this; + } + + /** + * Get the folderPath property: Optional folder path within the container. + * + * @return the folderPath value. + */ + @Generated + public String getFolderPath() { + return this.folderPath; + } + + /** + * Set the folderPath property: Optional folder path within the container. + * + * @param folderPath the folderPath value to set. + * @return the AzureBlobKnowledgeSourceParameters object itself. + */ + @Generated + public AzureBlobKnowledgeSourceParameters setFolderPath(String folderPath) { + this.folderPath = folderPath; + return this; + } + + /** + * Get the isAdlsGen2 property: Set to true if connecting to an ADLS Gen2 storage account. Default is false. + * + * @return the isAdlsGen2 value. + */ + @Generated + public Boolean isAdlsGen2() { + return this.isAdlsGen2; + } + + /** + * Set the isAdlsGen2 property: Set to true if connecting to an ADLS Gen2 storage account. Default is false. + * + * @param isAdlsGen2 the isAdlsGen2 value to set. + * @return the AzureBlobKnowledgeSourceParameters object itself. + */ + @Generated + public AzureBlobKnowledgeSourceParameters setIsAdlsGen2(Boolean isAdlsGen2) { + this.isAdlsGen2 = isAdlsGen2; + return this; + } + + /** + * Get the ingestionParameters property: Consolidates all general ingestion settings. + * + * @return the ingestionParameters value. + */ + @Generated + public KnowledgeSourceIngestionParameters getIngestionParameters() { + return this.ingestionParameters; + } + + /** + * Set the ingestionParameters property: Consolidates all general ingestion settings. + * + * @param ingestionParameters the ingestionParameters value to set. + * @return the AzureBlobKnowledgeSourceParameters object itself. + */ + @Generated + public AzureBlobKnowledgeSourceParameters + setIngestionParameters(KnowledgeSourceIngestionParameters ingestionParameters) { + this.ingestionParameters = ingestionParameters; + return this; + } + + /** + * Get the createdResources property: Resources created by the knowledge source. + * + * @return the createdResources value. + */ + @Generated + public Map getCreatedResources() { + return this.createdResources; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("connectionString", this.connectionString); + jsonWriter.writeStringField("containerName", this.containerName); + jsonWriter.writeStringField("folderPath", this.folderPath); + jsonWriter.writeBooleanField("isADLSGen2", this.isAdlsGen2); + jsonWriter.writeJsonField("ingestionParameters", this.ingestionParameters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureBlobKnowledgeSourceParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureBlobKnowledgeSourceParameters 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 AzureBlobKnowledgeSourceParameters. + */ + @Generated + public static AzureBlobKnowledgeSourceParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureBlobKnowledgeSourceParameters deserializedAzureBlobKnowledgeSourceParameters + = new AzureBlobKnowledgeSourceParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connectionString".equals(fieldName)) { + deserializedAzureBlobKnowledgeSourceParameters.connectionString = reader.getString(); + } else if ("containerName".equals(fieldName)) { + deserializedAzureBlobKnowledgeSourceParameters.containerName = reader.getString(); + } else if ("folderPath".equals(fieldName)) { + deserializedAzureBlobKnowledgeSourceParameters.folderPath = reader.getString(); + } else if ("isADLSGen2".equals(fieldName)) { + deserializedAzureBlobKnowledgeSourceParameters.isAdlsGen2 + = reader.getNullable(JsonReader::getBoolean); + } else if ("ingestionParameters".equals(fieldName)) { + deserializedAzureBlobKnowledgeSourceParameters.ingestionParameters + = KnowledgeSourceIngestionParameters.fromJson(reader); + } else if ("createdResources".equals(fieldName)) { + Map createdResources = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureBlobKnowledgeSourceParameters.createdResources = createdResources; + } else { + reader.skipChildren(); + } + } + + return deserializedAzureBlobKnowledgeSourceParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureBlobKnowledgeSourceParams.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureBlobKnowledgeSourceParams.java new file mode 100644 index 000000000000..1388ced815ed --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureBlobKnowledgeSourceParams.java @@ -0,0 +1,153 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specifies runtime parameters for a azure blob knowledge source. + */ +@Fluent +public final class AzureBlobKnowledgeSourceParams extends KnowledgeSourceParams { + /* + * The type of the knowledge source. + */ + @Generated + private KnowledgeSourceKind kind = KnowledgeSourceKind.AZURE_BLOB; + + /** + * Creates an instance of AzureBlobKnowledgeSourceParams class. + */ + @Generated + public AzureBlobKnowledgeSourceParams() { + } + + /** + * Get the kind property: The type of the knowledge source. + * + * @return the kind value. + */ + @Generated + @Override + public KnowledgeSourceKind getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureBlobKnowledgeSourceParams setKnowledgeSourceName(String knowledgeSourceName) { + super.setKnowledgeSourceName(knowledgeSourceName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureBlobKnowledgeSourceParams setIncludeReferences(Boolean includeReferences) { + super.setIncludeReferences(includeReferences); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureBlobKnowledgeSourceParams setIncludeReferenceSourceData(Boolean includeReferenceSourceData) { + super.setIncludeReferenceSourceData(includeReferenceSourceData); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureBlobKnowledgeSourceParams setAlwaysQuerySource(Boolean alwaysQuerySource) { + super.setAlwaysQuerySource(alwaysQuerySource); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureBlobKnowledgeSourceParams setRerankerThreshold(Float rerankerThreshold) { + super.setRerankerThreshold(rerankerThreshold); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("knowledgeSourceName", getKnowledgeSourceName()); + jsonWriter.writeBooleanField("includeReferences", isIncludeReferences()); + jsonWriter.writeBooleanField("includeReferenceSourceData", isIncludeReferenceSourceData()); + jsonWriter.writeBooleanField("alwaysQuerySource", isAlwaysQuerySource()); + jsonWriter.writeNumberField("rerankerThreshold", getRerankerThreshold()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureBlobKnowledgeSourceParams from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureBlobKnowledgeSourceParams 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 AzureBlobKnowledgeSourceParams. + */ + @Generated + public static AzureBlobKnowledgeSourceParams fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureBlobKnowledgeSourceParams deserializedAzureBlobKnowledgeSourceParams + = new AzureBlobKnowledgeSourceParams(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("knowledgeSourceName".equals(fieldName)) { + deserializedAzureBlobKnowledgeSourceParams.setKnowledgeSourceName(reader.getString()); + } else if ("includeReferences".equals(fieldName)) { + deserializedAzureBlobKnowledgeSourceParams + .setIncludeReferences(reader.getNullable(JsonReader::getBoolean)); + } else if ("includeReferenceSourceData".equals(fieldName)) { + deserializedAzureBlobKnowledgeSourceParams + .setIncludeReferenceSourceData(reader.getNullable(JsonReader::getBoolean)); + } else if ("alwaysQuerySource".equals(fieldName)) { + deserializedAzureBlobKnowledgeSourceParams + .setAlwaysQuerySource(reader.getNullable(JsonReader::getBoolean)); + } else if ("rerankerThreshold".equals(fieldName)) { + deserializedAzureBlobKnowledgeSourceParams + .setRerankerThreshold(reader.getNullable(JsonReader::getFloat)); + } else if ("kind".equals(fieldName)) { + deserializedAzureBlobKnowledgeSourceParams.kind + = KnowledgeSourceKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureBlobKnowledgeSourceParams; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureMachineLearningSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureMachineLearningSkill.java new file mode 100644 index 000000000000..ef6fcb0a79d9 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureMachineLearningSkill.java @@ -0,0 +1,366 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.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. + */ + @Generated + 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. + */ + @Generated + private String scoringUri; + + /* + * (Required for key authentication) The key for the AML service. + */ + @Generated + 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}. + */ + @Generated + private String resourceId; + + /* + * (Optional) When specified, indicates the timeout for the http client making the API call. + */ + @Generated + private Duration timeout; + + /* + * (Optional for token authentication). The region the AML service is deployed in. + */ + @Generated + 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. + */ + @Generated + private Integer degreeOfParallelism; + + /** + * Creates an instance of AzureMachineLearningSkill class. + */ + @Generated + public AzureMachineLearningSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + public AzureMachineLearningSkill setDegreeOfParallelism(Integer degreeOfParallelism) { + this.degreeOfParallelism = degreeOfParallelism; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureMachineLearningSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureMachineLearningSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureMachineLearningSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureMachineLearningSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureMachineLearningSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + public static AzureMachineLearningSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureMachineLearningSkill deserializedAzureMachineLearningSkill = new AzureMachineLearningSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedAzureMachineLearningSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedAzureMachineLearningSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedAzureMachineLearningSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedAzureMachineLearningSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedAzureMachineLearningSkill.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedAzureMachineLearningSkill.odataType = reader.getString(); + } else if ("uri".equals(fieldName)) { + deserializedAzureMachineLearningSkill.scoringUri = reader.getString(); + } else if ("key".equals(fieldName)) { + deserializedAzureMachineLearningSkill.authenticationKey = reader.getString(); + } else if ("resourceId".equals(fieldName)) { + deserializedAzureMachineLearningSkill.resourceId = reader.getString(); + } else if ("timeout".equals(fieldName)) { + deserializedAzureMachineLearningSkill.timeout + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("region".equals(fieldName)) { + deserializedAzureMachineLearningSkill.region = reader.getString(); + } else if ("degreeOfParallelism".equals(fieldName)) { + deserializedAzureMachineLearningSkill.degreeOfParallelism = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureMachineLearningSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureOpenAIEmbeddingSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureOpenAIEmbeddingSkill.java new file mode 100644 index 000000000000..97ca5973b4d1 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureOpenAIEmbeddingSkill.java @@ -0,0 +1,342 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 generate a vector embedding for a given text input using the Azure OpenAI resource. + */ +@Fluent +public final class AzureOpenAIEmbeddingSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Text.AzureOpenAIEmbeddingSkill"; + + /* + * The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and + * later models. + */ + @Generated + private Integer dimensions; + + /* + * The resource URI of the Azure OpenAI resource. + */ + @Generated + private String resourceUri; + + /* + * ID of the Azure OpenAI model deployment on the designated resource. + */ + @Generated + private String deploymentName; + + /* + * API key of the designated Azure OpenAI resource. + */ + @Generated + private String apiKey; + + /* + * The user-assigned managed identity used for outbound connections. + */ + @Generated + private SearchIndexerDataIdentity authIdentity; + + /* + * The name of the embedding model that is deployed at the provided deploymentId path. + */ + @Generated + private AzureOpenAIModelName modelName; + + /** + * Creates an instance of AzureOpenAIEmbeddingSkill class. + */ + @Generated + public AzureOpenAIEmbeddingSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the dimensions property: The number of dimensions the resulting output embeddings should have. Only supported + * in text-embedding-3 and later models. + * + * @return the dimensions value. + */ + @Generated + public Integer getDimensions() { + return this.dimensions; + } + + /** + * Set the dimensions property: The number of dimensions the resulting output embeddings should have. Only supported + * in text-embedding-3 and later models. + * + * @param dimensions the dimensions value to set. + * @return the AzureOpenAIEmbeddingSkill object itself. + */ + @Generated + public AzureOpenAIEmbeddingSkill setDimensions(Integer dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Get the resourceUri property: The resource URI of the Azure OpenAI resource. + * + * @return the resourceUri value. + */ + @Generated + public String getResourceUri() { + return this.resourceUri; + } + + /** + * Set the resourceUri property: The resource URI of the Azure OpenAI resource. + * + * @param resourceUri the resourceUri value to set. + * @return the AzureOpenAIEmbeddingSkill object itself. + */ + @Generated + public AzureOpenAIEmbeddingSkill setResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + /** + * Get the deploymentName property: ID of the Azure OpenAI model deployment on the designated resource. + * + * @return the deploymentName value. + */ + @Generated + public String getDeploymentName() { + return this.deploymentName; + } + + /** + * Set the deploymentName property: ID of the Azure OpenAI model deployment on the designated resource. + * + * @param deploymentName the deploymentName value to set. + * @return the AzureOpenAIEmbeddingSkill object itself. + */ + @Generated + public AzureOpenAIEmbeddingSkill setDeploymentName(String deploymentName) { + this.deploymentName = deploymentName; + return this; + } + + /** + * Get the apiKey property: API key of the designated Azure OpenAI resource. + * + * @return the apiKey value. + */ + @Generated + public String getApiKey() { + return this.apiKey; + } + + /** + * Set the apiKey property: API key of the designated Azure OpenAI resource. + * + * @param apiKey the apiKey value to set. + * @return the AzureOpenAIEmbeddingSkill object itself. + */ + @Generated + public AzureOpenAIEmbeddingSkill setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Get the authIdentity property: The user-assigned managed identity used for outbound connections. + * + * @return the authIdentity value. + */ + @Generated + public SearchIndexerDataIdentity getAuthIdentity() { + return this.authIdentity; + } + + /** + * Set the authIdentity property: The user-assigned managed identity used for outbound connections. + * + * @param authIdentity the authIdentity value to set. + * @return the AzureOpenAIEmbeddingSkill object itself. + */ + @Generated + public AzureOpenAIEmbeddingSkill setAuthIdentity(SearchIndexerDataIdentity authIdentity) { + this.authIdentity = authIdentity; + return this; + } + + /** + * Get the modelName property: The name of the embedding model that is deployed at the provided deploymentId path. + * + * @return the modelName value. + */ + @Generated + public AzureOpenAIModelName getModelName() { + return this.modelName; + } + + /** + * Set the modelName property: The name of the embedding model that is deployed at the provided deploymentId path. + * + * @param modelName the modelName value to set. + * @return the AzureOpenAIEmbeddingSkill object itself. + */ + @Generated + public AzureOpenAIEmbeddingSkill setModelName(AzureOpenAIModelName modelName) { + this.modelName = modelName; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureOpenAIEmbeddingSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureOpenAIEmbeddingSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureOpenAIEmbeddingSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureOpenAIEmbeddingSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureOpenAIEmbeddingSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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.writeNumberField("dimensions", this.dimensions); + jsonWriter.writeStringField("resourceUri", this.resourceUri); + jsonWriter.writeStringField("deploymentId", this.deploymentName); + jsonWriter.writeStringField("apiKey", this.apiKey); + jsonWriter.writeJsonField("authIdentity", this.authIdentity); + jsonWriter.writeStringField("modelName", this.modelName == null ? null : this.modelName.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureOpenAIEmbeddingSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureOpenAIEmbeddingSkill 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 AzureOpenAIEmbeddingSkill. + */ + @Generated + public static AzureOpenAIEmbeddingSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureOpenAIEmbeddingSkill deserializedAzureOpenAIEmbeddingSkill = new AzureOpenAIEmbeddingSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedAzureOpenAIEmbeddingSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedAzureOpenAIEmbeddingSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedAzureOpenAIEmbeddingSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedAzureOpenAIEmbeddingSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedAzureOpenAIEmbeddingSkill.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedAzureOpenAIEmbeddingSkill.odataType = reader.getString(); + } else if ("dimensions".equals(fieldName)) { + deserializedAzureOpenAIEmbeddingSkill.dimensions = reader.getNullable(JsonReader::getInt); + } else if ("resourceUri".equals(fieldName)) { + deserializedAzureOpenAIEmbeddingSkill.resourceUri = reader.getString(); + } else if ("deploymentId".equals(fieldName)) { + deserializedAzureOpenAIEmbeddingSkill.deploymentName = reader.getString(); + } else if ("apiKey".equals(fieldName)) { + deserializedAzureOpenAIEmbeddingSkill.apiKey = reader.getString(); + } else if ("authIdentity".equals(fieldName)) { + deserializedAzureOpenAIEmbeddingSkill.authIdentity = SearchIndexerDataIdentity.fromJson(reader); + } else if ("modelName".equals(fieldName)) { + deserializedAzureOpenAIEmbeddingSkill.modelName + = AzureOpenAIModelName.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureOpenAIEmbeddingSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureOpenAIModelName.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureOpenAIModelName.java new file mode 100644 index 000000000000..7e09c58430f3 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureOpenAIModelName.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The Azure Open AI model name that will be called. + */ +public final class AzureOpenAIModelName extends ExpandableStringEnum { + /** + * Static value text-embedding-ada-002 for AzureOpenAIModelName. + */ + @Generated + public static final AzureOpenAIModelName TEXT_EMBEDDING_ADA002 = fromString("text-embedding-ada-002"); + + /** + * Static value text-embedding-3-large for AzureOpenAIModelName. + */ + @Generated + public static final AzureOpenAIModelName TEXT_EMBEDDING3LARGE = fromString("text-embedding-3-large"); + + /** + * Static value text-embedding-3-small for AzureOpenAIModelName. + */ + @Generated + public static final AzureOpenAIModelName TEXT_EMBEDDING3SMALL = fromString("text-embedding-3-small"); + + /** + * Static value gpt-4o for AzureOpenAIModelName. + */ + @Generated + public static final AzureOpenAIModelName GPT4O = fromString("gpt-4o"); + + /** + * Static value gpt-4o-mini for AzureOpenAIModelName. + */ + @Generated + public static final AzureOpenAIModelName GPT4OMINI = fromString("gpt-4o-mini"); + + /** + * Static value gpt-4.1 for AzureOpenAIModelName. + */ + @Generated + public static final AzureOpenAIModelName GPT41 = fromString("gpt-4.1"); + + /** + * Static value gpt-4.1-mini for AzureOpenAIModelName. + */ + @Generated + public static final AzureOpenAIModelName GPT41MINI = fromString("gpt-4.1-mini"); + + /** + * Static value gpt-4.1-nano for AzureOpenAIModelName. + */ + @Generated + public static final AzureOpenAIModelName GPT41NANO = fromString("gpt-4.1-nano"); + + /** + * Static value gpt-5 for AzureOpenAIModelName. + */ + @Generated + public static final AzureOpenAIModelName GPT5 = fromString("gpt-5"); + + /** + * Static value gpt-5-mini for AzureOpenAIModelName. + */ + @Generated + public static final AzureOpenAIModelName GPT5MINI = fromString("gpt-5-mini"); + + /** + * Static value gpt-5-nano for AzureOpenAIModelName. + */ + @Generated + public static final AzureOpenAIModelName GPT5NANO = fromString("gpt-5-nano"); + + /** + * Creates a new instance of AzureOpenAIModelName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public AzureOpenAIModelName() { + } + + /** + * Creates or finds a AzureOpenAIModelName from its string representation. + * + * @param name a name to look for. + * @return the corresponding AzureOpenAIModelName. + */ + @Generated + public static AzureOpenAIModelName fromString(String name) { + return fromString(name, AzureOpenAIModelName.class); + } + + /** + * Gets known AzureOpenAIModelName values. + * + * @return known AzureOpenAIModelName values. + */ + @Generated + public static Collection values() { + return values(AzureOpenAIModelName.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureOpenAIParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureOpenAIParameters.java new file mode 100644 index 000000000000..cf62d2deb441 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureOpenAIParameters.java @@ -0,0 +1,217 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specifies the parameters for connecting to the Azure OpenAI resource. + */ +@Fluent +public class AzureOpenAIParameters implements JsonSerializable { + /* + * The resource URI of the Azure OpenAI resource. + */ + @Generated + private String resourceUri; + + /* + * ID of the Azure OpenAI model deployment on the designated resource. + */ + @Generated + private String deploymentName; + + /* + * API key of the designated Azure OpenAI resource. + */ + @Generated + private String apiKey; + + /* + * The user-assigned managed identity used for outbound connections. + */ + @Generated + private SearchIndexerDataIdentity authIdentity; + + /* + * The name of the embedding model that is deployed at the provided deploymentId path. + */ + @Generated + private AzureOpenAIModelName modelName; + + /** + * Creates an instance of AzureOpenAIParameters class. + */ + @Generated + public AzureOpenAIParameters() { + } + + /** + * Get the resourceUri property: The resource URI of the Azure OpenAI resource. + * + * @return the resourceUri value. + */ + @Generated + public String getResourceUri() { + return this.resourceUri; + } + + /** + * Set the resourceUri property: The resource URI of the Azure OpenAI resource. + * + * @param resourceUri the resourceUri value to set. + * @return the AzureOpenAIParameters object itself. + */ + @Generated + public AzureOpenAIParameters setResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + /** + * Get the deploymentName property: ID of the Azure OpenAI model deployment on the designated resource. + * + * @return the deploymentName value. + */ + @Generated + public String getDeploymentName() { + return this.deploymentName; + } + + /** + * Set the deploymentName property: ID of the Azure OpenAI model deployment on the designated resource. + * + * @param deploymentName the deploymentName value to set. + * @return the AzureOpenAIParameters object itself. + */ + @Generated + public AzureOpenAIParameters setDeploymentName(String deploymentName) { + this.deploymentName = deploymentName; + return this; + } + + /** + * Get the apiKey property: API key of the designated Azure OpenAI resource. + * + * @return the apiKey value. + */ + @Generated + public String getApiKey() { + return this.apiKey; + } + + /** + * Set the apiKey property: API key of the designated Azure OpenAI resource. + * + * @param apiKey the apiKey value to set. + * @return the AzureOpenAIParameters object itself. + */ + @Generated + public AzureOpenAIParameters setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Get the authIdentity property: The user-assigned managed identity used for outbound connections. + * + * @return the authIdentity value. + */ + @Generated + public SearchIndexerDataIdentity getAuthIdentity() { + return this.authIdentity; + } + + /** + * Set the authIdentity property: The user-assigned managed identity used for outbound connections. + * + * @param authIdentity the authIdentity value to set. + * @return the AzureOpenAIParameters object itself. + */ + @Generated + public AzureOpenAIParameters setAuthIdentity(SearchIndexerDataIdentity authIdentity) { + this.authIdentity = authIdentity; + return this; + } + + /** + * Get the modelName property: The name of the embedding model that is deployed at the provided deploymentId path. + * + * @return the modelName value. + */ + @Generated + public AzureOpenAIModelName getModelName() { + return this.modelName; + } + + /** + * Set the modelName property: The name of the embedding model that is deployed at the provided deploymentId path. + * + * @param modelName the modelName value to set. + * @return the AzureOpenAIParameters object itself. + */ + @Generated + public AzureOpenAIParameters setModelName(AzureOpenAIModelName modelName) { + this.modelName = modelName; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceUri", this.resourceUri); + jsonWriter.writeStringField("deploymentId", this.deploymentName); + jsonWriter.writeStringField("apiKey", this.apiKey); + jsonWriter.writeJsonField("authIdentity", this.authIdentity); + jsonWriter.writeStringField("modelName", this.modelName == null ? null : this.modelName.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureOpenAIParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureOpenAIParameters 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 AzureOpenAIParameters. + */ + @Generated + public static AzureOpenAIParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureOpenAIParameters deserializedAzureOpenAIParameters = new AzureOpenAIParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceUri".equals(fieldName)) { + deserializedAzureOpenAIParameters.resourceUri = reader.getString(); + } else if ("deploymentId".equals(fieldName)) { + deserializedAzureOpenAIParameters.deploymentName = reader.getString(); + } else if ("apiKey".equals(fieldName)) { + deserializedAzureOpenAIParameters.apiKey = reader.getString(); + } else if ("authIdentity".equals(fieldName)) { + deserializedAzureOpenAIParameters.authIdentity = SearchIndexerDataIdentity.fromJson(reader); + } else if ("modelName".equals(fieldName)) { + deserializedAzureOpenAIParameters.modelName = AzureOpenAIModelName.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureOpenAIParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureOpenAITokenizerParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureOpenAITokenizerParameters.java new file mode 100644 index 000000000000..152d897f9a5a --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureOpenAITokenizerParameters.java @@ -0,0 +1,136 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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'. + */ + @Generated + 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. + */ + @Generated + private List allowedSpecialTokens; + + /** + * Creates an instance of AzureOpenAITokenizerParameters class. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + public AzureOpenAITokenizerParameters setAllowedSpecialTokens(List allowedSpecialTokens) { + this.allowedSpecialTokens = allowedSpecialTokens; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + 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/search/src/main/java/com/azure/search/models/AzureOpenAIVectorizer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureOpenAIVectorizer.java new file mode 100644 index 000000000000..e223760ae096 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/AzureOpenAIVectorizer.java @@ -0,0 +1,126 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specifies the Azure OpenAI resource used to vectorize a query string. + */ +@Fluent +public final class AzureOpenAIVectorizer extends VectorSearchVectorizer { + /* + * The name of the kind of vectorization method being configured for use with vector search. + */ + @Generated + private VectorSearchVectorizerKind kind = VectorSearchVectorizerKind.AZURE_OPEN_AI; + + /* + * Contains the parameters specific to Azure OpenAI embedding vectorization. + */ + @Generated + private AzureOpenAIParameters azureOpenAIParameters; + + /** + * Creates an instance of AzureOpenAIVectorizer class. + */ + @Generated + public AzureOpenAIVectorizer() { + } + + /** + * Get the kind property: The name of the kind of vectorization method being configured for use with vector search. + * + * @return the kind value. + */ + @Generated + @Override + public VectorSearchVectorizerKind getKind() { + return this.kind; + } + + /** + * Get the azureOpenAIParameters property: Contains the parameters specific to Azure OpenAI embedding vectorization. + * + * @return the azureOpenAIParameters value. + */ + @Generated + public AzureOpenAIParameters getAzureOpenAIParameters() { + return this.azureOpenAIParameters; + } + + /** + * Set the azureOpenAIParameters property: Contains the parameters specific to Azure OpenAI embedding vectorization. + * + * @param azureOpenAIParameters the azureOpenAIParameters value to set. + * @return the AzureOpenAIVectorizer object itself. + */ + @Generated + public AzureOpenAIVectorizer setAzureOpenAIParameters(AzureOpenAIParameters azureOpenAIParameters) { + this.azureOpenAIParameters = azureOpenAIParameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public AzureOpenAIVectorizer setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("azureOpenAIParameters", this.azureOpenAIParameters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureOpenAIVectorizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureOpenAIVectorizer 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 AzureOpenAIVectorizer. + */ + @Generated + public static AzureOpenAIVectorizer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureOpenAIVectorizer deserializedAzureOpenAIVectorizer = new AzureOpenAIVectorizer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedAzureOpenAIVectorizer.setName(reader.getString()); + } else if ("kind".equals(fieldName)) { + deserializedAzureOpenAIVectorizer.kind = VectorSearchVectorizerKind.fromString(reader.getString()); + } else if ("azureOpenAIParameters".equals(fieldName)) { + deserializedAzureOpenAIVectorizer.azureOpenAIParameters = AzureOpenAIParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureOpenAIVectorizer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BM25Similarity.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BM25Similarity.java new file mode 100644 index 000000000000..1054cfa30bbe --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BM25Similarity.java @@ -0,0 +1,157 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Ranking function based on the Okapi BM25 similarity algorithm. BM25 is a TF-IDF-like algorithm that includes length + * normalization (controlled by the 'b' parameter) as well as term frequency saturation (controlled by the 'k1' + * parameter). + */ +@Fluent +public final class BM25Similarity extends Similarity { + /* + * The @odata.type property. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.BM25Similarity"; + + /* + * This property controls the scaling function between the term frequency of each matching terms and the final + * relevance score of a document-query pair. By default, a value of 1.2 is used. A value of 0.0 means the score does + * not scale with an increase in term frequency. + */ + @Generated + private Double k1; + + /* + * This property controls how the length of a document affects the relevance score. By default, a value of 0.75 is + * used. A value of 0.0 means no length normalization is applied, while a value of 1.0 means the score is fully + * normalized by the length of the document. + */ + @Generated + private Double b; + + /** + * Creates an instance of BM25Similarity class. + */ + @Generated + public BM25Similarity() { + } + + /** + * Get the odataType property: The @odata.type property. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the k1 property: This property controls the scaling function between the term frequency of each matching + * terms and the final relevance score of a document-query pair. By default, a value of 1.2 is used. A value of 0.0 + * means the score does not scale with an increase in term frequency. + * + * @return the k1 value. + */ + @Generated + public Double getK1() { + return this.k1; + } + + /** + * Set the k1 property: This property controls the scaling function between the term frequency of each matching + * terms and the final relevance score of a document-query pair. By default, a value of 1.2 is used. A value of 0.0 + * means the score does not scale with an increase in term frequency. + * + * @param k1 the k1 value to set. + * @return the BM25Similarity object itself. + */ + @Generated + public BM25Similarity setK1(Double k1) { + this.k1 = k1; + return this; + } + + /** + * Get the b property: This property controls how the length of a document affects the relevance score. By default, + * a value of 0.75 is used. A value of 0.0 means no length normalization is applied, while a value of 1.0 means the + * score is fully normalized by the length of the document. + * + * @return the b value. + */ + @Generated + public Double getB() { + return this.b; + } + + /** + * Set the b property: This property controls how the length of a document affects the relevance score. By default, + * a value of 0.75 is used. A value of 0.0 means no length normalization is applied, while a value of 1.0 means the + * score is fully normalized by the length of the document. + * + * @param b the b value to set. + * @return the BM25Similarity object itself. + */ + @Generated + public BM25Similarity setB(Double b) { + this.b = b; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("k1", this.k1); + jsonWriter.writeNumberField("b", this.b); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BM25Similarity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BM25Similarity 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 BM25Similarity. + */ + @Generated + public static BM25Similarity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BM25Similarity deserializedBM25Similarity = new BM25Similarity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("@odata.type".equals(fieldName)) { + deserializedBM25Similarity.odataType = reader.getString(); + } else if ("k1".equals(fieldName)) { + deserializedBM25Similarity.k1 = reader.getNullable(JsonReader::getDouble); + } else if ("b".equals(fieldName)) { + deserializedBM25Similarity.b = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedBM25Similarity; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BinaryQuantizationCompressionConfiguration.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BinaryQuantizationCompressionConfiguration.java new file mode 100644 index 000000000000..7562ff2c028b --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BinaryQuantizationCompressionConfiguration.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Contains configuration options specific to the binary quantization compression method used during indexing and + * querying. + */ +@Fluent +public final class BinaryQuantizationCompressionConfiguration extends VectorSearchCompressionConfiguration { + /* + * The name of the kind of compression method being configured for use with vector search. + */ + @Generated + private VectorSearchCompressionKind kind = VectorSearchCompressionKind.BINARY_QUANTIZATION; + + /** + * Creates an instance of BinaryQuantizationCompressionConfiguration class. + */ + @Generated + public BinaryQuantizationCompressionConfiguration() { + } + + /** + * Get the kind property: The name of the kind of compression method being configured for use with vector search. + * + * @return the kind value. + */ + @Generated + @Override + public VectorSearchCompressionKind getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public BinaryQuantizationCompressionConfiguration setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public BinaryQuantizationCompressionConfiguration setRerankWithOriginalVectors(Boolean rerankWithOriginalVectors) { + super.setRerankWithOriginalVectors(rerankWithOriginalVectors); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public BinaryQuantizationCompressionConfiguration setDefaultOversampling(Double defaultOversampling) { + super.setDefaultOversampling(defaultOversampling); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public BinaryQuantizationCompressionConfiguration setRescoringOptions(RescoringOptions rescoringOptions) { + super.setRescoringOptions(rescoringOptions); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public BinaryQuantizationCompressionConfiguration setTruncationDimension(Integer truncationDimension) { + super.setTruncationDimension(truncationDimension); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeBooleanField("rerankWithOriginalVectors", isRerankWithOriginalVectors()); + jsonWriter.writeNumberField("defaultOversampling", getDefaultOversampling()); + jsonWriter.writeJsonField("rescoringOptions", getRescoringOptions()); + jsonWriter.writeNumberField("truncationDimension", getTruncationDimension()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BinaryQuantizationCompressionConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BinaryQuantizationCompressionConfiguration 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 BinaryQuantizationCompressionConfiguration. + */ + @Generated + public static BinaryQuantizationCompressionConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BinaryQuantizationCompressionConfiguration deserializedBinaryQuantizationCompressionConfiguration + = new BinaryQuantizationCompressionConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedBinaryQuantizationCompressionConfiguration.setName(reader.getString()); + } else if ("rerankWithOriginalVectors".equals(fieldName)) { + deserializedBinaryQuantizationCompressionConfiguration + .setRerankWithOriginalVectors(reader.getNullable(JsonReader::getBoolean)); + } else if ("defaultOversampling".equals(fieldName)) { + deserializedBinaryQuantizationCompressionConfiguration + .setDefaultOversampling(reader.getNullable(JsonReader::getDouble)); + } else if ("rescoringOptions".equals(fieldName)) { + deserializedBinaryQuantizationCompressionConfiguration + .setRescoringOptions(RescoringOptions.fromJson(reader)); + } else if ("truncationDimension".equals(fieldName)) { + deserializedBinaryQuantizationCompressionConfiguration + .setTruncationDimension(reader.getNullable(JsonReader::getInt)); + } else if ("kind".equals(fieldName)) { + deserializedBinaryQuantizationCompressionConfiguration.kind + = VectorSearchCompressionKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedBinaryQuantizationCompressionConfiguration; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BlobIndexerDataToExtract.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BlobIndexerDataToExtract.java new file mode 100644 index 000000000000..ddfefc6f7632 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BlobIndexerDataToExtract.java @@ -0,0 +1,67 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the data to extract from Azure blob storage and tells the indexer which data to extract from image content + * when "imageAction" is set to a value other than "none". This applies to embedded image content in a .PDF or other + * application, or image files such as .jpg and .png, in Azure blobs. + */ +public final class BlobIndexerDataToExtract extends ExpandableStringEnum { + /** + * Indexes just the standard blob properties and user-specified metadata. + */ + @Generated + public static final BlobIndexerDataToExtract STORAGE_METADATA = fromString("storageMetadata"); + + /** + * Extracts metadata provided by the Azure blob storage subsystem and the content-type specific metadata (for + * example, metadata unique to just .png files are indexed). + */ + @Generated + public static final BlobIndexerDataToExtract ALL_METADATA = fromString("allMetadata"); + + /** + * Extracts all metadata and textual content from each blob. + */ + @Generated + public static final BlobIndexerDataToExtract CONTENT_AND_METADATA = fromString("contentAndMetadata"); + + /** + * Creates a new instance of BlobIndexerDataToExtract value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public BlobIndexerDataToExtract() { + } + + /** + * Creates or finds a BlobIndexerDataToExtract from its string representation. + * + * @param name a name to look for. + * @return the corresponding BlobIndexerDataToExtract. + */ + @Generated + public static BlobIndexerDataToExtract fromString(String name) { + return fromString(name, BlobIndexerDataToExtract.class); + } + + /** + * Gets known BlobIndexerDataToExtract values. + * + * @return known BlobIndexerDataToExtract values. + */ + @Generated + public static Collection values() { + return values(BlobIndexerDataToExtract.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BlobIndexerImageAction.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BlobIndexerImageAction.java new file mode 100644 index 000000000000..4e551512b430 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BlobIndexerImageAction.java @@ -0,0 +1,73 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Determines how to process embedded images and image files in Azure blob storage. Setting the "imageAction" + * configuration to any value other than "none" requires that a skillset also be attached to that indexer. + */ +public final class BlobIndexerImageAction extends ExpandableStringEnum { + /** + * Ignores embedded images or image files in the data set. This is the default. + */ + @Generated + public static final BlobIndexerImageAction NONE = fromString("none"); + + /** + * Extracts text from images (for example, the word "STOP" from a traffic stop sign), and embeds it into the content + * field. This action requires that "dataToExtract" is set to "contentAndMetadata". A normalized image refers to + * additional processing resulting in uniform image output, sized and rotated to promote consistent rendering when + * you include images in visual search results. This information is generated for each image when you use this + * option. + */ + @Generated + public static final BlobIndexerImageAction GENERATE_NORMALIZED_IMAGES = fromString("generateNormalizedImages"); + + /** + * Extracts text from images (for example, the word "STOP" from a traffic stop sign), and embeds it into the content + * field, but treats PDF files differently in that each page will be rendered as an image and normalized + * accordingly, instead of extracting embedded images. Non-PDF file types will be treated the same as if + * "generateNormalizedImages" was set. + */ + @Generated + public static final BlobIndexerImageAction GENERATE_NORMALIZED_IMAGE_PER_PAGE + = fromString("generateNormalizedImagePerPage"); + + /** + * Creates a new instance of BlobIndexerImageAction value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public BlobIndexerImageAction() { + } + + /** + * Creates or finds a BlobIndexerImageAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding BlobIndexerImageAction. + */ + @Generated + public static BlobIndexerImageAction fromString(String name) { + return fromString(name, BlobIndexerImageAction.class); + } + + /** + * Gets known BlobIndexerImageAction values. + * + * @return known BlobIndexerImageAction values. + */ + @Generated + public static Collection values() { + return values(BlobIndexerImageAction.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BlobIndexerPDFTextRotationAlgorithm.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BlobIndexerPDFTextRotationAlgorithm.java new file mode 100644 index 000000000000..223038aa0acd --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BlobIndexerPDFTextRotationAlgorithm.java @@ -0,0 +1,62 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Determines algorithm for text extraction from PDF files in Azure blob storage. + */ +public final class BlobIndexerPDFTextRotationAlgorithm + extends ExpandableStringEnum { + /** + * Leverages normal text extraction. This is the default. + */ + @Generated + public static final BlobIndexerPDFTextRotationAlgorithm NONE = fromString("none"); + + /** + * May produce better and more readable text extraction from PDF files that have rotated text within them. Note that + * there may be a small performance speed impact when this parameter is used. This parameter only applies to PDF + * files, and only to PDFs with embedded text. If the rotated text appears within an embedded image in the PDF, this + * parameter does not apply. + */ + @Generated + public static final BlobIndexerPDFTextRotationAlgorithm DETECT_ANGLES = fromString("detectAngles"); + + /** + * Creates a new instance of BlobIndexerPDFTextRotationAlgorithm value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public BlobIndexerPDFTextRotationAlgorithm() { + } + + /** + * Creates or finds a BlobIndexerPDFTextRotationAlgorithm from its string representation. + * + * @param name a name to look for. + * @return the corresponding BlobIndexerPDFTextRotationAlgorithm. + */ + @Generated + public static BlobIndexerPDFTextRotationAlgorithm fromString(String name) { + return fromString(name, BlobIndexerPDFTextRotationAlgorithm.class); + } + + /** + * Gets known BlobIndexerPDFTextRotationAlgorithm values. + * + * @return known BlobIndexerPDFTextRotationAlgorithm values. + */ + @Generated + public static Collection values() { + return values(BlobIndexerPDFTextRotationAlgorithm.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BlobIndexerParsingMode.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BlobIndexerParsingMode.java new file mode 100644 index 000000000000..20884151efe5 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/BlobIndexerParsingMode.java @@ -0,0 +1,88 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Represents the parsing mode for indexing from an Azure blob data source. + */ +public final class BlobIndexerParsingMode extends ExpandableStringEnum { + /** + * Set to default for normal file processing. + */ + @Generated + public static final BlobIndexerParsingMode DEFAULT = fromString("default"); + + /** + * Set to text to improve indexing performance on plain text files in blob storage. + */ + @Generated + public static final BlobIndexerParsingMode TEXT = fromString("text"); + + /** + * Set to delimitedText when blobs are plain CSV files. + */ + @Generated + public static final BlobIndexerParsingMode DELIMITED_TEXT = fromString("delimitedText"); + + /** + * Set to json to extract structured content from JSON files. + */ + @Generated + public static final BlobIndexerParsingMode JSON = fromString("json"); + + /** + * Set to jsonArray to extract individual elements of a JSON array as separate documents. + */ + @Generated + public static final BlobIndexerParsingMode JSON_ARRAY = fromString("jsonArray"); + + /** + * Set to jsonLines to extract individual JSON entities, separated by a new line, as separate documents. + */ + @Generated + public static final BlobIndexerParsingMode JSON_LINES = fromString("jsonLines"); + + /** + * Set to markdown to extract content from markdown files. + */ + @Generated + public static final BlobIndexerParsingMode MARKDOWN = fromString("markdown"); + + /** + * Creates a new instance of BlobIndexerParsingMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public BlobIndexerParsingMode() { + } + + /** + * Creates or finds a BlobIndexerParsingMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding BlobIndexerParsingMode. + */ + @Generated + public static BlobIndexerParsingMode fromString(String name) { + return fromString(name, BlobIndexerParsingMode.class); + } + + /** + * Gets known BlobIndexerParsingMode values. + * + * @return known BlobIndexerParsingMode values. + */ + @Generated + public static Collection values() { + return values(BlobIndexerParsingMode.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CharFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CharFilter.java new file mode 100644 index 000000000000..e6b61a6ab525 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CharFilter.java @@ -0,0 +1,144 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 character filters. + */ +@Fluent +public class CharFilter implements JsonSerializable { + /* + * A URI fragment specifying the type of char filter. + */ + @Generated + private String odataType = "CharFilter"; + + /* + * The name of the char filter. It must only contain letters, digits, spaces, dashes or underscores, can only start + * and end with alphanumeric characters, and is limited to 128 characters. + */ + @Generated + private String name; + + /** + * Creates an instance of CharFilter class. + */ + @Generated + public CharFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of char filter. + * + * @return the odataType value. + */ + @Generated + public String getOdataType() { + return this.odataType; + } + + /** + * Get the name property: The name of the char filter. It must only contain letters, digits, spaces, dashes or + * underscores, can only start and end with alphanumeric characters, and is limited to 128 characters. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the char filter. It must only contain letters, digits, spaces, dashes or + * underscores, can only start and end with alphanumeric characters, and is limited to 128 characters. + * + * @param name the name value to set. + * @return the CharFilter object itself. + */ + @Generated + public CharFilter setName(String name) { + this.name = name; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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 CharFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CharFilter 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 CharFilter. + */ + @Generated + public static CharFilter 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.MappingCharFilter".equals(discriminatorValue)) { + return MappingCharFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.PatternReplaceCharFilter".equals(discriminatorValue)) { + return PatternReplaceCharFilter.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static CharFilter fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CharFilter deserializedCharFilter = new CharFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCharFilter.name = reader.getString(); + } else if ("@odata.type".equals(fieldName)) { + deserializedCharFilter.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCharFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CharFilterName.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CharFilterName.java new file mode 100644 index 000000000000..e07fc663a7ef --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CharFilterName.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines the names of all character filters supported by the search engine. + */ +public final class CharFilterName extends ExpandableStringEnum { + /** + * A character filter that attempts to strip out HTML constructs. See + * https://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/charfilter/HTMLStripCharFilter.html. + */ + @Generated + public static final CharFilterName HTML_STRIP = fromString("html_strip"); + + /** + * Creates a new instance of CharFilterName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public CharFilterName() { + } + + /** + * Creates or finds a CharFilterName from its string representation. + * + * @param name a name to look for. + * @return the corresponding CharFilterName. + */ + @Generated + public static CharFilterName fromString(String name) { + return fromString(name, CharFilterName.class); + } + + /** + * Gets known CharFilterName values. + * + * @return known CharFilterName values. + */ + @Generated + public static Collection values() { + return values(CharFilterName.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionExtraParametersBehavior.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionExtraParametersBehavior.java new file mode 100644 index 000000000000..28bc7c235231 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionExtraParametersBehavior.java @@ -0,0 +1,65 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies how 'extraParameters' should be handled by Azure AI Foundry. Defaults to 'error'. + */ +public final class ChatCompletionExtraParametersBehavior + extends ExpandableStringEnum { + /** + * Passes any extra parameters directly to the model. + */ + @Generated + public static final ChatCompletionExtraParametersBehavior PASS_THROUGH = fromString("passThrough"); + + /** + * Drops all extra parameters. + */ + @Generated + public static final ChatCompletionExtraParametersBehavior DROP = fromString("drop"); + + /** + * Raises an error if any extra parameter is present. + */ + @Generated + public static final ChatCompletionExtraParametersBehavior ERROR = fromString("error"); + + /** + * Creates a new instance of ChatCompletionExtraParametersBehavior value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ChatCompletionExtraParametersBehavior() { + } + + /** + * Creates or finds a ChatCompletionExtraParametersBehavior from its string representation. + * + * @param name a name to look for. + * @return the corresponding ChatCompletionExtraParametersBehavior. + */ + @Generated + public static ChatCompletionExtraParametersBehavior fromString(String name) { + return fromString(name, ChatCompletionExtraParametersBehavior.class); + } + + /** + * Gets known ChatCompletionExtraParametersBehavior values. + * + * @return known ChatCompletionExtraParametersBehavior values. + */ + @Generated + public static Collection values() { + return values(ChatCompletionExtraParametersBehavior.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionResponseFormat.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionResponseFormat.java new file mode 100644 index 000000000000..3fa6a302da31 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionResponseFormat.java @@ -0,0 +1,132 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Determines how the language model's response should be serialized. Defaults to 'text'. + */ +@Fluent +public final class ChatCompletionResponseFormat implements JsonSerializable { + /* + * Specifies how the LLM should format the response. Possible values: 'text' (plain string), 'json_object' + * (arbitrary JSON), or 'json_schema' (adheres to provided schema). + */ + @Generated + private ChatCompletionResponseFormatType type; + + /* + * An open dictionary for extended properties. Required if 'type' == 'json_schema' + */ + @Generated + private ChatCompletionResponseFormatJsonSchemaProperties chatCompletionSchemaProperties; + + /** + * Creates an instance of ChatCompletionResponseFormat class. + */ + @Generated + public ChatCompletionResponseFormat() { + } + + /** + * Get the type property: Specifies how the LLM should format the response. Possible values: 'text' (plain string), + * 'json_object' (arbitrary JSON), or 'json_schema' (adheres to provided schema). + * + * @return the type value. + */ + @Generated + public ChatCompletionResponseFormatType getType() { + return this.type; + } + + /** + * Set the type property: Specifies how the LLM should format the response. Possible values: 'text' (plain string), + * 'json_object' (arbitrary JSON), or 'json_schema' (adheres to provided schema). + * + * @param type the type value to set. + * @return the ChatCompletionResponseFormat object itself. + */ + @Generated + public ChatCompletionResponseFormat setType(ChatCompletionResponseFormatType type) { + this.type = type; + return this; + } + + /** + * Get the chatCompletionSchemaProperties property: An open dictionary for extended properties. Required if 'type' + * == 'json_schema'. + * + * @return the chatCompletionSchemaProperties value. + */ + @Generated + public ChatCompletionResponseFormatJsonSchemaProperties getChatCompletionSchemaProperties() { + return this.chatCompletionSchemaProperties; + } + + /** + * Set the chatCompletionSchemaProperties property: An open dictionary for extended properties. Required if 'type' + * == 'json_schema'. + * + * @param chatCompletionSchemaProperties the chatCompletionSchemaProperties value to set. + * @return the ChatCompletionResponseFormat object itself. + */ + @Generated + public ChatCompletionResponseFormat setChatCompletionSchemaProperties( + ChatCompletionResponseFormatJsonSchemaProperties chatCompletionSchemaProperties) { + this.chatCompletionSchemaProperties = chatCompletionSchemaProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeJsonField("jsonSchemaProperties", this.chatCompletionSchemaProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChatCompletionResponseFormat from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChatCompletionResponseFormat 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 ChatCompletionResponseFormat. + */ + @Generated + public static ChatCompletionResponseFormat fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ChatCompletionResponseFormat deserializedChatCompletionResponseFormat = new ChatCompletionResponseFormat(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedChatCompletionResponseFormat.type + = ChatCompletionResponseFormatType.fromString(reader.getString()); + } else if ("jsonSchemaProperties".equals(fieldName)) { + deserializedChatCompletionResponseFormat.chatCompletionSchemaProperties + = ChatCompletionResponseFormatJsonSchemaProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedChatCompletionResponseFormat; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionResponseFormatJsonSchemaProperties.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionResponseFormatJsonSchemaProperties.java new file mode 100644 index 000000000000..b34423427942 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionResponseFormatJsonSchemaProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An open dictionary for extended properties. Required if 'type' == 'json_schema'. + */ +@Fluent +public final class ChatCompletionResponseFormatJsonSchemaProperties + implements JsonSerializable { + /* + * Name of the json schema the model will adhere to + */ + @Generated + private String name; + + /* + * Description of the json schema the model will adhere to. + */ + @Generated + private String description; + + /* + * Whether or not the model's response should use structured outputs. Default is true + */ + @Generated + private Boolean strict; + + /* + * Object defining the custom schema the model will use to structure its output. + */ + @Generated + private ChatCompletionSchema schema; + + /** + * Creates an instance of ChatCompletionResponseFormatJsonSchemaProperties class. + */ + @Generated + public ChatCompletionResponseFormatJsonSchemaProperties() { + } + + /** + * Get the name property: Name of the json schema the model will adhere to. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: Name of the json schema the model will adhere to. + * + * @param name the name value to set. + * @return the ChatCompletionResponseFormatJsonSchemaProperties object itself. + */ + @Generated + public ChatCompletionResponseFormatJsonSchemaProperties setName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: Description of the json schema the model will adhere to. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: Description of the json schema the model will adhere to. + * + * @param description the description value to set. + * @return the ChatCompletionResponseFormatJsonSchemaProperties object itself. + */ + @Generated + public ChatCompletionResponseFormatJsonSchemaProperties setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the strict property: Whether or not the model's response should use structured outputs. Default is true. + * + * @return the strict value. + */ + @Generated + public Boolean isStrict() { + return this.strict; + } + + /** + * Set the strict property: Whether or not the model's response should use structured outputs. Default is true. + * + * @param strict the strict value to set. + * @return the ChatCompletionResponseFormatJsonSchemaProperties object itself. + */ + @Generated + public ChatCompletionResponseFormatJsonSchemaProperties setStrict(Boolean strict) { + this.strict = strict; + return this; + } + + /** + * Get the schema property: Object defining the custom schema the model will use to structure its output. + * + * @return the schema value. + */ + @Generated + public ChatCompletionSchema getSchema() { + return this.schema; + } + + /** + * Set the schema property: Object defining the custom schema the model will use to structure its output. + * + * @param schema the schema value to set. + * @return the ChatCompletionResponseFormatJsonSchemaProperties object itself. + */ + @Generated + public ChatCompletionResponseFormatJsonSchemaProperties setSchema(ChatCompletionSchema schema) { + this.schema = schema; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeBooleanField("strict", this.strict); + jsonWriter.writeJsonField("schema", this.schema); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChatCompletionResponseFormatJsonSchemaProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChatCompletionResponseFormatJsonSchemaProperties 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 ChatCompletionResponseFormatJsonSchemaProperties. + */ + @Generated + public static ChatCompletionResponseFormatJsonSchemaProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ChatCompletionResponseFormatJsonSchemaProperties deserializedChatCompletionResponseFormatJsonSchemaProperties + = new ChatCompletionResponseFormatJsonSchemaProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedChatCompletionResponseFormatJsonSchemaProperties.name = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedChatCompletionResponseFormatJsonSchemaProperties.description = reader.getString(); + } else if ("strict".equals(fieldName)) { + deserializedChatCompletionResponseFormatJsonSchemaProperties.strict + = reader.getNullable(JsonReader::getBoolean); + } else if ("schema".equals(fieldName)) { + deserializedChatCompletionResponseFormatJsonSchemaProperties.schema + = ChatCompletionSchema.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedChatCompletionResponseFormatJsonSchemaProperties; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionResponseFormatType.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionResponseFormatType.java new file mode 100644 index 000000000000..6ac69fac2e29 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionResponseFormatType.java @@ -0,0 +1,65 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies how the LLM should format the response. Possible values: 'text' (plain string), 'json_object' (arbitrary + * JSON), or 'json_schema' (adheres to provided schema). + */ +public final class ChatCompletionResponseFormatType extends ExpandableStringEnum { + /** + * Static value text for ChatCompletionResponseFormatType. + */ + @Generated + public static final ChatCompletionResponseFormatType TEXT = fromString("text"); + + /** + * Static value jsonObject for ChatCompletionResponseFormatType. + */ + @Generated + public static final ChatCompletionResponseFormatType JSON_OBJECT = fromString("jsonObject"); + + /** + * Static value jsonSchema for ChatCompletionResponseFormatType. + */ + @Generated + public static final ChatCompletionResponseFormatType JSON_SCHEMA = fromString("jsonSchema"); + + /** + * Creates a new instance of ChatCompletionResponseFormatType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ChatCompletionResponseFormatType() { + } + + /** + * Creates or finds a ChatCompletionResponseFormatType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ChatCompletionResponseFormatType. + */ + @Generated + public static ChatCompletionResponseFormatType fromString(String name) { + return fromString(name, ChatCompletionResponseFormatType.class); + } + + /** + * Gets known ChatCompletionResponseFormatType values. + * + * @return known ChatCompletionResponseFormatType values. + */ + @Generated + public static Collection values() { + return values(ChatCompletionResponseFormatType.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionSchema.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionSchema.java new file mode 100644 index 000000000000..30f22c960ab7 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionSchema.java @@ -0,0 +1,196 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Object defining the custom schema the model will use to structure its output. + */ +@Fluent +public final class ChatCompletionSchema implements JsonSerializable { + /* + * Type of schema representation. Usually 'object'. Default is 'object'. + */ + @Generated + private String type; + + /* + * A JSON-formatted string that defines the output schema's properties and constraints for the model. + */ + @Generated + private String properties; + + /* + * An array of the property names that are required to be part of the model's response. All properties must be + * included for structured outputs. + */ + @Generated + private List required; + + /* + * Controls whether it is allowable for an object to contain additional keys / values that were not defined in the + * JSON Schema. Default is false. + */ + @Generated + private Boolean additionalProperties; + + /** + * Creates an instance of ChatCompletionSchema class. + */ + @Generated + public ChatCompletionSchema() { + } + + /** + * Get the type property: Type of schema representation. Usually 'object'. Default is 'object'. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * Set the type property: Type of schema representation. Usually 'object'. Default is 'object'. + * + * @param type the type value to set. + * @return the ChatCompletionSchema object itself. + */ + @Generated + public ChatCompletionSchema setType(String type) { + this.type = type; + return this; + } + + /** + * Get the properties property: A JSON-formatted string that defines the output schema's properties and constraints + * for the model. + * + * @return the properties value. + */ + @Generated + public String getProperties() { + return this.properties; + } + + /** + * Set the properties property: A JSON-formatted string that defines the output schema's properties and constraints + * for the model. + * + * @param properties the properties value to set. + * @return the ChatCompletionSchema object itself. + */ + @Generated + public ChatCompletionSchema setProperties(String properties) { + this.properties = properties; + return this; + } + + /** + * Get the required property: An array of the property names that are required to be part of the model's response. + * All properties must be included for structured outputs. + * + * @return the required value. + */ + @Generated + public List getRequired() { + return this.required; + } + + /** + * Set the required property: An array of the property names that are required to be part of the model's response. + * All properties must be included for structured outputs. + * + * @param required the required value to set. + * @return the ChatCompletionSchema object itself. + */ + @Generated + public ChatCompletionSchema setRequired(List required) { + this.required = required; + return this; + } + + /** + * Get the additionalProperties property: Controls whether it is allowable for an object to contain additional keys + * / values that were not defined in the JSON Schema. Default is false. + * + * @return the additionalProperties value. + */ + @Generated + public Boolean isAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: Controls whether it is allowable for an object to contain additional keys + * / values that were not defined in the JSON Schema. Default is false. + * + * @param additionalProperties the additionalProperties value to set. + * @return the ChatCompletionSchema object itself. + */ + @Generated + public ChatCompletionSchema setAdditionalProperties(Boolean additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("properties", this.properties); + jsonWriter.writeArrayField("required", this.required, (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("additionalProperties", this.additionalProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChatCompletionSchema from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChatCompletionSchema 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 ChatCompletionSchema. + */ + @Generated + public static ChatCompletionSchema fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ChatCompletionSchema deserializedChatCompletionSchema = new ChatCompletionSchema(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedChatCompletionSchema.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedChatCompletionSchema.properties = reader.getString(); + } else if ("required".equals(fieldName)) { + List required = reader.readArray(reader1 -> reader1.getString()); + deserializedChatCompletionSchema.required = required; + } else if ("additionalProperties".equals(fieldName)) { + deserializedChatCompletionSchema.additionalProperties = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedChatCompletionSchema; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionSkill.java new file mode 100644 index 000000000000..c3fc753c0720 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ChatCompletionSkill.java @@ -0,0 +1,432 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.List; +import java.util.Map; + +/** + * A skill that calls a language model via Azure AI Foundry's Chat Completions endpoint. + */ +@Fluent +public final class ChatCompletionSkill extends WebApiSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Custom.ChatCompletionSkill"; + + /* + * API key for authenticating to the model. Both apiKey and authIdentity cannot be specified at the same time. + */ + @Generated + private String apiKey; + + /* + * Common language model parameters that customers can tweak. If omitted, reasonable defaults will be applied. + */ + @Generated + private CommonModelParameters commonModelParameters; + + /* + * Open-type dictionary for model-specific parameters that should be appended to the chat completions call. Follows + * Azure AI Foundry’s extensibility pattern. + */ + @Generated + private Map extraParameters; + + /* + * How extra parameters are handled by Azure AI Foundry. Default is 'error'. + */ + @Generated + private ChatCompletionExtraParametersBehavior extraParametersBehavior; + + /* + * Determines how the LLM should format its response. Defaults to 'text' response type. + */ + @Generated + private ChatCompletionResponseFormat responseFormat; + + /** + * Creates an instance of ChatCompletionSkill class. + */ + @Generated + public ChatCompletionSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the apiKey property: API key for authenticating to the model. Both apiKey and authIdentity cannot be + * specified at the same time. + * + * @return the apiKey value. + */ + @Generated + public String getApiKey() { + return this.apiKey; + } + + /** + * Set the apiKey property: API key for authenticating to the model. Both apiKey and authIdentity cannot be + * specified at the same time. + * + * @param apiKey the apiKey value to set. + * @return the ChatCompletionSkill object itself. + */ + @Generated + public ChatCompletionSkill setApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Get the commonModelParameters property: Common language model parameters that customers can tweak. If omitted, + * reasonable defaults will be applied. + * + * @return the commonModelParameters value. + */ + @Generated + public CommonModelParameters getCommonModelParameters() { + return this.commonModelParameters; + } + + /** + * Set the commonModelParameters property: Common language model parameters that customers can tweak. If omitted, + * reasonable defaults will be applied. + * + * @param commonModelParameters the commonModelParameters value to set. + * @return the ChatCompletionSkill object itself. + */ + @Generated + public ChatCompletionSkill setCommonModelParameters(CommonModelParameters commonModelParameters) { + this.commonModelParameters = commonModelParameters; + return this; + } + + /** + * Get the extraParameters property: Open-type dictionary for model-specific parameters that should be appended to + * the chat completions call. Follows Azure AI Foundry’s extensibility pattern. + * + * @return the extraParameters value. + */ + @Generated + public Map getExtraParameters() { + return this.extraParameters; + } + + /** + * Set the extraParameters property: Open-type dictionary for model-specific parameters that should be appended to + * the chat completions call. Follows Azure AI Foundry’s extensibility pattern. + * + * @param extraParameters the extraParameters value to set. + * @return the ChatCompletionSkill object itself. + */ + @Generated + public ChatCompletionSkill setExtraParameters(Map extraParameters) { + this.extraParameters = extraParameters; + return this; + } + + /** + * Get the extraParametersBehavior property: How extra parameters are handled by Azure AI Foundry. Default is + * 'error'. + * + * @return the extraParametersBehavior value. + */ + @Generated + public ChatCompletionExtraParametersBehavior getExtraParametersBehavior() { + return this.extraParametersBehavior; + } + + /** + * Set the extraParametersBehavior property: How extra parameters are handled by Azure AI Foundry. Default is + * 'error'. + * + * @param extraParametersBehavior the extraParametersBehavior value to set. + * @return the ChatCompletionSkill object itself. + */ + @Generated + public ChatCompletionSkill + setExtraParametersBehavior(ChatCompletionExtraParametersBehavior extraParametersBehavior) { + this.extraParametersBehavior = extraParametersBehavior; + return this; + } + + /** + * Get the responseFormat property: Determines how the LLM should format its response. Defaults to 'text' response + * type. + * + * @return the responseFormat value. + */ + @Generated + public ChatCompletionResponseFormat getResponseFormat() { + return this.responseFormat; + } + + /** + * Set the responseFormat property: Determines how the LLM should format its response. Defaults to 'text' response + * type. + * + * @param responseFormat the responseFormat value to set. + * @return the ChatCompletionSkill object itself. + */ + @Generated + public ChatCompletionSkill setResponseFormat(ChatCompletionResponseFormat responseFormat) { + this.responseFormat = responseFormat; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ChatCompletionSkill setUri(String uri) { + super.setUri(uri); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ChatCompletionSkill setHttpHeaders(Map httpHeaders) { + super.setHttpHeaders(httpHeaders); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ChatCompletionSkill setHttpMethod(String httpMethod) { + super.setHttpMethod(httpMethod); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ChatCompletionSkill setTimeout(Duration timeout) { + super.setTimeout(timeout); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ChatCompletionSkill setBatchSize(Integer batchSize) { + super.setBatchSize(batchSize); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ChatCompletionSkill setDegreeOfParallelism(Integer degreeOfParallelism) { + super.setDegreeOfParallelism(degreeOfParallelism); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ChatCompletionSkill setAuthResourceId(String authResourceId) { + super.setAuthResourceId(authResourceId); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ChatCompletionSkill setAuthIdentity(SearchIndexerDataIdentity authIdentity) { + super.setAuthIdentity(authIdentity); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ChatCompletionSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ChatCompletionSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ChatCompletionSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ChatCompletionSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ChatCompletionSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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("uri", getUri()); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("description", getDescription()); + jsonWriter.writeStringField("context", getContext()); + jsonWriter.writeMapField("httpHeaders", getHttpHeaders(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("httpMethod", getHttpMethod()); + jsonWriter.writeStringField("timeout", CoreUtils.durationToStringWithDays(getTimeout())); + jsonWriter.writeNumberField("batchSize", getBatchSize()); + jsonWriter.writeNumberField("degreeOfParallelism", getDegreeOfParallelism()); + jsonWriter.writeStringField("authResourceId", getAuthResourceId()); + jsonWriter.writeJsonField("authIdentity", getAuthIdentity()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeStringField("apiKey", this.apiKey); + jsonWriter.writeJsonField("commonModelParameters", this.commonModelParameters); + jsonWriter.writeMapField("extraParameters", this.extraParameters, + (writer, element) -> writer.writeUntyped(element)); + jsonWriter.writeStringField("extraParametersBehavior", + this.extraParametersBehavior == null ? null : this.extraParametersBehavior.toString()); + jsonWriter.writeJsonField("responseFormat", this.responseFormat); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChatCompletionSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChatCompletionSkill 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 ChatCompletionSkill. + */ + @Generated + public static ChatCompletionSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ChatCompletionSkill deserializedChatCompletionSkill = new ChatCompletionSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedChatCompletionSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedChatCompletionSkill.setOutputs(outputs); + } else if ("uri".equals(fieldName)) { + deserializedChatCompletionSkill.setUri(reader.getString()); + } else if ("name".equals(fieldName)) { + deserializedChatCompletionSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedChatCompletionSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedChatCompletionSkill.setContext(reader.getString()); + } else if ("httpHeaders".equals(fieldName)) { + Map httpHeaders = reader.readMap(reader1 -> reader1.getString()); + deserializedChatCompletionSkill.setHttpHeaders(httpHeaders); + } else if ("httpMethod".equals(fieldName)) { + deserializedChatCompletionSkill.setHttpMethod(reader.getString()); + } else if ("timeout".equals(fieldName)) { + deserializedChatCompletionSkill + .setTimeout(reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString()))); + } else if ("batchSize".equals(fieldName)) { + deserializedChatCompletionSkill.setBatchSize(reader.getNullable(JsonReader::getInt)); + } else if ("degreeOfParallelism".equals(fieldName)) { + deserializedChatCompletionSkill.setDegreeOfParallelism(reader.getNullable(JsonReader::getInt)); + } else if ("authResourceId".equals(fieldName)) { + deserializedChatCompletionSkill.setAuthResourceId(reader.getString()); + } else if ("authIdentity".equals(fieldName)) { + deserializedChatCompletionSkill.setAuthIdentity(SearchIndexerDataIdentity.fromJson(reader)); + } else if ("@odata.type".equals(fieldName)) { + deserializedChatCompletionSkill.odataType = reader.getString(); + } else if ("apiKey".equals(fieldName)) { + deserializedChatCompletionSkill.apiKey = reader.getString(); + } else if ("commonModelParameters".equals(fieldName)) { + deserializedChatCompletionSkill.commonModelParameters = CommonModelParameters.fromJson(reader); + } else if ("extraParameters".equals(fieldName)) { + Map extraParameters = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedChatCompletionSkill.extraParameters = extraParameters; + } else if ("extraParametersBehavior".equals(fieldName)) { + deserializedChatCompletionSkill.extraParametersBehavior + = ChatCompletionExtraParametersBehavior.fromString(reader.getString()); + } else if ("responseFormat".equals(fieldName)) { + deserializedChatCompletionSkill.responseFormat = ChatCompletionResponseFormat.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedChatCompletionSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CjkBigramTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CjkBigramTokenFilter.java new file mode 100644 index 000000000000..efb10be866af --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CjkBigramTokenFilter.java @@ -0,0 +1,165 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Forms bigrams of CJK terms that are generated from the standard tokenizer. This token filter is implemented using + * Apache Lucene. + */ +@Fluent +public final class CjkBigramTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.CjkBigramTokenFilter"; + + /* + * The scripts to ignore. + */ + @Generated + private List ignoreScripts; + + /* + * A value indicating whether to output both unigrams and bigrams (if true), or just bigrams (if false). Default is + * false. + */ + @Generated + private Boolean outputUnigrams; + + /** + * Creates an instance of CjkBigramTokenFilter class. + */ + @Generated + public CjkBigramTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the ignoreScripts property: The scripts to ignore. + * + * @return the ignoreScripts value. + */ + @Generated + public List getIgnoreScripts() { + return this.ignoreScripts; + } + + /** + * Set the ignoreScripts property: The scripts to ignore. + * + * @param ignoreScripts the ignoreScripts value to set. + * @return the CjkBigramTokenFilter object itself. + */ + @Generated + public CjkBigramTokenFilter setIgnoreScripts(List ignoreScripts) { + this.ignoreScripts = ignoreScripts; + return this; + } + + /** + * Get the outputUnigrams property: A value indicating whether to output both unigrams and bigrams (if true), or + * just bigrams (if false). Default is false. + * + * @return the outputUnigrams value. + */ + @Generated + public Boolean isOutputUnigrams() { + return this.outputUnigrams; + } + + /** + * Set the outputUnigrams property: A value indicating whether to output both unigrams and bigrams (if true), or + * just bigrams (if false). Default is false. + * + * @param outputUnigrams the outputUnigrams value to set. + * @return the CjkBigramTokenFilter object itself. + */ + @Generated + public CjkBigramTokenFilter setOutputUnigrams(Boolean outputUnigrams) { + this.outputUnigrams = outputUnigrams; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public CjkBigramTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeArrayField("ignoreScripts", this.ignoreScripts, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeBooleanField("outputUnigrams", this.outputUnigrams); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CjkBigramTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CjkBigramTokenFilter 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 CjkBigramTokenFilter. + */ + @Generated + public static CjkBigramTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CjkBigramTokenFilter deserializedCjkBigramTokenFilter = new CjkBigramTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCjkBigramTokenFilter.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedCjkBigramTokenFilter.odataType = reader.getString(); + } else if ("ignoreScripts".equals(fieldName)) { + List ignoreScripts + = reader.readArray(reader1 -> CjkBigramTokenFilterScripts.fromString(reader1.getString())); + deserializedCjkBigramTokenFilter.ignoreScripts = ignoreScripts; + } else if ("outputUnigrams".equals(fieldName)) { + deserializedCjkBigramTokenFilter.outputUnigrams = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedCjkBigramTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CjkBigramTokenFilterScripts.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CjkBigramTokenFilterScripts.java new file mode 100644 index 000000000000..eceeb63b3577 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CjkBigramTokenFilterScripts.java @@ -0,0 +1,67 @@ +// 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.models; + +/** + * Scripts that can be ignored by CjkBigramTokenFilter. + */ +public enum CjkBigramTokenFilterScripts { + /** + * Ignore Han script when forming bigrams of CJK terms. + */ + HAN("han"), + + /** + * Ignore Hiragana script when forming bigrams of CJK terms. + */ + HIRAGANA("hiragana"), + + /** + * Ignore Katakana script when forming bigrams of CJK terms. + */ + KATAKANA("katakana"), + + /** + * Ignore Hangul script when forming bigrams of CJK terms. + */ + HANGUL("hangul"); + + /** + * The actual serialized value for a CjkBigramTokenFilterScripts instance. + */ + private final String value; + + CjkBigramTokenFilterScripts(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CjkBigramTokenFilterScripts instance. + * + * @param value the serialized value to parse. + * @return the parsed CjkBigramTokenFilterScripts object, or null if unable to parse. + */ + public static CjkBigramTokenFilterScripts fromString(String value) { + if (value == null) { + return null; + } + CjkBigramTokenFilterScripts[] items = CjkBigramTokenFilterScripts.values(); + for (CjkBigramTokenFilterScripts item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ClassicSimilarity.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ClassicSimilarity.java new file mode 100644 index 000000000000..65d72d7af166 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ClassicSimilarity.java @@ -0,0 +1,83 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Legacy similarity algorithm which uses the Lucene TFIDFSimilarity implementation of TF-IDF. This variation of TF-IDF + * introduces static document length normalization as well as coordinating factors that penalize documents that only + * partially match the searched queries. + */ +@Immutable +public final class ClassicSimilarity extends Similarity { + /* + * The @odata.type property. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.ClassicSimilarity"; + + /** + * Creates an instance of ClassicSimilarity class. + */ + @Generated + public ClassicSimilarity() { + } + + /** + * Get the odataType property: The @odata.type property. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClassicSimilarity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClassicSimilarity 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 ClassicSimilarity. + */ + @Generated + public static ClassicSimilarity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClassicSimilarity deserializedClassicSimilarity = new ClassicSimilarity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("@odata.type".equals(fieldName)) { + deserializedClassicSimilarity.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedClassicSimilarity; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ClassicTokenizer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ClassicTokenizer.java new file mode 100644 index 000000000000..6828b94d9ec6 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ClassicTokenizer.java @@ -0,0 +1,130 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Grammar-based tokenizer that is suitable for processing most European-language documents. This tokenizer is + * implemented using Apache Lucene. + */ +@Fluent +public final class ClassicTokenizer extends LexicalTokenizer { + /* + * A URI fragment specifying the type of tokenizer. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.ClassicTokenizer"; + + /* + * The maximum token length. Default is 255. Tokens longer than the maximum length are split. The maximum token + * length that can be used is 300 characters. + */ + @Generated + private Integer maxTokenLength; + + /** + * Creates an instance of ClassicTokenizer class. + */ + @Generated + public ClassicTokenizer() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of tokenizer. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the maxTokenLength property: The maximum token length. Default is 255. Tokens longer than the maximum length + * are split. The maximum token length that can be used is 300 characters. + * + * @return the maxTokenLength value. + */ + @Generated + public Integer getMaxTokenLength() { + return this.maxTokenLength; + } + + /** + * Set the maxTokenLength property: The maximum token length. Default is 255. Tokens longer than the maximum length + * are split. The maximum token length that can be used is 300 characters. + * + * @param maxTokenLength the maxTokenLength value to set. + * @return the ClassicTokenizer object itself. + */ + @Generated + public ClassicTokenizer setMaxTokenLength(Integer maxTokenLength) { + this.maxTokenLength = maxTokenLength; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ClassicTokenizer setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("maxTokenLength", this.maxTokenLength); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClassicTokenizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClassicTokenizer 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 ClassicTokenizer. + */ + @Generated + public static ClassicTokenizer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClassicTokenizer deserializedClassicTokenizer = new ClassicTokenizer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedClassicTokenizer.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedClassicTokenizer.odataType = reader.getString(); + } else if ("maxTokenLength".equals(fieldName)) { + deserializedClassicTokenizer.maxTokenLength = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedClassicTokenizer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CognitiveServicesAccount.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CognitiveServicesAccount.java new file mode 100644 index 000000000000..eb8c917f74ff --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CognitiveServicesAccount.java @@ -0,0 +1,145 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 describing any Azure AI service resource attached to a skillset. + */ +@Fluent +public class CognitiveServicesAccount implements JsonSerializable { + /* + * A URI fragment specifying the type of Azure AI service resource attached to a skillset. + */ + @Generated + private String odataType = "CognitiveServicesAccount"; + + /* + * Description of the Azure AI service resource attached to a skillset. + */ + @Generated + private String description; + + /** + * Creates an instance of CognitiveServicesAccount class. + */ + @Generated + public CognitiveServicesAccount() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of Azure AI service resource attached to a + * skillset. + * + * @return the odataType value. + */ + @Generated + public String getOdataType() { + return this.odataType; + } + + /** + * Get the description property: Description of the Azure AI service resource attached to a skillset. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: Description of the Azure AI service resource attached to a skillset. + * + * @param description the description value to set. + * @return the CognitiveServicesAccount object itself. + */ + @Generated + public CognitiveServicesAccount setDescription(String description) { + this.description = description; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CognitiveServicesAccount from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CognitiveServicesAccount 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 CognitiveServicesAccount. + */ + @Generated + public static CognitiveServicesAccount 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.DefaultCognitiveServices".equals(discriminatorValue)) { + return DefaultCognitiveServicesAccount.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.CognitiveServicesByKey".equals(discriminatorValue)) { + return CognitiveServicesAccountKey.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.AIServicesByKey".equals(discriminatorValue)) { + return AIServicesAccountKey.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.AIServicesByIdentity".equals(discriminatorValue)) { + return AIServicesAccountIdentity.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static CognitiveServicesAccount fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CognitiveServicesAccount deserializedCognitiveServicesAccount = new CognitiveServicesAccount(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("@odata.type".equals(fieldName)) { + deserializedCognitiveServicesAccount.odataType = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedCognitiveServicesAccount.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCognitiveServicesAccount; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CognitiveServicesAccountKey.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CognitiveServicesAccountKey.java new file mode 100644 index 000000000000..50a17883e3e9 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CognitiveServicesAccountKey.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The multi-region account key of an Azure AI service resource that's attached to a skillset. + */ +@Fluent +public final class CognitiveServicesAccountKey extends CognitiveServicesAccount { + /* + * A URI fragment specifying the type of Azure AI service resource attached to a skillset. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.CognitiveServicesByKey"; + + /* + * The key used to provision the Azure AI service resource attached to a skillset. + */ + @Generated + private String key; + + /** + * Creates an instance of CognitiveServicesAccountKey class. + */ + @Generated + public CognitiveServicesAccountKey() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of Azure AI service resource attached to a + * skillset. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the key property: The key used to provision the Azure AI service resource attached to a skillset. + * + * @return the key value. + */ + @Generated + public String getKey() { + return this.key; + } + + /** + * Set the key property: The key used to provision the Azure AI service resource attached to a skillset. + * + * @param key the key value to set. + * @return the CognitiveServicesAccountKey object itself. + */ + @Generated + public CognitiveServicesAccountKey setKey(String key) { + this.key = key; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public CognitiveServicesAccountKey setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", getDescription()); + jsonWriter.writeStringField("key", this.key); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CognitiveServicesAccountKey from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CognitiveServicesAccountKey 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 CognitiveServicesAccountKey. + */ + @Generated + public static CognitiveServicesAccountKey fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CognitiveServicesAccountKey deserializedCognitiveServicesAccountKey = new CognitiveServicesAccountKey(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedCognitiveServicesAccountKey.setDescription(reader.getString()); + } else if ("key".equals(fieldName)) { + deserializedCognitiveServicesAccountKey.key = reader.getString(); + } else if ("@odata.type".equals(fieldName)) { + deserializedCognitiveServicesAccountKey.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCognitiveServicesAccountKey; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CommonGramTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CommonGramTokenFilter.java new file mode 100644 index 000000000000..378eace536c0 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CommonGramTokenFilter.java @@ -0,0 +1,198 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Construct bigrams for frequently occurring terms while indexing. Single terms are still indexed too, with bigrams + * overlaid. This token filter is implemented using Apache Lucene. + */ +@Fluent +public final class CommonGramTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.CommonGramTokenFilter"; + + /* + * The set of common words. + */ + @Generated + private List commonWords; + + /* + * A value indicating whether common words matching will be case insensitive. Default is false. + */ + @Generated + private Boolean ignoreCase; + + /* + * A value that indicates whether the token filter is in query mode. When in query mode, the token filter generates + * bigrams and then removes common words and single terms followed by a common word. Default is false. + */ + @Generated + private Boolean useQueryMode; + + /** + * Creates an instance of CommonGramTokenFilter class. + */ + @Generated + public CommonGramTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the commonWords property: The set of common words. + * + * @return the commonWords value. + */ + @Generated + public List getCommonWords() { + return this.commonWords; + } + + /** + * Set the commonWords property: The set of common words. + * + * @param commonWords the commonWords value to set. + * @return the CommonGramTokenFilter object itself. + */ + @Generated + public CommonGramTokenFilter setCommonWords(List commonWords) { + this.commonWords = commonWords; + return this; + } + + /** + * Get the ignoreCase property: A value indicating whether common words matching will be case insensitive. Default + * is false. + * + * @return the ignoreCase value. + */ + @Generated + public Boolean isIgnoreCase() { + return this.ignoreCase; + } + + /** + * Set the ignoreCase property: A value indicating whether common words matching will be case insensitive. Default + * is false. + * + * @param ignoreCase the ignoreCase value to set. + * @return the CommonGramTokenFilter object itself. + */ + @Generated + public CommonGramTokenFilter setIgnoreCase(Boolean ignoreCase) { + this.ignoreCase = ignoreCase; + return this; + } + + /** + * Get the useQueryMode property: A value that indicates whether the token filter is in query mode. When in query + * mode, the token filter generates bigrams and then removes common words and single terms followed by a common + * word. Default is false. + * + * @return the useQueryMode value. + */ + @Generated + public Boolean isUseQueryMode() { + return this.useQueryMode; + } + + /** + * Set the useQueryMode property: A value that indicates whether the token filter is in query mode. When in query + * mode, the token filter generates bigrams and then removes common words and single terms followed by a common + * word. Default is false. + * + * @param useQueryMode the useQueryMode value to set. + * @return the CommonGramTokenFilter object itself. + */ + @Generated + public CommonGramTokenFilter setUseQueryMode(Boolean useQueryMode) { + this.useQueryMode = useQueryMode; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public CommonGramTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeArrayField("commonWords", this.commonWords, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeBooleanField("ignoreCase", this.ignoreCase); + jsonWriter.writeBooleanField("queryMode", this.useQueryMode); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommonGramTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommonGramTokenFilter 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 CommonGramTokenFilter. + */ + @Generated + public static CommonGramTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommonGramTokenFilter deserializedCommonGramTokenFilter = new CommonGramTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCommonGramTokenFilter.setName(reader.getString()); + } else if ("commonWords".equals(fieldName)) { + List commonWords = reader.readArray(reader1 -> reader1.getString()); + deserializedCommonGramTokenFilter.commonWords = commonWords; + } else if ("@odata.type".equals(fieldName)) { + deserializedCommonGramTokenFilter.odataType = reader.getString(); + } else if ("ignoreCase".equals(fieldName)) { + deserializedCommonGramTokenFilter.ignoreCase = reader.getNullable(JsonReader::getBoolean); + } else if ("queryMode".equals(fieldName)) { + deserializedCommonGramTokenFilter.useQueryMode = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedCommonGramTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CommonModelParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CommonModelParameters.java new file mode 100644 index 000000000000..eae5deaaf4e1 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CommonModelParameters.java @@ -0,0 +1,285 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Common language model parameters for Chat Completions. If omitted, default values are used. + */ +@Fluent +public final class CommonModelParameters implements JsonSerializable { + /* + * The name of the model to use (e.g., 'gpt-4o', etc.). Default is null if not specified. + */ + @Generated + private String model; + + /* + * A float in the range [-2,2] that reduces or increases likelihood of repeated tokens. Default is 0. + */ + @Generated + private Float frequencyPenalty; + + /* + * A float in the range [-2,2] that penalizes new tokens based on their existing presence. Default is 0. + */ + @Generated + private Float presencePenalty; + + /* + * Maximum number of tokens to generate. + */ + @Generated + private Integer maxTokens; + + /* + * Sampling temperature. Default is 0.7. + */ + @Generated + private Float temperature; + + /* + * Random seed for controlling deterministic outputs. If omitted, randomization is used. + */ + @Generated + private Integer seed; + + /* + * List of stop sequences that will cut off text generation. Default is none. + */ + @Generated + private List stop; + + /** + * Creates an instance of CommonModelParameters class. + */ + @Generated + public CommonModelParameters() { + } + + /** + * Get the model property: The name of the model to use (e.g., 'gpt-4o', etc.). Default is null if not specified. + * + * @return the model value. + */ + @Generated + public String getModel() { + return this.model; + } + + /** + * Set the model property: The name of the model to use (e.g., 'gpt-4o', etc.). Default is null if not specified. + * + * @param model the model value to set. + * @return the CommonModelParameters object itself. + */ + @Generated + public CommonModelParameters setModel(String model) { + this.model = model; + return this; + } + + /** + * Get the frequencyPenalty property: A float in the range [-2,2] that reduces or increases likelihood of repeated + * tokens. Default is 0. + * + * @return the frequencyPenalty value. + */ + @Generated + public Float getFrequencyPenalty() { + return this.frequencyPenalty; + } + + /** + * Set the frequencyPenalty property: A float in the range [-2,2] that reduces or increases likelihood of repeated + * tokens. Default is 0. + * + * @param frequencyPenalty the frequencyPenalty value to set. + * @return the CommonModelParameters object itself. + */ + @Generated + public CommonModelParameters setFrequencyPenalty(Float frequencyPenalty) { + this.frequencyPenalty = frequencyPenalty; + return this; + } + + /** + * Get the presencePenalty property: A float in the range [-2,2] that penalizes new tokens based on their existing + * presence. Default is 0. + * + * @return the presencePenalty value. + */ + @Generated + public Float getPresencePenalty() { + return this.presencePenalty; + } + + /** + * Set the presencePenalty property: A float in the range [-2,2] that penalizes new tokens based on their existing + * presence. Default is 0. + * + * @param presencePenalty the presencePenalty value to set. + * @return the CommonModelParameters object itself. + */ + @Generated + public CommonModelParameters setPresencePenalty(Float presencePenalty) { + this.presencePenalty = presencePenalty; + return this; + } + + /** + * Get the maxTokens property: Maximum number of tokens to generate. + * + * @return the maxTokens value. + */ + @Generated + public Integer getMaxTokens() { + return this.maxTokens; + } + + /** + * Set the maxTokens property: Maximum number of tokens to generate. + * + * @param maxTokens the maxTokens value to set. + * @return the CommonModelParameters object itself. + */ + @Generated + public CommonModelParameters setMaxTokens(Integer maxTokens) { + this.maxTokens = maxTokens; + return this; + } + + /** + * Get the temperature property: Sampling temperature. Default is 0.7. + * + * @return the temperature value. + */ + @Generated + public Float getTemperature() { + return this.temperature; + } + + /** + * Set the temperature property: Sampling temperature. Default is 0.7. + * + * @param temperature the temperature value to set. + * @return the CommonModelParameters object itself. + */ + @Generated + public CommonModelParameters setTemperature(Float temperature) { + this.temperature = temperature; + return this; + } + + /** + * Get the seed property: Random seed for controlling deterministic outputs. If omitted, randomization is used. + * + * @return the seed value. + */ + @Generated + public Integer getSeed() { + return this.seed; + } + + /** + * Set the seed property: Random seed for controlling deterministic outputs. If omitted, randomization is used. + * + * @param seed the seed value to set. + * @return the CommonModelParameters object itself. + */ + @Generated + public CommonModelParameters setSeed(Integer seed) { + this.seed = seed; + return this; + } + + /** + * Get the stop property: List of stop sequences that will cut off text generation. Default is none. + * + * @return the stop value. + */ + @Generated + public List getStop() { + return this.stop; + } + + /** + * Set the stop property: List of stop sequences that will cut off text generation. Default is none. + * + * @param stop the stop value to set. + * @return the CommonModelParameters object itself. + */ + @Generated + public CommonModelParameters setStop(List stop) { + this.stop = stop; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("model", this.model); + jsonWriter.writeNumberField("frequencyPenalty", this.frequencyPenalty); + jsonWriter.writeNumberField("presencePenalty", this.presencePenalty); + jsonWriter.writeNumberField("maxTokens", this.maxTokens); + jsonWriter.writeNumberField("temperature", this.temperature); + jsonWriter.writeNumberField("seed", this.seed); + jsonWriter.writeArrayField("stop", this.stop, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommonModelParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommonModelParameters 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 CommonModelParameters. + */ + @Generated + public static CommonModelParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommonModelParameters deserializedCommonModelParameters = new CommonModelParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("model".equals(fieldName)) { + deserializedCommonModelParameters.model = reader.getString(); + } else if ("frequencyPenalty".equals(fieldName)) { + deserializedCommonModelParameters.frequencyPenalty = reader.getNullable(JsonReader::getFloat); + } else if ("presencePenalty".equals(fieldName)) { + deserializedCommonModelParameters.presencePenalty = reader.getNullable(JsonReader::getFloat); + } else if ("maxTokens".equals(fieldName)) { + deserializedCommonModelParameters.maxTokens = reader.getNullable(JsonReader::getInt); + } else if ("temperature".equals(fieldName)) { + deserializedCommonModelParameters.temperature = reader.getNullable(JsonReader::getFloat); + } else if ("seed".equals(fieldName)) { + deserializedCommonModelParameters.seed = reader.getNullable(JsonReader::getInt); + } else if ("stop".equals(fieldName)) { + List stop = reader.readArray(reader1 -> reader1.getString()); + deserializedCommonModelParameters.stop = stop; + } else { + reader.skipChildren(); + } + } + + return deserializedCommonModelParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CompletedSynchronizationState.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CompletedSynchronizationState.java new file mode 100644 index 000000000000..89f55adeffeb --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CompletedSynchronizationState.java @@ -0,0 +1,228 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Represents the completed state of the last synchronization. + */ +@Fluent +public final class CompletedSynchronizationState implements JsonSerializable { + /* + * The start time of the last completed synchronization. + */ + @Generated + private OffsetDateTime startTime; + + /* + * The end time of the last completed synchronization. + */ + @Generated + private OffsetDateTime endTime; + + /* + * The number of item updates successfully processed in the last synchronization. + */ + @Generated + private int itemsUpdatesProcessed; + + /* + * The number of item updates that failed in the last synchronization. + */ + @Generated + private int itemsUpdatesFailed; + + /* + * The number of items skipped in the last synchronization. + */ + @Generated + private int itemsSkipped; + + /** + * Creates an instance of CompletedSynchronizationState class. + */ + @Generated + public CompletedSynchronizationState() { + } + + /** + * Get the startTime property: The start time of the last completed synchronization. + * + * @return the startTime value. + */ + @Generated + public OffsetDateTime getStartTime() { + return this.startTime; + } + + /** + * Set the startTime property: The start time of the last completed synchronization. + * + * @param startTime the startTime value to set. + * @return the CompletedSynchronizationState object itself. + */ + @Generated + public CompletedSynchronizationState setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: The end time of the last completed synchronization. + * + * @return the endTime value. + */ + @Generated + public OffsetDateTime getEndTime() { + return this.endTime; + } + + /** + * Set the endTime property: The end time of the last completed synchronization. + * + * @param endTime the endTime value to set. + * @return the CompletedSynchronizationState object itself. + */ + @Generated + public CompletedSynchronizationState setEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the itemsUpdatesProcessed property: The number of item updates successfully processed in the last + * synchronization. + * + * @return the itemsUpdatesProcessed value. + */ + @Generated + public int getItemsUpdatesProcessed() { + return this.itemsUpdatesProcessed; + } + + /** + * Set the itemsUpdatesProcessed property: The number of item updates successfully processed in the last + * synchronization. + * + * @param itemsUpdatesProcessed the itemsUpdatesProcessed value to set. + * @return the CompletedSynchronizationState object itself. + */ + @Generated + public CompletedSynchronizationState setItemsUpdatesProcessed(int itemsUpdatesProcessed) { + this.itemsUpdatesProcessed = itemsUpdatesProcessed; + return this; + } + + /** + * Get the itemsUpdatesFailed property: The number of item updates that failed in the last synchronization. + * + * @return the itemsUpdatesFailed value. + */ + @Generated + public int getItemsUpdatesFailed() { + return this.itemsUpdatesFailed; + } + + /** + * Set the itemsUpdatesFailed property: The number of item updates that failed in the last synchronization. + * + * @param itemsUpdatesFailed the itemsUpdatesFailed value to set. + * @return the CompletedSynchronizationState object itself. + */ + @Generated + public CompletedSynchronizationState setItemsUpdatesFailed(int itemsUpdatesFailed) { + this.itemsUpdatesFailed = itemsUpdatesFailed; + return this; + } + + /** + * Get the itemsSkipped property: The number of items skipped in the last synchronization. + * + * @return the itemsSkipped value. + */ + @Generated + public int getItemsSkipped() { + return this.itemsSkipped; + } + + /** + * Set the itemsSkipped property: The number of items skipped in the last synchronization. + * + * @param itemsSkipped the itemsSkipped value to set. + * @return the CompletedSynchronizationState object itself. + */ + @Generated + public CompletedSynchronizationState setItemsSkipped(int itemsSkipped) { + this.itemsSkipped = itemsSkipped; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + jsonWriter.writeStringField("endTime", + this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime)); + jsonWriter.writeIntField("itemsUpdatesProcessed", this.itemsUpdatesProcessed); + jsonWriter.writeIntField("itemsUpdatesFailed", this.itemsUpdatesFailed); + jsonWriter.writeIntField("itemsSkipped", this.itemsSkipped); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CompletedSynchronizationState from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CompletedSynchronizationState 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 CompletedSynchronizationState. + */ + @Generated + public static CompletedSynchronizationState fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CompletedSynchronizationState deserializedCompletedSynchronizationState + = new CompletedSynchronizationState(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("startTime".equals(fieldName)) { + deserializedCompletedSynchronizationState.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedCompletedSynchronizationState.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("itemsUpdatesProcessed".equals(fieldName)) { + deserializedCompletedSynchronizationState.itemsUpdatesProcessed = reader.getInt(); + } else if ("itemsUpdatesFailed".equals(fieldName)) { + deserializedCompletedSynchronizationState.itemsUpdatesFailed = reader.getInt(); + } else if ("itemsSkipped".equals(fieldName)) { + deserializedCompletedSynchronizationState.itemsSkipped = reader.getInt(); + } else { + reader.skipChildren(); + } + } + + return deserializedCompletedSynchronizationState; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ConditionalSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ConditionalSkill.java new file mode 100644 index 000000000000..b9ebfefbba9c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ConditionalSkill.java @@ -0,0 +1,152 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A skill that enables scenarios that require a Boolean operation to determine the data to assign to an output. + */ +@Fluent +public final class ConditionalSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Util.ConditionalSkill"; + + /** + * Creates an instance of ConditionalSkill class. + */ + @Generated + public ConditionalSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ConditionalSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ConditionalSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ConditionalSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ConditionalSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ConditionalSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConditionalSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConditionalSkill 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 ConditionalSkill. + */ + @Generated + public static ConditionalSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConditionalSkill deserializedConditionalSkill = new ConditionalSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedConditionalSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedConditionalSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedConditionalSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedConditionalSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedConditionalSkill.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedConditionalSkill.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedConditionalSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ContentUnderstandingSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ContentUnderstandingSkill.java new file mode 100644 index 000000000000..a5de91fb9a0e --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ContentUnderstandingSkill.java @@ -0,0 +1,223 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A skill that leverages Azure AI Content Understanding to process and extract structured insights from documents, + * enabling enriched, searchable content for enhanced document indexing and retrieval. + */ +@Fluent +public final class ContentUnderstandingSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Util.ContentUnderstandingSkill"; + + /* + * Controls the cardinality of the content extracted from the document by the skill + */ + @Generated + private List extractionOptions; + + /* + * Controls the cardinality for chunking the content. + */ + @Generated + private ContentUnderstandingSkillChunkingProperties chunkingProperties; + + /** + * Creates an instance of ContentUnderstandingSkill class. + */ + @Generated + public ContentUnderstandingSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the extractionOptions property: Controls the cardinality of the content extracted from the document by the + * skill. + * + * @return the extractionOptions value. + */ + @Generated + public List getExtractionOptions() { + return this.extractionOptions; + } + + /** + * Set the extractionOptions property: Controls the cardinality of the content extracted from the document by the + * skill. + * + * @param extractionOptions the extractionOptions value to set. + * @return the ContentUnderstandingSkill object itself. + */ + @Generated + public ContentUnderstandingSkill + setExtractionOptions(List extractionOptions) { + this.extractionOptions = extractionOptions; + return this; + } + + /** + * Get the chunkingProperties property: Controls the cardinality for chunking the content. + * + * @return the chunkingProperties value. + */ + @Generated + public ContentUnderstandingSkillChunkingProperties getChunkingProperties() { + return this.chunkingProperties; + } + + /** + * Set the chunkingProperties property: Controls the cardinality for chunking the content. + * + * @param chunkingProperties the chunkingProperties value to set. + * @return the ContentUnderstandingSkill object itself. + */ + @Generated + public ContentUnderstandingSkill + setChunkingProperties(ContentUnderstandingSkillChunkingProperties chunkingProperties) { + this.chunkingProperties = chunkingProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ContentUnderstandingSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ContentUnderstandingSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ContentUnderstandingSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ContentUnderstandingSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ContentUnderstandingSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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.writeArrayField("extractionOptions", this.extractionOptions, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeJsonField("chunkingProperties", this.chunkingProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ContentUnderstandingSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ContentUnderstandingSkill 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 ContentUnderstandingSkill. + */ + @Generated + public static ContentUnderstandingSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ContentUnderstandingSkill deserializedContentUnderstandingSkill = new ContentUnderstandingSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedContentUnderstandingSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedContentUnderstandingSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedContentUnderstandingSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedContentUnderstandingSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedContentUnderstandingSkill.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedContentUnderstandingSkill.odataType = reader.getString(); + } else if ("extractionOptions".equals(fieldName)) { + List extractionOptions = reader.readArray( + reader1 -> ContentUnderstandingSkillExtractionOptions.fromString(reader1.getString())); + deserializedContentUnderstandingSkill.extractionOptions = extractionOptions; + } else if ("chunkingProperties".equals(fieldName)) { + deserializedContentUnderstandingSkill.chunkingProperties + = ContentUnderstandingSkillChunkingProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedContentUnderstandingSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ContentUnderstandingSkillChunkingProperties.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ContentUnderstandingSkillChunkingProperties.java new file mode 100644 index 000000000000..742ae0a47930 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ContentUnderstandingSkillChunkingProperties.java @@ -0,0 +1,160 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Controls the cardinality for chunking the content. + */ +@Fluent +public final class ContentUnderstandingSkillChunkingProperties + implements JsonSerializable { + /* + * The unit of the chunk. + */ + @Generated + private ContentUnderstandingSkillChunkingUnit unit; + + /* + * The maximum chunk length in characters. Default is 500. + */ + @Generated + private Integer maximumLength; + + /* + * The length of overlap provided between two text chunks. Default is 0. + */ + @Generated + private Integer overlapLength; + + /** + * Creates an instance of ContentUnderstandingSkillChunkingProperties class. + */ + @Generated + public ContentUnderstandingSkillChunkingProperties() { + } + + /** + * Get the unit property: The unit of the chunk. + * + * @return the unit value. + */ + @Generated + public ContentUnderstandingSkillChunkingUnit getUnit() { + return this.unit; + } + + /** + * Set the unit property: The unit of the chunk. + * + * @param unit the unit value to set. + * @return the ContentUnderstandingSkillChunkingProperties object itself. + */ + @Generated + public ContentUnderstandingSkillChunkingProperties setUnit(ContentUnderstandingSkillChunkingUnit unit) { + this.unit = unit; + return this; + } + + /** + * Get the maximumLength property: The maximum chunk length in characters. Default is 500. + * + * @return the maximumLength value. + */ + @Generated + public Integer getMaximumLength() { + return this.maximumLength; + } + + /** + * Set the maximumLength property: The maximum chunk length in characters. Default is 500. + * + * @param maximumLength the maximumLength value to set. + * @return the ContentUnderstandingSkillChunkingProperties object itself. + */ + @Generated + public ContentUnderstandingSkillChunkingProperties setMaximumLength(Integer maximumLength) { + this.maximumLength = maximumLength; + return this; + } + + /** + * Get the overlapLength property: The length of overlap provided between two text chunks. Default is 0. + * + * @return the overlapLength value. + */ + @Generated + public Integer getOverlapLength() { + return this.overlapLength; + } + + /** + * Set the overlapLength property: The length of overlap provided between two text chunks. Default is 0. + * + * @param overlapLength the overlapLength value to set. + * @return the ContentUnderstandingSkillChunkingProperties object itself. + */ + @Generated + public ContentUnderstandingSkillChunkingProperties setOverlapLength(Integer overlapLength) { + this.overlapLength = overlapLength; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("unit", this.unit == null ? null : this.unit.toString()); + jsonWriter.writeNumberField("maximumLength", this.maximumLength); + jsonWriter.writeNumberField("overlapLength", this.overlapLength); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ContentUnderstandingSkillChunkingProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ContentUnderstandingSkillChunkingProperties 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 ContentUnderstandingSkillChunkingProperties. + */ + @Generated + public static ContentUnderstandingSkillChunkingProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ContentUnderstandingSkillChunkingProperties deserializedContentUnderstandingSkillChunkingProperties + = new ContentUnderstandingSkillChunkingProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("unit".equals(fieldName)) { + deserializedContentUnderstandingSkillChunkingProperties.unit + = ContentUnderstandingSkillChunkingUnit.fromString(reader.getString()); + } else if ("maximumLength".equals(fieldName)) { + deserializedContentUnderstandingSkillChunkingProperties.maximumLength + = reader.getNullable(JsonReader::getInt); + } else if ("overlapLength".equals(fieldName)) { + deserializedContentUnderstandingSkillChunkingProperties.overlapLength + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedContentUnderstandingSkillChunkingProperties; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ContentUnderstandingSkillChunkingUnit.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ContentUnderstandingSkillChunkingUnit.java new file mode 100644 index 000000000000..7a0731861208 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ContentUnderstandingSkillChunkingUnit.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Controls the cardinality of the chunk unit. Default is 'characters'. + */ +public final class ContentUnderstandingSkillChunkingUnit + extends ExpandableStringEnum { + /** + * Specifies chunk by characters. + */ + @Generated + public static final ContentUnderstandingSkillChunkingUnit CHARACTERS = fromString("characters"); + + /** + * Creates a new instance of ContentUnderstandingSkillChunkingUnit value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ContentUnderstandingSkillChunkingUnit() { + } + + /** + * Creates or finds a ContentUnderstandingSkillChunkingUnit from its string representation. + * + * @param name a name to look for. + * @return the corresponding ContentUnderstandingSkillChunkingUnit. + */ + @Generated + public static ContentUnderstandingSkillChunkingUnit fromString(String name) { + return fromString(name, ContentUnderstandingSkillChunkingUnit.class); + } + + /** + * Gets known ContentUnderstandingSkillChunkingUnit values. + * + * @return known ContentUnderstandingSkillChunkingUnit values. + */ + @Generated + public static Collection values() { + return values(ContentUnderstandingSkillChunkingUnit.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ContentUnderstandingSkillExtractionOptions.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ContentUnderstandingSkillExtractionOptions.java new file mode 100644 index 000000000000..0f616d3eec73 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ContentUnderstandingSkillExtractionOptions.java @@ -0,0 +1,59 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Controls the cardinality of the content extracted from the document by the skill. + */ +public final class ContentUnderstandingSkillExtractionOptions + extends ExpandableStringEnum { + /** + * Specify that image content should be extracted from the document. + */ + @Generated + public static final ContentUnderstandingSkillExtractionOptions IMAGES = fromString("images"); + + /** + * Specify that location metadata should be extracted from the document. + */ + @Generated + public static final ContentUnderstandingSkillExtractionOptions LOCATION_METADATA = fromString("locationMetadata"); + + /** + * Creates a new instance of ContentUnderstandingSkillExtractionOptions value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ContentUnderstandingSkillExtractionOptions() { + } + + /** + * Creates or finds a ContentUnderstandingSkillExtractionOptions from its string representation. + * + * @param name a name to look for. + * @return the corresponding ContentUnderstandingSkillExtractionOptions. + */ + @Generated + public static ContentUnderstandingSkillExtractionOptions fromString(String name) { + return fromString(name, ContentUnderstandingSkillExtractionOptions.class); + } + + /** + * Gets known ContentUnderstandingSkillExtractionOptions values. + * + * @return known ContentUnderstandingSkillExtractionOptions values. + */ + @Generated + public static Collection values() { + return values(ContentUnderstandingSkillExtractionOptions.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CorsOptions.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CorsOptions.java new file mode 100644 index 000000000000..1d8735d97d8c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CorsOptions.java @@ -0,0 +1,136 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Defines options to control Cross-Origin Resource Sharing (CORS) for an index. + */ +@Fluent +public final class CorsOptions implements JsonSerializable { + /* + * The list of origins from which JavaScript code will be granted access to your index. Can contain a list of hosts + * of the form {protocol}://{fully-qualified-domain-name}[:{port#}], or a single '*' to allow all origins (not + * recommended). + */ + @Generated + private List allowedOrigins; + + /* + * The duration for which browsers should cache CORS preflight responses. Defaults to 5 minutes. + */ + @Generated + private Long maxAgeInSeconds; + + /** + * Creates an instance of CorsOptions class. + */ + @Generated + public CorsOptions() { + } + + /** + * Get the allowedOrigins property: The list of origins from which JavaScript code will be granted access to your + * index. Can contain a list of hosts of the form {protocol}://{fully-qualified-domain-name}[:{port#}], or a single + * '*' to allow all origins (not recommended). + * + * @return the allowedOrigins value. + */ + @Generated + public List getAllowedOrigins() { + return this.allowedOrigins; + } + + /** + * Set the allowedOrigins property: The list of origins from which JavaScript code will be granted access to your + * index. Can contain a list of hosts of the form {protocol}://{fully-qualified-domain-name}[:{port#}], or a single + * '*' to allow all origins (not recommended). + * + * @param allowedOrigins the allowedOrigins value to set. + * @return the CorsOptions object itself. + */ + @Generated + public CorsOptions setAllowedOrigins(List allowedOrigins) { + this.allowedOrigins = allowedOrigins; + return this; + } + + /** + * Get the maxAgeInSeconds property: The duration for which browsers should cache CORS preflight responses. Defaults + * to 5 minutes. + * + * @return the maxAgeInSeconds value. + */ + @Generated + public Long getMaxAgeInSeconds() { + return this.maxAgeInSeconds; + } + + /** + * Set the maxAgeInSeconds property: The duration for which browsers should cache CORS preflight responses. Defaults + * to 5 minutes. + * + * @param maxAgeInSeconds the maxAgeInSeconds value to set. + * @return the CorsOptions object itself. + */ + @Generated + public CorsOptions setMaxAgeInSeconds(Long maxAgeInSeconds) { + this.maxAgeInSeconds = maxAgeInSeconds; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("allowedOrigins", this.allowedOrigins, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeNumberField("maxAgeInSeconds", this.maxAgeInSeconds); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CorsOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CorsOptions 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 CorsOptions. + */ + @Generated + public static CorsOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CorsOptions deserializedCorsOptions = new CorsOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("allowedOrigins".equals(fieldName)) { + List allowedOrigins = reader.readArray(reader1 -> reader1.getString()); + deserializedCorsOptions.allowedOrigins = allowedOrigins; + } else if ("maxAgeInSeconds".equals(fieldName)) { + deserializedCorsOptions.maxAgeInSeconds = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedCorsOptions; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomAnalyzer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomAnalyzer.java new file mode 100644 index 000000000000..908403e6fdb6 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomAnalyzer.java @@ -0,0 +1,207 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 take control over the process of converting text into indexable/searchable tokens. It's a user-defined + * configuration consisting of a single predefined tokenizer and one or more filters. The tokenizer is responsible for + * breaking text into tokens, and the filters for modifying tokens emitted by the tokenizer. + */ +@Fluent +public final class CustomAnalyzer extends LexicalAnalyzer { + /* + * A URI fragment specifying the type of analyzer. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.CustomAnalyzer"; + + /* + * The name of the tokenizer to use to divide continuous text into a sequence of tokens, such as breaking a sentence + * into words. + */ + @Generated + private String tokenizer; + + /* + * A list of token filters used to filter out or modify the tokens generated by a tokenizer. 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. + */ + @Generated + private List tokenFilters; + + /* + * A list of character filters used to prepare input text before it is processed by the tokenizer. For instance, + * they can replace certain characters or symbols. The filters are run in the order in which they are listed. + */ + @Generated + private List charFilters; + + /** + * Creates an instance of CustomAnalyzer class. + */ + @Generated + public CustomAnalyzer() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of analyzer. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the tokenizer property: The name of the tokenizer to use to divide continuous text into a sequence of tokens, + * such as breaking a sentence into words. + * + * @return the tokenizer value. + */ + @Generated + public String getTokenizer() { + return this.tokenizer; + } + + /** + * Set the tokenizer property: The name of the tokenizer to use to divide continuous text into a sequence of tokens, + * such as breaking a sentence into words. + * + * @param tokenizer the tokenizer value to set. + * @return the CustomAnalyzer object itself. + */ + @Generated + public CustomAnalyzer setTokenizer(String tokenizer) { + this.tokenizer = tokenizer; + return this; + } + + /** + * Get the tokenFilters property: A list of token filters used to filter out or modify the tokens generated by a + * tokenizer. 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. + */ + @Generated + public List getTokenFilters() { + return this.tokenFilters; + } + + /** + * Set the tokenFilters property: A list of token filters used to filter out or modify the tokens generated by a + * tokenizer. 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 CustomAnalyzer object itself. + */ + @Generated + public CustomAnalyzer 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 by + * the tokenizer. 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. + */ + @Generated + public List getCharFilters() { + return this.charFilters; + } + + /** + * Set the charFilters property: A list of character filters used to prepare input text before it is processed by + * the tokenizer. 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 CustomAnalyzer object itself. + */ + @Generated + public CustomAnalyzer setCharFilters(List charFilters) { + this.charFilters = charFilters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public CustomAnalyzer setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("tokenizer", this.tokenizer); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeArrayField("tokenFilters", this.tokenFilters, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("charFilters", this.charFilters, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomAnalyzer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomAnalyzer 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 CustomAnalyzer. + */ + @Generated + public static CustomAnalyzer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomAnalyzer deserializedCustomAnalyzer = new CustomAnalyzer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCustomAnalyzer.setName(reader.getString()); + } else if ("tokenizer".equals(fieldName)) { + deserializedCustomAnalyzer.tokenizer = reader.getString(); + } else if ("@odata.type".equals(fieldName)) { + deserializedCustomAnalyzer.odataType = reader.getString(); + } else if ("tokenFilters".equals(fieldName)) { + List tokenFilters = reader.readArray(reader1 -> reader1.getString()); + deserializedCustomAnalyzer.tokenFilters = tokenFilters; + } else if ("charFilters".equals(fieldName)) { + List charFilters = reader.readArray(reader1 -> reader1.getString()); + deserializedCustomAnalyzer.charFilters = charFilters; + } else { + reader.skipChildren(); + } + } + + return deserializedCustomAnalyzer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomEntity.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomEntity.java new file mode 100644 index 000000000000..112c23fc0ae5 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomEntity.java @@ -0,0 +1,483 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * An object that contains information about the matches that were found, and related metadata. + */ +@Fluent +public final class CustomEntity implements JsonSerializable { + /* + * The top-level entity descriptor. Matches in the skill output will be grouped by this name, and it should + * represent the "normalized" form of the text being found. + */ + @Generated + private String name; + + /* + * This field can be used as a passthrough for custom metadata about the matched text(s). The value of this field + * will appear with every match of its entity in the skill output. + */ + @Generated + private String description; + + /* + * This field can be used as a passthrough for custom metadata about the matched text(s). The value of this field + * will appear with every match of its entity in the skill output. + */ + @Generated + private String type; + + /* + * This field can be used as a passthrough for custom metadata about the matched text(s). The value of this field + * will appear with every match of its entity in the skill output. + */ + @Generated + private String subtype; + + /* + * This field can be used as a passthrough for custom metadata about the matched text(s). The value of this field + * will appear with every match of its entity in the skill output. + */ + @Generated + private String id; + + /* + * Defaults to false. Boolean value denoting whether comparisons with the entity name should be sensitive to + * character casing. Sample case insensitive matches of "Microsoft" could be: microsoft, microSoft, MICROSOFT. + */ + @Generated + private Boolean caseSensitive; + + /* + * Defaults to false. Boolean value denoting whether comparisons with the entity name should be sensitive to accent. + */ + @Generated + private Boolean accentSensitive; + + /* + * Defaults to 0. Maximum value of 5. Denotes the acceptable number of divergent characters that would still + * constitute a match with the entity name. The smallest possible fuzziness for any given match is returned. For + * instance, if the edit distance is set to 3, "Windows10" would still match "Windows", "Windows10" and "Windows 7". + * When case sensitivity is set to false, case differences do NOT count towards fuzziness tolerance, but otherwise + * do. + */ + @Generated + private Integer fuzzyEditDistance; + + /* + * Changes the default case sensitivity value for this entity. It be used to change the default value of all aliases + * caseSensitive values. + */ + @Generated + private Boolean defaultCaseSensitive; + + /* + * Changes the default accent sensitivity value for this entity. It be used to change the default value of all + * aliases accentSensitive values. + */ + @Generated + private Boolean defaultAccentSensitive; + + /* + * Changes the default fuzzy edit distance value for this entity. It can be used to change the default value of all + * aliases fuzzyEditDistance values. + */ + @Generated + private Integer defaultFuzzyEditDistance; + + /* + * An array of complex objects that can be used to specify alternative spellings or synonyms to the root entity + * name. + */ + @Generated + private List aliases; + + /** + * Creates an instance of CustomEntity class. + */ + @Generated + public CustomEntity() { + } + + /** + * Get the name property: The top-level entity descriptor. Matches in the skill output will be grouped by this name, + * and it should represent the "normalized" form of the text being found. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The top-level entity descriptor. Matches in the skill output will be grouped by this name, + * and it should represent the "normalized" form of the text being found. + * + * @param name the name value to set. + * @return the CustomEntity object itself. + */ + @Generated + public CustomEntity setName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: This field can be used as a passthrough for custom metadata about the matched + * text(s). The value of this field will appear with every match of its entity in the skill output. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: This field can be used as a passthrough for custom metadata about the matched + * text(s). The value of this field will appear with every match of its entity in the skill output. + * + * @param description the description value to set. + * @return the CustomEntity object itself. + */ + @Generated + public CustomEntity setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the type property: This field can be used as a passthrough for custom metadata about the matched text(s). The + * value of this field will appear with every match of its entity in the skill output. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * Set the type property: This field can be used as a passthrough for custom metadata about the matched text(s). The + * value of this field will appear with every match of its entity in the skill output. + * + * @param type the type value to set. + * @return the CustomEntity object itself. + */ + @Generated + public CustomEntity setType(String type) { + this.type = type; + return this; + } + + /** + * Get the subtype property: This field can be used as a passthrough for custom metadata about the matched text(s). + * The value of this field will appear with every match of its entity in the skill output. + * + * @return the subtype value. + */ + @Generated + public String getSubtype() { + return this.subtype; + } + + /** + * Set the subtype property: This field can be used as a passthrough for custom metadata about the matched text(s). + * The value of this field will appear with every match of its entity in the skill output. + * + * @param subtype the subtype value to set. + * @return the CustomEntity object itself. + */ + @Generated + public CustomEntity setSubtype(String subtype) { + this.subtype = subtype; + return this; + } + + /** + * Get the id property: This field can be used as a passthrough for custom metadata about the matched text(s). The + * value of this field will appear with every match of its entity in the skill output. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Set the id property: This field can be used as a passthrough for custom metadata about the matched text(s). The + * value of this field will appear with every match of its entity in the skill output. + * + * @param id the id value to set. + * @return the CustomEntity object itself. + */ + @Generated + public CustomEntity setId(String id) { + this.id = id; + return this; + } + + /** + * Get the caseSensitive property: Defaults to false. Boolean value denoting whether comparisons with the entity + * name should be sensitive to character casing. Sample case insensitive matches of "Microsoft" could be: microsoft, + * microSoft, MICROSOFT. + * + * @return the caseSensitive value. + */ + @Generated + public Boolean isCaseSensitive() { + return this.caseSensitive; + } + + /** + * Set the caseSensitive property: Defaults to false. Boolean value denoting whether comparisons with the entity + * name should be sensitive to character casing. Sample case insensitive matches of "Microsoft" could be: microsoft, + * microSoft, MICROSOFT. + * + * @param caseSensitive the caseSensitive value to set. + * @return the CustomEntity object itself. + */ + @Generated + public CustomEntity setCaseSensitive(Boolean caseSensitive) { + this.caseSensitive = caseSensitive; + return this; + } + + /** + * Get the accentSensitive property: Defaults to false. Boolean value denoting whether comparisons with the entity + * name should be sensitive to accent. + * + * @return the accentSensitive value. + */ + @Generated + public Boolean isAccentSensitive() { + return this.accentSensitive; + } + + /** + * Set the accentSensitive property: Defaults to false. Boolean value denoting whether comparisons with the entity + * name should be sensitive to accent. + * + * @param accentSensitive the accentSensitive value to set. + * @return the CustomEntity object itself. + */ + @Generated + public CustomEntity setAccentSensitive(Boolean accentSensitive) { + this.accentSensitive = accentSensitive; + return this; + } + + /** + * Get the fuzzyEditDistance property: Defaults to 0. Maximum value of 5. Denotes the acceptable number of divergent + * characters that would still constitute a match with the entity name. The smallest possible fuzziness for any + * given match is returned. For instance, if the edit distance is set to 3, "Windows10" would still match "Windows", + * "Windows10" and "Windows 7". When case sensitivity is set to false, case differences do NOT count towards + * fuzziness tolerance, but otherwise do. + * + * @return the fuzzyEditDistance value. + */ + @Generated + public Integer getFuzzyEditDistance() { + return this.fuzzyEditDistance; + } + + /** + * Set the fuzzyEditDistance property: Defaults to 0. Maximum value of 5. Denotes the acceptable number of divergent + * characters that would still constitute a match with the entity name. The smallest possible fuzziness for any + * given match is returned. For instance, if the edit distance is set to 3, "Windows10" would still match "Windows", + * "Windows10" and "Windows 7". When case sensitivity is set to false, case differences do NOT count towards + * fuzziness tolerance, but otherwise do. + * + * @param fuzzyEditDistance the fuzzyEditDistance value to set. + * @return the CustomEntity object itself. + */ + @Generated + public CustomEntity setFuzzyEditDistance(Integer fuzzyEditDistance) { + this.fuzzyEditDistance = fuzzyEditDistance; + return this; + } + + /** + * Get the defaultCaseSensitive property: Changes the default case sensitivity value for this entity. It be used to + * change the default value of all aliases caseSensitive values. + * + * @return the defaultCaseSensitive value. + */ + @Generated + public Boolean isDefaultCaseSensitive() { + return this.defaultCaseSensitive; + } + + /** + * Set the defaultCaseSensitive property: Changes the default case sensitivity value for this entity. It be used to + * change the default value of all aliases caseSensitive values. + * + * @param defaultCaseSensitive the defaultCaseSensitive value to set. + * @return the CustomEntity object itself. + */ + @Generated + public CustomEntity setDefaultCaseSensitive(Boolean defaultCaseSensitive) { + this.defaultCaseSensitive = defaultCaseSensitive; + return this; + } + + /** + * Get the defaultAccentSensitive property: Changes the default accent sensitivity value for this entity. It be used + * to change the default value of all aliases accentSensitive values. + * + * @return the defaultAccentSensitive value. + */ + @Generated + public Boolean isDefaultAccentSensitive() { + return this.defaultAccentSensitive; + } + + /** + * Set the defaultAccentSensitive property: Changes the default accent sensitivity value for this entity. It be used + * to change the default value of all aliases accentSensitive values. + * + * @param defaultAccentSensitive the defaultAccentSensitive value to set. + * @return the CustomEntity object itself. + */ + @Generated + public CustomEntity setDefaultAccentSensitive(Boolean defaultAccentSensitive) { + this.defaultAccentSensitive = defaultAccentSensitive; + return this; + } + + /** + * Get the defaultFuzzyEditDistance property: Changes the default fuzzy edit distance value for this entity. It can + * be used to change the default value of all aliases fuzzyEditDistance values. + * + * @return the defaultFuzzyEditDistance value. + */ + @Generated + public Integer getDefaultFuzzyEditDistance() { + return this.defaultFuzzyEditDistance; + } + + /** + * Set the defaultFuzzyEditDistance property: Changes the default fuzzy edit distance value for this entity. It can + * be used to change the default value of all aliases fuzzyEditDistance values. + * + * @param defaultFuzzyEditDistance the defaultFuzzyEditDistance value to set. + * @return the CustomEntity object itself. + */ + @Generated + public CustomEntity setDefaultFuzzyEditDistance(Integer defaultFuzzyEditDistance) { + this.defaultFuzzyEditDistance = defaultFuzzyEditDistance; + return this; + } + + /** + * Get the aliases property: An array of complex objects that can be used to specify alternative spellings or + * synonyms to the root entity name. + * + * @return the aliases value. + */ + @Generated + public List getAliases() { + return this.aliases; + } + + /** + * Set the aliases property: An array of complex objects that can be used to specify alternative spellings or + * synonyms to the root entity name. + * + * @param aliases the aliases value to set. + * @return the CustomEntity object itself. + */ + @Generated + public CustomEntity setAliases(List aliases) { + this.aliases = aliases; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("subtype", this.subtype); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeBooleanField("caseSensitive", this.caseSensitive); + jsonWriter.writeBooleanField("accentSensitive", this.accentSensitive); + jsonWriter.writeNumberField("fuzzyEditDistance", this.fuzzyEditDistance); + jsonWriter.writeBooleanField("defaultCaseSensitive", this.defaultCaseSensitive); + jsonWriter.writeBooleanField("defaultAccentSensitive", this.defaultAccentSensitive); + jsonWriter.writeNumberField("defaultFuzzyEditDistance", this.defaultFuzzyEditDistance); + jsonWriter.writeArrayField("aliases", this.aliases, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomEntity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomEntity 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 CustomEntity. + */ + @Generated + public static CustomEntity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomEntity deserializedCustomEntity = new CustomEntity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCustomEntity.name = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedCustomEntity.description = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCustomEntity.type = reader.getString(); + } else if ("subtype".equals(fieldName)) { + deserializedCustomEntity.subtype = reader.getString(); + } else if ("id".equals(fieldName)) { + deserializedCustomEntity.id = reader.getString(); + } else if ("caseSensitive".equals(fieldName)) { + deserializedCustomEntity.caseSensitive = reader.getNullable(JsonReader::getBoolean); + } else if ("accentSensitive".equals(fieldName)) { + deserializedCustomEntity.accentSensitive = reader.getNullable(JsonReader::getBoolean); + } else if ("fuzzyEditDistance".equals(fieldName)) { + deserializedCustomEntity.fuzzyEditDistance = reader.getNullable(JsonReader::getInt); + } else if ("defaultCaseSensitive".equals(fieldName)) { + deserializedCustomEntity.defaultCaseSensitive = reader.getNullable(JsonReader::getBoolean); + } else if ("defaultAccentSensitive".equals(fieldName)) { + deserializedCustomEntity.defaultAccentSensitive = reader.getNullable(JsonReader::getBoolean); + } else if ("defaultFuzzyEditDistance".equals(fieldName)) { + deserializedCustomEntity.defaultFuzzyEditDistance = reader.getNullable(JsonReader::getInt); + } else if ("aliases".equals(fieldName)) { + List aliases = reader.readArray(reader1 -> CustomEntityAlias.fromJson(reader1)); + deserializedCustomEntity.aliases = aliases; + } else { + reader.skipChildren(); + } + } + + return deserializedCustomEntity; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomEntityAlias.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomEntityAlias.java new file mode 100644 index 000000000000..e782e34156b3 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomEntityAlias.java @@ -0,0 +1,187 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 complex object that can be used to specify alternative spellings or synonyms to the root entity name. + */ +@Fluent +public final class CustomEntityAlias implements JsonSerializable { + /* + * The text of the alias. + */ + @Generated + private String text; + + /* + * Determine if the alias is case sensitive. + */ + @Generated + private Boolean caseSensitive; + + /* + * Determine if the alias is accent sensitive. + */ + @Generated + private Boolean accentSensitive; + + /* + * Determine the fuzzy edit distance of the alias. + */ + @Generated + private Integer fuzzyEditDistance; + + /** + * Creates an instance of CustomEntityAlias class. + */ + @Generated + public CustomEntityAlias() { + } + + /** + * Get the text property: The text of the alias. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Set the text property: The text of the alias. + * + * @param text the text value to set. + * @return the CustomEntityAlias object itself. + */ + @Generated + public CustomEntityAlias setText(String text) { + this.text = text; + return this; + } + + /** + * Get the caseSensitive property: Determine if the alias is case sensitive. + * + * @return the caseSensitive value. + */ + @Generated + public Boolean isCaseSensitive() { + return this.caseSensitive; + } + + /** + * Set the caseSensitive property: Determine if the alias is case sensitive. + * + * @param caseSensitive the caseSensitive value to set. + * @return the CustomEntityAlias object itself. + */ + @Generated + public CustomEntityAlias setCaseSensitive(Boolean caseSensitive) { + this.caseSensitive = caseSensitive; + return this; + } + + /** + * Get the accentSensitive property: Determine if the alias is accent sensitive. + * + * @return the accentSensitive value. + */ + @Generated + public Boolean isAccentSensitive() { + return this.accentSensitive; + } + + /** + * Set the accentSensitive property: Determine if the alias is accent sensitive. + * + * @param accentSensitive the accentSensitive value to set. + * @return the CustomEntityAlias object itself. + */ + @Generated + public CustomEntityAlias setAccentSensitive(Boolean accentSensitive) { + this.accentSensitive = accentSensitive; + return this; + } + + /** + * Get the fuzzyEditDistance property: Determine the fuzzy edit distance of the alias. + * + * @return the fuzzyEditDistance value. + */ + @Generated + public Integer getFuzzyEditDistance() { + return this.fuzzyEditDistance; + } + + /** + * Set the fuzzyEditDistance property: Determine the fuzzy edit distance of the alias. + * + * @param fuzzyEditDistance the fuzzyEditDistance value to set. + * @return the CustomEntityAlias object itself. + */ + @Generated + public CustomEntityAlias setFuzzyEditDistance(Integer fuzzyEditDistance) { + this.fuzzyEditDistance = fuzzyEditDistance; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("text", this.text); + jsonWriter.writeBooleanField("caseSensitive", this.caseSensitive); + jsonWriter.writeBooleanField("accentSensitive", this.accentSensitive); + jsonWriter.writeNumberField("fuzzyEditDistance", this.fuzzyEditDistance); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomEntityAlias from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomEntityAlias 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 CustomEntityAlias. + */ + @Generated + public static CustomEntityAlias fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomEntityAlias deserializedCustomEntityAlias = new CustomEntityAlias(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("text".equals(fieldName)) { + deserializedCustomEntityAlias.text = reader.getString(); + } else if ("caseSensitive".equals(fieldName)) { + deserializedCustomEntityAlias.caseSensitive = reader.getNullable(JsonReader::getBoolean); + } else if ("accentSensitive".equals(fieldName)) { + deserializedCustomEntityAlias.accentSensitive = reader.getNullable(JsonReader::getBoolean); + } else if ("fuzzyEditDistance".equals(fieldName)) { + deserializedCustomEntityAlias.fuzzyEditDistance = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomEntityAlias; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomEntityLookupSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomEntityLookupSkill.java new file mode 100644 index 000000000000..b339fe946dd1 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomEntityLookupSkill.java @@ -0,0 +1,361 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A skill looks for text from a custom, user-defined list of words and phrases. + */ +@Fluent +public final class CustomEntityLookupSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Text.CustomEntityLookupSkill"; + + /* + * A value indicating which language code to use. Default is `en`. + */ + @Generated + private CustomEntityLookupSkillLanguage defaultLanguageCode; + + /* + * Path to a JSON or CSV file containing all the target text to match against. This entity definition is read at the + * beginning of an indexer run. Any updates to this file during an indexer run will not take effect until subsequent + * runs. This config must be accessible over HTTPS. + */ + @Generated + private String entitiesDefinitionUri; + + /* + * The inline CustomEntity definition. + */ + @Generated + private List inlineEntitiesDefinition; + + /* + * A global flag for CaseSensitive. If CaseSensitive is not set in CustomEntity, this value will be the default + * value. + */ + @Generated + private Boolean globalDefaultCaseSensitive; + + /* + * A global flag for AccentSensitive. If AccentSensitive is not set in CustomEntity, this value will be the default + * value. + */ + @Generated + private Boolean globalDefaultAccentSensitive; + + /* + * A global flag for FuzzyEditDistance. If FuzzyEditDistance is not set in CustomEntity, this value will be the + * default value. + */ + @Generated + private Integer globalDefaultFuzzyEditDistance; + + /** + * Creates an instance of CustomEntityLookupSkill class. + */ + @Generated + public CustomEntityLookupSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @return the defaultLanguageCode value. + */ + @Generated + public CustomEntityLookupSkillLanguage getDefaultLanguageCode() { + return this.defaultLanguageCode; + } + + /** + * Set the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @param defaultLanguageCode the defaultLanguageCode value to set. + * @return the CustomEntityLookupSkill object itself. + */ + @Generated + public CustomEntityLookupSkill setDefaultLanguageCode(CustomEntityLookupSkillLanguage defaultLanguageCode) { + this.defaultLanguageCode = defaultLanguageCode; + return this; + } + + /** + * Get the entitiesDefinitionUri property: Path to a JSON or CSV file containing all the target text to match + * against. This entity definition is read at the beginning of an indexer run. Any updates to this file during an + * indexer run will not take effect until subsequent runs. This config must be accessible over HTTPS. + * + * @return the entitiesDefinitionUri value. + */ + @Generated + public String getEntitiesDefinitionUri() { + return this.entitiesDefinitionUri; + } + + /** + * Set the entitiesDefinitionUri property: Path to a JSON or CSV file containing all the target text to match + * against. This entity definition is read at the beginning of an indexer run. Any updates to this file during an + * indexer run will not take effect until subsequent runs. This config must be accessible over HTTPS. + * + * @param entitiesDefinitionUri the entitiesDefinitionUri value to set. + * @return the CustomEntityLookupSkill object itself. + */ + @Generated + public CustomEntityLookupSkill setEntitiesDefinitionUri(String entitiesDefinitionUri) { + this.entitiesDefinitionUri = entitiesDefinitionUri; + return this; + } + + /** + * Get the inlineEntitiesDefinition property: The inline CustomEntity definition. + * + * @return the inlineEntitiesDefinition value. + */ + @Generated + public List getInlineEntitiesDefinition() { + return this.inlineEntitiesDefinition; + } + + /** + * Set the inlineEntitiesDefinition property: The inline CustomEntity definition. + * + * @param inlineEntitiesDefinition the inlineEntitiesDefinition value to set. + * @return the CustomEntityLookupSkill object itself. + */ + @Generated + public CustomEntityLookupSkill setInlineEntitiesDefinition(List inlineEntitiesDefinition) { + this.inlineEntitiesDefinition = inlineEntitiesDefinition; + return this; + } + + /** + * Get the globalDefaultCaseSensitive property: A global flag for CaseSensitive. If CaseSensitive is not set in + * CustomEntity, this value will be the default value. + * + * @return the globalDefaultCaseSensitive value. + */ + @Generated + public Boolean isGlobalDefaultCaseSensitive() { + return this.globalDefaultCaseSensitive; + } + + /** + * Set the globalDefaultCaseSensitive property: A global flag for CaseSensitive. If CaseSensitive is not set in + * CustomEntity, this value will be the default value. + * + * @param globalDefaultCaseSensitive the globalDefaultCaseSensitive value to set. + * @return the CustomEntityLookupSkill object itself. + */ + @Generated + public CustomEntityLookupSkill setGlobalDefaultCaseSensitive(Boolean globalDefaultCaseSensitive) { + this.globalDefaultCaseSensitive = globalDefaultCaseSensitive; + return this; + } + + /** + * Get the globalDefaultAccentSensitive property: A global flag for AccentSensitive. If AccentSensitive is not set + * in CustomEntity, this value will be the default value. + * + * @return the globalDefaultAccentSensitive value. + */ + @Generated + public Boolean isGlobalDefaultAccentSensitive() { + return this.globalDefaultAccentSensitive; + } + + /** + * Set the globalDefaultAccentSensitive property: A global flag for AccentSensitive. If AccentSensitive is not set + * in CustomEntity, this value will be the default value. + * + * @param globalDefaultAccentSensitive the globalDefaultAccentSensitive value to set. + * @return the CustomEntityLookupSkill object itself. + */ + @Generated + public CustomEntityLookupSkill setGlobalDefaultAccentSensitive(Boolean globalDefaultAccentSensitive) { + this.globalDefaultAccentSensitive = globalDefaultAccentSensitive; + return this; + } + + /** + * Get the globalDefaultFuzzyEditDistance property: A global flag for FuzzyEditDistance. If FuzzyEditDistance is not + * set in CustomEntity, this value will be the default value. + * + * @return the globalDefaultFuzzyEditDistance value. + */ + @Generated + public Integer getGlobalDefaultFuzzyEditDistance() { + return this.globalDefaultFuzzyEditDistance; + } + + /** + * Set the globalDefaultFuzzyEditDistance property: A global flag for FuzzyEditDistance. If FuzzyEditDistance is not + * set in CustomEntity, this value will be the default value. + * + * @param globalDefaultFuzzyEditDistance the globalDefaultFuzzyEditDistance value to set. + * @return the CustomEntityLookupSkill object itself. + */ + @Generated + public CustomEntityLookupSkill setGlobalDefaultFuzzyEditDistance(Integer globalDefaultFuzzyEditDistance) { + this.globalDefaultFuzzyEditDistance = globalDefaultFuzzyEditDistance; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public CustomEntityLookupSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public CustomEntityLookupSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public CustomEntityLookupSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public CustomEntityLookupSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public CustomEntityLookupSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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("defaultLanguageCode", + this.defaultLanguageCode == null ? null : this.defaultLanguageCode.toString()); + jsonWriter.writeStringField("entitiesDefinitionUri", this.entitiesDefinitionUri); + jsonWriter.writeArrayField("inlineEntitiesDefinition", this.inlineEntitiesDefinition, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeBooleanField("globalDefaultCaseSensitive", this.globalDefaultCaseSensitive); + jsonWriter.writeBooleanField("globalDefaultAccentSensitive", this.globalDefaultAccentSensitive); + jsonWriter.writeNumberField("globalDefaultFuzzyEditDistance", this.globalDefaultFuzzyEditDistance); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomEntityLookupSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomEntityLookupSkill 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 CustomEntityLookupSkill. + */ + @Generated + public static CustomEntityLookupSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomEntityLookupSkill deserializedCustomEntityLookupSkill = new CustomEntityLookupSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedCustomEntityLookupSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedCustomEntityLookupSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedCustomEntityLookupSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedCustomEntityLookupSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedCustomEntityLookupSkill.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedCustomEntityLookupSkill.odataType = reader.getString(); + } else if ("defaultLanguageCode".equals(fieldName)) { + deserializedCustomEntityLookupSkill.defaultLanguageCode + = CustomEntityLookupSkillLanguage.fromString(reader.getString()); + } else if ("entitiesDefinitionUri".equals(fieldName)) { + deserializedCustomEntityLookupSkill.entitiesDefinitionUri = reader.getString(); + } else if ("inlineEntitiesDefinition".equals(fieldName)) { + List inlineEntitiesDefinition + = reader.readArray(reader1 -> CustomEntity.fromJson(reader1)); + deserializedCustomEntityLookupSkill.inlineEntitiesDefinition = inlineEntitiesDefinition; + } else if ("globalDefaultCaseSensitive".equals(fieldName)) { + deserializedCustomEntityLookupSkill.globalDefaultCaseSensitive + = reader.getNullable(JsonReader::getBoolean); + } else if ("globalDefaultAccentSensitive".equals(fieldName)) { + deserializedCustomEntityLookupSkill.globalDefaultAccentSensitive + = reader.getNullable(JsonReader::getBoolean); + } else if ("globalDefaultFuzzyEditDistance".equals(fieldName)) { + deserializedCustomEntityLookupSkill.globalDefaultFuzzyEditDistance + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomEntityLookupSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomEntityLookupSkillLanguage.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomEntityLookupSkillLanguage.java new file mode 100644 index 000000000000..14b8ea52384c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomEntityLookupSkillLanguage.java @@ -0,0 +1,100 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The language codes supported for input text by CustomEntityLookupSkill. + */ +public final class CustomEntityLookupSkillLanguage extends ExpandableStringEnum { + /** + * Danish. + */ + @Generated + public static final CustomEntityLookupSkillLanguage DA = fromString("da"); + + /** + * German. + */ + @Generated + public static final CustomEntityLookupSkillLanguage DE = fromString("de"); + + /** + * English. + */ + @Generated + public static final CustomEntityLookupSkillLanguage EN = fromString("en"); + + /** + * Spanish. + */ + @Generated + public static final CustomEntityLookupSkillLanguage ES = fromString("es"); + + /** + * Finnish. + */ + @Generated + public static final CustomEntityLookupSkillLanguage FI = fromString("fi"); + + /** + * French. + */ + @Generated + public static final CustomEntityLookupSkillLanguage FR = fromString("fr"); + + /** + * Italian. + */ + @Generated + public static final CustomEntityLookupSkillLanguage IT = fromString("it"); + + /** + * Korean. + */ + @Generated + public static final CustomEntityLookupSkillLanguage KO = fromString("ko"); + + /** + * Portuguese. + */ + @Generated + public static final CustomEntityLookupSkillLanguage PT = fromString("pt"); + + /** + * Creates a new instance of CustomEntityLookupSkillLanguage value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public CustomEntityLookupSkillLanguage() { + } + + /** + * Creates or finds a CustomEntityLookupSkillLanguage from its string representation. + * + * @param name a name to look for. + * @return the corresponding CustomEntityLookupSkillLanguage. + */ + @Generated + public static CustomEntityLookupSkillLanguage fromString(String name) { + return fromString(name, CustomEntityLookupSkillLanguage.class); + } + + /** + * Gets known CustomEntityLookupSkillLanguage values. + * + * @return known CustomEntityLookupSkillLanguage values. + */ + @Generated + public static Collection values() { + return values(CustomEntityLookupSkillLanguage.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomNormalizer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomNormalizer.java new file mode 100644 index 000000000000..f6b7f9dc44bd --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/CustomNormalizer.java @@ -0,0 +1,176 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + private List charFilters; + + /** + * Creates an instance of CustomNormalizer class. + */ + @Generated + public CustomNormalizer() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of normalizer. + * + * @return the odataType value. + */ + @Generated + @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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + public CustomNormalizer setCharFilters(List charFilters) { + this.charFilters = charFilters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public CustomNormalizer setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + public static CustomNormalizer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomNormalizer deserializedCustomNormalizer = new CustomNormalizer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCustomNormalizer.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedCustomNormalizer.odataType = reader.getString(); + } else if ("tokenFilters".equals(fieldName)) { + List tokenFilters + = reader.readArray(reader1 -> TokenFilterName.fromString(reader1.getString())); + deserializedCustomNormalizer.tokenFilters = tokenFilters; + } else if ("charFilters".equals(fieldName)) { + List charFilters + = reader.readArray(reader1 -> CharFilterName.fromString(reader1.getString())); + deserializedCustomNormalizer.charFilters = charFilters; + } else { + reader.skipChildren(); + } + } + + return deserializedCustomNormalizer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DataChangeDetectionPolicy.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DataChangeDetectionPolicy.java new file mode 100644 index 000000000000..571f0fd45a39 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DataChangeDetectionPolicy.java @@ -0,0 +1,109 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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 data change detection policies. + */ +@Immutable +public class DataChangeDetectionPolicy implements JsonSerializable { + /* + * A URI fragment specifying the type of data change detection policy. + */ + @Generated + private String odataType = "DataChangeDetectionPolicy"; + + /** + * Creates an instance of DataChangeDetectionPolicy class. + */ + @Generated + public DataChangeDetectionPolicy() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of data change detection policy. + * + * @return the odataType value. + */ + @Generated + public String getOdataType() { + return this.odataType; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataChangeDetectionPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataChangeDetectionPolicy 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 DataChangeDetectionPolicy. + */ + @Generated + public static DataChangeDetectionPolicy 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.HighWaterMarkChangeDetectionPolicy".equals(discriminatorValue)) { + return HighWaterMarkChangeDetectionPolicy.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.SqlIntegratedChangeTrackingPolicy".equals(discriminatorValue)) { + return SqlIntegratedChangeTrackingPolicy.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static DataChangeDetectionPolicy fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataChangeDetectionPolicy deserializedDataChangeDetectionPolicy = new DataChangeDetectionPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("@odata.type".equals(fieldName)) { + deserializedDataChangeDetectionPolicy.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDataChangeDetectionPolicy; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DataDeletionDetectionPolicy.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DataDeletionDetectionPolicy.java new file mode 100644 index 000000000000..4e1004409f5d --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DataDeletionDetectionPolicy.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.models; + +import com.azure.core.annotation.Generated; +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 data deletion detection policies. + */ +@Immutable +public class DataDeletionDetectionPolicy implements JsonSerializable { + /* + * A URI fragment specifying the type of data deletion detection policy. + */ + @Generated + private String odataType = "DataDeletionDetectionPolicy"; + + /** + * Creates an instance of DataDeletionDetectionPolicy class. + */ + @Generated + public DataDeletionDetectionPolicy() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of data deletion detection policy. + * + * @return the odataType value. + */ + @Generated + public String getOdataType() { + return this.odataType; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataDeletionDetectionPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataDeletionDetectionPolicy 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 DataDeletionDetectionPolicy. + */ + @Generated + public static DataDeletionDetectionPolicy 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.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()); + } + } + }); + } + + @Generated + static DataDeletionDetectionPolicy fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataDeletionDetectionPolicy deserializedDataDeletionDetectionPolicy = new DataDeletionDetectionPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("@odata.type".equals(fieldName)) { + deserializedDataDeletionDetectionPolicy.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDataDeletionDetectionPolicy; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DataSourceCredentials.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DataSourceCredentials.java new file mode 100644 index 000000000000..041abe4654ee --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DataSourceCredentials.java @@ -0,0 +1,98 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents credentials that can be used to connect to a datasource. + */ +@Fluent +public final class DataSourceCredentials implements JsonSerializable { + /* + * The connection string for the datasource. Set to `` (with brackets) if you don't want the connection + * string updated. Set to `` if you want to remove the connection string value from the datasource. + */ + @Generated + private String connectionString; + + /** + * Creates an instance of DataSourceCredentials class. + */ + @Generated + public DataSourceCredentials() { + } + + /** + * Get the connectionString property: The connection string for the datasource. Set to `<unchanged>` (with + * brackets) if you don't want the connection string updated. Set to `<redacted>` if you want to remove the + * connection string value from the datasource. + * + * @return the connectionString value. + */ + @Generated + public String getConnectionString() { + return this.connectionString; + } + + /** + * Set the connectionString property: The connection string for the datasource. Set to `<unchanged>` (with + * brackets) if you don't want the connection string updated. Set to `<redacted>` if you want to remove the + * connection string value from the datasource. + * + * @param connectionString the connectionString value to set. + * @return the DataSourceCredentials object itself. + */ + @Generated + public DataSourceCredentials setConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("connectionString", this.connectionString); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataSourceCredentials from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataSourceCredentials 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 DataSourceCredentials. + */ + @Generated + public static DataSourceCredentials fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataSourceCredentials deserializedDataSourceCredentials = new DataSourceCredentials(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connectionString".equals(fieldName)) { + deserializedDataSourceCredentials.connectionString = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDataSourceCredentials; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DebugInfo.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DebugInfo.java new file mode 100644 index 000000000000..c1824a6dcc53 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DebugInfo.java @@ -0,0 +1,80 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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 DebugInfo implements JsonSerializable { + /* + * Contains debugging information specific to query rewrites. + */ + @Generated + private QueryRewritesDebugInfo queryRewrites; + + /** + * Creates an instance of DebugInfo class. + */ + @Generated + public DebugInfo() { + } + + /** + * Get the queryRewrites property: Contains debugging information specific to query rewrites. + * + * @return the queryRewrites value. + */ + @Generated + public QueryRewritesDebugInfo getQueryRewrites() { + return this.queryRewrites; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DebugInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DebugInfo 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 DebugInfo. + */ + @Generated + public static DebugInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DebugInfo deserializedDebugInfo = new DebugInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("queryRewrites".equals(fieldName)) { + deserializedDebugInfo.queryRewrites = QueryRewritesDebugInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDebugInfo; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DefaultCognitiveServicesAccount.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DefaultCognitiveServicesAccount.java new file mode 100644 index 000000000000..b0ee010e3397 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DefaultCognitiveServicesAccount.java @@ -0,0 +1,96 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An empty object that represents the default Azure AI service resource for a skillset. + */ +@Fluent +public final class DefaultCognitiveServicesAccount extends CognitiveServicesAccount { + /* + * A URI fragment specifying the type of Azure AI service resource attached to a skillset. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.DefaultCognitiveServices"; + + /** + * Creates an instance of DefaultCognitiveServicesAccount class. + */ + @Generated + public DefaultCognitiveServicesAccount() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of Azure AI service resource attached to a + * skillset. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public DefaultCognitiveServicesAccount setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", getDescription()); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefaultCognitiveServicesAccount from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefaultCognitiveServicesAccount 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 DefaultCognitiveServicesAccount. + */ + @Generated + public static DefaultCognitiveServicesAccount fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefaultCognitiveServicesAccount deserializedDefaultCognitiveServicesAccount + = new DefaultCognitiveServicesAccount(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDefaultCognitiveServicesAccount.setDescription(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedDefaultCognitiveServicesAccount.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefaultCognitiveServicesAccount; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DictionaryDecompounderTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DictionaryDecompounderTokenFilter.java new file mode 100644 index 000000000000..eecfdca0282c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DictionaryDecompounderTokenFilter.java @@ -0,0 +1,264 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Decomposes compound words found in many Germanic languages. This token filter is implemented using Apache Lucene. + */ +@Fluent +public final class DictionaryDecompounderTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.DictionaryDecompounderTokenFilter"; + + /* + * The list of words to match against. + */ + @Generated + private List wordList; + + /* + * The minimum word size. Only words longer than this get processed. Default is 5. Maximum is 300. + */ + @Generated + private Integer minWordSize; + + /* + * The minimum subword size. Only subwords longer than this are outputted. Default is 2. Maximum is 300. + */ + @Generated + private Integer minSubwordSize; + + /* + * The maximum subword size. Only subwords shorter than this are outputted. Default is 15. Maximum is 300. + */ + @Generated + private Integer maxSubwordSize; + + /* + * A value indicating whether to add only the longest matching subword to the output. Default is false. + */ + @Generated + private Boolean onlyLongestMatch; + + /** + * Creates an instance of DictionaryDecompounderTokenFilter class. + */ + @Generated + public DictionaryDecompounderTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the wordList property: The list of words to match against. + * + * @return the wordList value. + */ + @Generated + public List getWordList() { + return this.wordList; + } + + /** + * Set the wordList property: The list of words to match against. + * + * @param wordList the wordList value to set. + * @return the DictionaryDecompounderTokenFilter object itself. + */ + @Generated + public DictionaryDecompounderTokenFilter setWordList(List wordList) { + this.wordList = wordList; + return this; + } + + /** + * Get the minWordSize property: The minimum word size. Only words longer than this get processed. Default is 5. + * Maximum is 300. + * + * @return the minWordSize value. + */ + @Generated + public Integer getMinWordSize() { + return this.minWordSize; + } + + /** + * Set the minWordSize property: The minimum word size. Only words longer than this get processed. Default is 5. + * Maximum is 300. + * + * @param minWordSize the minWordSize value to set. + * @return the DictionaryDecompounderTokenFilter object itself. + */ + @Generated + public DictionaryDecompounderTokenFilter setMinWordSize(Integer minWordSize) { + this.minWordSize = minWordSize; + return this; + } + + /** + * Get the minSubwordSize property: The minimum subword size. Only subwords longer than this are outputted. Default + * is 2. Maximum is 300. + * + * @return the minSubwordSize value. + */ + @Generated + public Integer getMinSubwordSize() { + return this.minSubwordSize; + } + + /** + * Set the minSubwordSize property: The minimum subword size. Only subwords longer than this are outputted. Default + * is 2. Maximum is 300. + * + * @param minSubwordSize the minSubwordSize value to set. + * @return the DictionaryDecompounderTokenFilter object itself. + */ + @Generated + public DictionaryDecompounderTokenFilter setMinSubwordSize(Integer minSubwordSize) { + this.minSubwordSize = minSubwordSize; + return this; + } + + /** + * Get the maxSubwordSize property: The maximum subword size. Only subwords shorter than this are outputted. Default + * is 15. Maximum is 300. + * + * @return the maxSubwordSize value. + */ + @Generated + public Integer getMaxSubwordSize() { + return this.maxSubwordSize; + } + + /** + * Set the maxSubwordSize property: The maximum subword size. Only subwords shorter than this are outputted. Default + * is 15. Maximum is 300. + * + * @param maxSubwordSize the maxSubwordSize value to set. + * @return the DictionaryDecompounderTokenFilter object itself. + */ + @Generated + public DictionaryDecompounderTokenFilter setMaxSubwordSize(Integer maxSubwordSize) { + this.maxSubwordSize = maxSubwordSize; + return this; + } + + /** + * Get the onlyLongestMatch property: A value indicating whether to add only the longest matching subword to the + * output. Default is false. + * + * @return the onlyLongestMatch value. + */ + @Generated + public Boolean isOnlyLongestMatch() { + return this.onlyLongestMatch; + } + + /** + * Set the onlyLongestMatch property: A value indicating whether to add only the longest matching subword to the + * output. Default is false. + * + * @param onlyLongestMatch the onlyLongestMatch value to set. + * @return the DictionaryDecompounderTokenFilter object itself. + */ + @Generated + public DictionaryDecompounderTokenFilter setOnlyLongestMatch(Boolean onlyLongestMatch) { + this.onlyLongestMatch = onlyLongestMatch; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public DictionaryDecompounderTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeArrayField("wordList", this.wordList, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("minWordSize", this.minWordSize); + jsonWriter.writeNumberField("minSubwordSize", this.minSubwordSize); + jsonWriter.writeNumberField("maxSubwordSize", this.maxSubwordSize); + jsonWriter.writeBooleanField("onlyLongestMatch", this.onlyLongestMatch); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DictionaryDecompounderTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DictionaryDecompounderTokenFilter 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 DictionaryDecompounderTokenFilter. + */ + @Generated + public static DictionaryDecompounderTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DictionaryDecompounderTokenFilter deserializedDictionaryDecompounderTokenFilter + = new DictionaryDecompounderTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedDictionaryDecompounderTokenFilter.setName(reader.getString()); + } else if ("wordList".equals(fieldName)) { + List wordList = reader.readArray(reader1 -> reader1.getString()); + deserializedDictionaryDecompounderTokenFilter.wordList = wordList; + } else if ("@odata.type".equals(fieldName)) { + deserializedDictionaryDecompounderTokenFilter.odataType = reader.getString(); + } else if ("minWordSize".equals(fieldName)) { + deserializedDictionaryDecompounderTokenFilter.minWordSize = reader.getNullable(JsonReader::getInt); + } else if ("minSubwordSize".equals(fieldName)) { + deserializedDictionaryDecompounderTokenFilter.minSubwordSize + = reader.getNullable(JsonReader::getInt); + } else if ("maxSubwordSize".equals(fieldName)) { + deserializedDictionaryDecompounderTokenFilter.maxSubwordSize + = reader.getNullable(JsonReader::getInt); + } else if ("onlyLongestMatch".equals(fieldName)) { + deserializedDictionaryDecompounderTokenFilter.onlyLongestMatch + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedDictionaryDecompounderTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DistanceScoringFunction.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DistanceScoringFunction.java new file mode 100644 index 000000000000..83d6887b11ad --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DistanceScoringFunction.java @@ -0,0 +1,155 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines a function that boosts scores based on distance from a geographic location. + */ +@Fluent +public final class DistanceScoringFunction extends ScoringFunction { + /* + * Indicates the type of function to use. Valid values include magnitude, freshness, distance, and tag. The function + * type must be lower case. + */ + @Generated + private String type = "distance"; + + /* + * Parameter values for the distance scoring function. + */ + @Generated + private DistanceScoringParameters parameters; + + /** + * Creates an instance of DistanceScoringFunction class. + */ + @Generated + public DistanceScoringFunction() { + } + + /** + * Get the type property: Indicates the type of function to use. Valid values include magnitude, freshness, + * distance, and tag. The function type must be lower case. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the parameters property: Parameter values for the distance scoring function. + * + * @return the parameters value. + */ + @Generated + public DistanceScoringParameters getParameters() { + return this.parameters; + } + + /** + * Set the parameters property: Parameter values for the distance scoring function. + * + * @param parameters the parameters value to set. + * @return the DistanceScoringFunction object itself. + */ + @Generated + public DistanceScoringFunction setParameters(DistanceScoringParameters parameters) { + this.parameters = parameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public DistanceScoringFunction setFieldName(String fieldName) { + super.setFieldName(fieldName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public DistanceScoringFunction setBoost(double boost) { + super.setBoost(boost); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public DistanceScoringFunction setInterpolation(ScoringFunctionInterpolation interpolation) { + super.setInterpolation(interpolation); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("fieldName", getFieldName()); + jsonWriter.writeDoubleField("boost", getBoost()); + jsonWriter.writeStringField("interpolation", getInterpolation() == null ? null : getInterpolation().toString()); + jsonWriter.writeJsonField("distance", this.parameters); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DistanceScoringFunction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DistanceScoringFunction 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 DistanceScoringFunction. + */ + @Generated + public static DistanceScoringFunction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DistanceScoringFunction deserializedDistanceScoringFunction = new DistanceScoringFunction(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String jsonFieldName = reader.getFieldName(); + reader.nextToken(); + + if ("fieldName".equals(jsonFieldName)) { + deserializedDistanceScoringFunction.setFieldName(reader.getString()); + } else if ("boost".equals(jsonFieldName)) { + deserializedDistanceScoringFunction.setBoost(reader.getDouble()); + } else if ("interpolation".equals(jsonFieldName)) { + deserializedDistanceScoringFunction + .setInterpolation(ScoringFunctionInterpolation.fromString(reader.getString())); + } else if ("distance".equals(jsonFieldName)) { + deserializedDistanceScoringFunction.parameters = DistanceScoringParameters.fromJson(reader); + } else if ("type".equals(jsonFieldName)) { + deserializedDistanceScoringFunction.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDistanceScoringFunction; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DistanceScoringParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DistanceScoringParameters.java new file mode 100644 index 000000000000..30d9c2d4660e --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DistanceScoringParameters.java @@ -0,0 +1,129 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Provides parameter values to a distance scoring function. + */ +@Fluent +public final class DistanceScoringParameters implements JsonSerializable { + /* + * The name of the parameter passed in search queries to specify the reference location. + */ + @Generated + private String referencePointParameter; + + /* + * The distance in kilometers from the reference location where the boosting range ends. + */ + @Generated + private double boostingDistance; + + /** + * Creates an instance of DistanceScoringParameters class. + */ + @Generated + public DistanceScoringParameters() { + } + + /** + * Get the referencePointParameter property: The name of the parameter passed in search queries to specify the + * reference location. + * + * @return the referencePointParameter value. + */ + @Generated + public String getReferencePointParameter() { + return this.referencePointParameter; + } + + /** + * Set the referencePointParameter property: The name of the parameter passed in search queries to specify the + * reference location. + * + * @param referencePointParameter the referencePointParameter value to set. + * @return the DistanceScoringParameters object itself. + */ + @Generated + public DistanceScoringParameters setReferencePointParameter(String referencePointParameter) { + this.referencePointParameter = referencePointParameter; + return this; + } + + /** + * Get the boostingDistance property: The distance in kilometers from the reference location where the boosting + * range ends. + * + * @return the boostingDistance value. + */ + @Generated + public double getBoostingDistance() { + return this.boostingDistance; + } + + /** + * Set the boostingDistance property: The distance in kilometers from the reference location where the boosting + * range ends. + * + * @param boostingDistance the boostingDistance value to set. + * @return the DistanceScoringParameters object itself. + */ + @Generated + public DistanceScoringParameters setBoostingDistance(double boostingDistance) { + this.boostingDistance = boostingDistance; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("referencePointParameter", this.referencePointParameter); + jsonWriter.writeDoubleField("boostingDistance", this.boostingDistance); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DistanceScoringParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DistanceScoringParameters 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 DistanceScoringParameters. + */ + @Generated + public static DistanceScoringParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DistanceScoringParameters deserializedDistanceScoringParameters = new DistanceScoringParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("referencePointParameter".equals(fieldName)) { + deserializedDistanceScoringParameters.referencePointParameter = reader.getString(); + } else if ("boostingDistance".equals(fieldName)) { + deserializedDistanceScoringParameters.boostingDistance = reader.getDouble(); + } else { + reader.skipChildren(); + } + } + + return deserializedDistanceScoringParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentDebugInfo.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentDebugInfo.java new file mode 100644 index 000000000000..a5ec1d227784 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentDebugInfo.java @@ -0,0 +1,121 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * 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. + */ + @Generated + private SemanticDebugInfo semantic; + + /* + * Contains debugging information specific to vector and hybrid search. + */ + @Generated + private VectorsDebugInfo vectors; + + /* + * Contains debugging information specific to vectors matched within a collection of complex types. + */ + @Generated + private Map> innerHits; + + /** + * Creates an instance of DocumentDebugInfo class. + */ + @Generated + public DocumentDebugInfo() { + } + + /** + * Get the semantic property: Contains debugging information specific to semantic ranking requests. + * + * @return the semantic value. + */ + @Generated + public SemanticDebugInfo getSemantic() { + return this.semantic; + } + + /** + * Get the vectors property: Contains debugging information specific to vector and hybrid search. + * + * @return the vectors value. + */ + @Generated + public VectorsDebugInfo getVectors() { + return this.vectors; + } + + /** + * Get the innerHits property: Contains debugging information specific to vectors matched within a collection of + * complex types. + * + * @return the innerHits value. + */ + @Generated + public Map> getInnerHits() { + return this.innerHits; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + 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 if ("innerHits".equals(fieldName)) { + Map> innerHits = reader.readMap( + reader1 -> reader1.readArray(reader2 -> QueryResultDocumentInnerHit.fromJson(reader2))); + deserializedDocumentDebugInfo.innerHits = innerHits; + } else { + reader.skipChildren(); + } + } + + return deserializedDocumentDebugInfo; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentExtractionSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentExtractionSkill.java new file mode 100644 index 000000000000..b5f2c5e29eae --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentExtractionSkill.java @@ -0,0 +1,250 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * A skill that extracts content from a file within the enrichment pipeline. + */ +@Fluent +public final class DocumentExtractionSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Util.DocumentExtractionSkill"; + + /* + * The parsingMode for the skill. Will be set to 'default' if not defined. + */ + @Generated + private String parsingMode; + + /* + * The type of data to be extracted for the skill. Will be set to 'contentAndMetadata' if not defined. + */ + @Generated + private String dataToExtract; + + /* + * A dictionary of configurations for the skill. + */ + @Generated + private Map configuration; + + /** + * Creates an instance of DocumentExtractionSkill class. + */ + @Generated + public DocumentExtractionSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the parsingMode property: The parsingMode for the skill. Will be set to 'default' if not defined. + * + * @return the parsingMode value. + */ + @Generated + public String getParsingMode() { + return this.parsingMode; + } + + /** + * Set the parsingMode property: The parsingMode for the skill. Will be set to 'default' if not defined. + * + * @param parsingMode the parsingMode value to set. + * @return the DocumentExtractionSkill object itself. + */ + @Generated + public DocumentExtractionSkill setParsingMode(String parsingMode) { + this.parsingMode = parsingMode; + return this; + } + + /** + * Get the dataToExtract property: The type of data to be extracted for the skill. Will be set to + * 'contentAndMetadata' if not defined. + * + * @return the dataToExtract value. + */ + @Generated + public String getDataToExtract() { + return this.dataToExtract; + } + + /** + * Set the dataToExtract property: The type of data to be extracted for the skill. Will be set to + * 'contentAndMetadata' if not defined. + * + * @param dataToExtract the dataToExtract value to set. + * @return the DocumentExtractionSkill object itself. + */ + @Generated + public DocumentExtractionSkill setDataToExtract(String dataToExtract) { + this.dataToExtract = dataToExtract; + return this; + } + + /** + * Get the configuration property: A dictionary of configurations for the skill. + * + * @return the configuration value. + */ + @Generated + public Map getConfiguration() { + return this.configuration; + } + + /** + * Set the configuration property: A dictionary of configurations for the skill. + * + * @param configuration the configuration value to set. + * @return the DocumentExtractionSkill object itself. + */ + @Generated + public DocumentExtractionSkill setConfiguration(Map configuration) { + this.configuration = configuration; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public DocumentExtractionSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public DocumentExtractionSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public DocumentExtractionSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public DocumentExtractionSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public DocumentExtractionSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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("parsingMode", this.parsingMode); + jsonWriter.writeStringField("dataToExtract", this.dataToExtract); + jsonWriter.writeMapField("configuration", this.configuration, + (writer, element) -> writer.writeUntyped(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DocumentExtractionSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DocumentExtractionSkill 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 DocumentExtractionSkill. + */ + @Generated + public static DocumentExtractionSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DocumentExtractionSkill deserializedDocumentExtractionSkill = new DocumentExtractionSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedDocumentExtractionSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedDocumentExtractionSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedDocumentExtractionSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedDocumentExtractionSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedDocumentExtractionSkill.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedDocumentExtractionSkill.odataType = reader.getString(); + } else if ("parsingMode".equals(fieldName)) { + deserializedDocumentExtractionSkill.parsingMode = reader.getString(); + } else if ("dataToExtract".equals(fieldName)) { + deserializedDocumentExtractionSkill.dataToExtract = reader.getString(); + } else if ("configuration".equals(fieldName)) { + Map configuration = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedDocumentExtractionSkill.configuration = configuration; + } else { + reader.skipChildren(); + } + } + + return deserializedDocumentExtractionSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkill.java new file mode 100644 index 000000000000..30ee6db9fc64 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkill.java @@ -0,0 +1,324 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A skill that extracts content and layout information, via Azure AI Services, from files within the enrichment + * pipeline. + */ +@Fluent +public final class DocumentIntelligenceLayoutSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Util.DocumentIntelligenceLayoutSkill"; + + /* + * Controls the cardinality of the output format. Default is 'markdown'. + */ + @Generated + private DocumentIntelligenceLayoutSkillOutputFormat outputFormat; + + /* + * Controls the cardinality of the output produced by the skill. Default is 'oneToMany'. + */ + @Generated + private DocumentIntelligenceLayoutSkillOutputMode outputMode; + + /* + * The depth of headers in the markdown output. Default is h6. + */ + @Generated + private DocumentIntelligenceLayoutSkillMarkdownHeaderDepth markdownHeaderDepth; + + /* + * Controls the cardinality of the content extracted from the document by the skill + */ + @Generated + private List extractionOptions; + + /* + * Controls the cardinality for chunking the content. + */ + @Generated + private DocumentIntelligenceLayoutSkillChunkingProperties chunkingProperties; + + /** + * Creates an instance of DocumentIntelligenceLayoutSkill class. + */ + @Generated + public DocumentIntelligenceLayoutSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the outputFormat property: Controls the cardinality of the output format. Default is 'markdown'. + * + * @return the outputFormat value. + */ + @Generated + public DocumentIntelligenceLayoutSkillOutputFormat getOutputFormat() { + return this.outputFormat; + } + + /** + * Set the outputFormat property: Controls the cardinality of the output format. Default is 'markdown'. + * + * @param outputFormat the outputFormat value to set. + * @return the DocumentIntelligenceLayoutSkill object itself. + */ + @Generated + public DocumentIntelligenceLayoutSkill setOutputFormat(DocumentIntelligenceLayoutSkillOutputFormat outputFormat) { + this.outputFormat = outputFormat; + return this; + } + + /** + * Get the outputMode property: Controls the cardinality of the output produced by the skill. Default is + * 'oneToMany'. + * + * @return the outputMode value. + */ + @Generated + public DocumentIntelligenceLayoutSkillOutputMode getOutputMode() { + return this.outputMode; + } + + /** + * Set the outputMode property: Controls the cardinality of the output produced by the skill. Default is + * 'oneToMany'. + * + * @param outputMode the outputMode value to set. + * @return the DocumentIntelligenceLayoutSkill object itself. + */ + @Generated + public DocumentIntelligenceLayoutSkill setOutputMode(DocumentIntelligenceLayoutSkillOutputMode outputMode) { + this.outputMode = outputMode; + return this; + } + + /** + * Get the markdownHeaderDepth property: The depth of headers in the markdown output. Default is h6. + * + * @return the markdownHeaderDepth value. + */ + @Generated + public DocumentIntelligenceLayoutSkillMarkdownHeaderDepth getMarkdownHeaderDepth() { + return this.markdownHeaderDepth; + } + + /** + * Set the markdownHeaderDepth property: The depth of headers in the markdown output. Default is h6. + * + * @param markdownHeaderDepth the markdownHeaderDepth value to set. + * @return the DocumentIntelligenceLayoutSkill object itself. + */ + @Generated + public DocumentIntelligenceLayoutSkill + setMarkdownHeaderDepth(DocumentIntelligenceLayoutSkillMarkdownHeaderDepth markdownHeaderDepth) { + this.markdownHeaderDepth = markdownHeaderDepth; + return this; + } + + /** + * Get the extractionOptions property: Controls the cardinality of the content extracted from the document by the + * skill. + * + * @return the extractionOptions value. + */ + @Generated + public List getExtractionOptions() { + return this.extractionOptions; + } + + /** + * Set the extractionOptions property: Controls the cardinality of the content extracted from the document by the + * skill. + * + * @param extractionOptions the extractionOptions value to set. + * @return the DocumentIntelligenceLayoutSkill object itself. + */ + @Generated + public DocumentIntelligenceLayoutSkill + setExtractionOptions(List extractionOptions) { + this.extractionOptions = extractionOptions; + return this; + } + + /** + * Get the chunkingProperties property: Controls the cardinality for chunking the content. + * + * @return the chunkingProperties value. + */ + @Generated + public DocumentIntelligenceLayoutSkillChunkingProperties getChunkingProperties() { + return this.chunkingProperties; + } + + /** + * Set the chunkingProperties property: Controls the cardinality for chunking the content. + * + * @param chunkingProperties the chunkingProperties value to set. + * @return the DocumentIntelligenceLayoutSkill object itself. + */ + @Generated + public DocumentIntelligenceLayoutSkill + setChunkingProperties(DocumentIntelligenceLayoutSkillChunkingProperties chunkingProperties) { + this.chunkingProperties = chunkingProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public DocumentIntelligenceLayoutSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public DocumentIntelligenceLayoutSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public DocumentIntelligenceLayoutSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public DocumentIntelligenceLayoutSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public DocumentIntelligenceLayoutSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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("outputFormat", this.outputFormat == null ? null : this.outputFormat.toString()); + jsonWriter.writeStringField("outputMode", this.outputMode == null ? null : this.outputMode.toString()); + jsonWriter.writeStringField("markdownHeaderDepth", + this.markdownHeaderDepth == null ? null : this.markdownHeaderDepth.toString()); + jsonWriter.writeArrayField("extractionOptions", this.extractionOptions, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeJsonField("chunkingProperties", this.chunkingProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DocumentIntelligenceLayoutSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DocumentIntelligenceLayoutSkill 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 DocumentIntelligenceLayoutSkill. + */ + @Generated + public static DocumentIntelligenceLayoutSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DocumentIntelligenceLayoutSkill deserializedDocumentIntelligenceLayoutSkill + = new DocumentIntelligenceLayoutSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedDocumentIntelligenceLayoutSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedDocumentIntelligenceLayoutSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedDocumentIntelligenceLayoutSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedDocumentIntelligenceLayoutSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedDocumentIntelligenceLayoutSkill.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedDocumentIntelligenceLayoutSkill.odataType = reader.getString(); + } else if ("outputFormat".equals(fieldName)) { + deserializedDocumentIntelligenceLayoutSkill.outputFormat + = DocumentIntelligenceLayoutSkillOutputFormat.fromString(reader.getString()); + } else if ("outputMode".equals(fieldName)) { + deserializedDocumentIntelligenceLayoutSkill.outputMode + = DocumentIntelligenceLayoutSkillOutputMode.fromString(reader.getString()); + } else if ("markdownHeaderDepth".equals(fieldName)) { + deserializedDocumentIntelligenceLayoutSkill.markdownHeaderDepth + = DocumentIntelligenceLayoutSkillMarkdownHeaderDepth.fromString(reader.getString()); + } else if ("extractionOptions".equals(fieldName)) { + List extractionOptions = reader.readArray( + reader1 -> DocumentIntelligenceLayoutSkillExtractionOptions.fromString(reader1.getString())); + deserializedDocumentIntelligenceLayoutSkill.extractionOptions = extractionOptions; + } else if ("chunkingProperties".equals(fieldName)) { + deserializedDocumentIntelligenceLayoutSkill.chunkingProperties + = DocumentIntelligenceLayoutSkillChunkingProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDocumentIntelligenceLayoutSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillChunkingProperties.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillChunkingProperties.java new file mode 100644 index 000000000000..9c3cf507b5d3 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillChunkingProperties.java @@ -0,0 +1,160 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Controls the cardinality for chunking the content. + */ +@Fluent +public final class DocumentIntelligenceLayoutSkillChunkingProperties + implements JsonSerializable { + /* + * The unit of the chunk. + */ + @Generated + private DocumentIntelligenceLayoutSkillChunkingUnit unit; + + /* + * The maximum chunk length in characters. Default is 500. + */ + @Generated + private Integer maximumLength; + + /* + * The length of overlap provided between two text chunks. Default is 0. + */ + @Generated + private Integer overlapLength; + + /** + * Creates an instance of DocumentIntelligenceLayoutSkillChunkingProperties class. + */ + @Generated + public DocumentIntelligenceLayoutSkillChunkingProperties() { + } + + /** + * Get the unit property: The unit of the chunk. + * + * @return the unit value. + */ + @Generated + public DocumentIntelligenceLayoutSkillChunkingUnit getUnit() { + return this.unit; + } + + /** + * Set the unit property: The unit of the chunk. + * + * @param unit the unit value to set. + * @return the DocumentIntelligenceLayoutSkillChunkingProperties object itself. + */ + @Generated + public DocumentIntelligenceLayoutSkillChunkingProperties setUnit(DocumentIntelligenceLayoutSkillChunkingUnit unit) { + this.unit = unit; + return this; + } + + /** + * Get the maximumLength property: The maximum chunk length in characters. Default is 500. + * + * @return the maximumLength value. + */ + @Generated + public Integer getMaximumLength() { + return this.maximumLength; + } + + /** + * Set the maximumLength property: The maximum chunk length in characters. Default is 500. + * + * @param maximumLength the maximumLength value to set. + * @return the DocumentIntelligenceLayoutSkillChunkingProperties object itself. + */ + @Generated + public DocumentIntelligenceLayoutSkillChunkingProperties setMaximumLength(Integer maximumLength) { + this.maximumLength = maximumLength; + return this; + } + + /** + * Get the overlapLength property: The length of overlap provided between two text chunks. Default is 0. + * + * @return the overlapLength value. + */ + @Generated + public Integer getOverlapLength() { + return this.overlapLength; + } + + /** + * Set the overlapLength property: The length of overlap provided between two text chunks. Default is 0. + * + * @param overlapLength the overlapLength value to set. + * @return the DocumentIntelligenceLayoutSkillChunkingProperties object itself. + */ + @Generated + public DocumentIntelligenceLayoutSkillChunkingProperties setOverlapLength(Integer overlapLength) { + this.overlapLength = overlapLength; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("unit", this.unit == null ? null : this.unit.toString()); + jsonWriter.writeNumberField("maximumLength", this.maximumLength); + jsonWriter.writeNumberField("overlapLength", this.overlapLength); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DocumentIntelligenceLayoutSkillChunkingProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DocumentIntelligenceLayoutSkillChunkingProperties 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 DocumentIntelligenceLayoutSkillChunkingProperties. + */ + @Generated + public static DocumentIntelligenceLayoutSkillChunkingProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DocumentIntelligenceLayoutSkillChunkingProperties deserializedDocumentIntelligenceLayoutSkillChunkingProperties + = new DocumentIntelligenceLayoutSkillChunkingProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("unit".equals(fieldName)) { + deserializedDocumentIntelligenceLayoutSkillChunkingProperties.unit + = DocumentIntelligenceLayoutSkillChunkingUnit.fromString(reader.getString()); + } else if ("maximumLength".equals(fieldName)) { + deserializedDocumentIntelligenceLayoutSkillChunkingProperties.maximumLength + = reader.getNullable(JsonReader::getInt); + } else if ("overlapLength".equals(fieldName)) { + deserializedDocumentIntelligenceLayoutSkillChunkingProperties.overlapLength + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedDocumentIntelligenceLayoutSkillChunkingProperties; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillChunkingUnit.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillChunkingUnit.java new file mode 100644 index 000000000000..31681cbe57b7 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillChunkingUnit.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Controls the cardinality of the chunk unit. Default is 'characters'. + */ +public final class DocumentIntelligenceLayoutSkillChunkingUnit + extends ExpandableStringEnum { + /** + * Specifies chunk by characters. + */ + @Generated + public static final DocumentIntelligenceLayoutSkillChunkingUnit CHARACTERS = fromString("characters"); + + /** + * Creates a new instance of DocumentIntelligenceLayoutSkillChunkingUnit value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public DocumentIntelligenceLayoutSkillChunkingUnit() { + } + + /** + * Creates or finds a DocumentIntelligenceLayoutSkillChunkingUnit from its string representation. + * + * @param name a name to look for. + * @return the corresponding DocumentIntelligenceLayoutSkillChunkingUnit. + */ + @Generated + public static DocumentIntelligenceLayoutSkillChunkingUnit fromString(String name) { + return fromString(name, DocumentIntelligenceLayoutSkillChunkingUnit.class); + } + + /** + * Gets known DocumentIntelligenceLayoutSkillChunkingUnit values. + * + * @return known DocumentIntelligenceLayoutSkillChunkingUnit values. + */ + @Generated + public static Collection values() { + return values(DocumentIntelligenceLayoutSkillChunkingUnit.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillExtractionOptions.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillExtractionOptions.java new file mode 100644 index 000000000000..25a6be8f33e2 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillExtractionOptions.java @@ -0,0 +1,60 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Controls the cardinality of the content extracted from the document by the skill. + */ +public final class DocumentIntelligenceLayoutSkillExtractionOptions + extends ExpandableStringEnum { + /** + * Specify that image content should be extracted from the document. + */ + @Generated + public static final DocumentIntelligenceLayoutSkillExtractionOptions IMAGES = fromString("images"); + + /** + * Specify that location metadata should be extracted from the document. + */ + @Generated + public static final DocumentIntelligenceLayoutSkillExtractionOptions LOCATION_METADATA + = fromString("locationMetadata"); + + /** + * Creates a new instance of DocumentIntelligenceLayoutSkillExtractionOptions value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public DocumentIntelligenceLayoutSkillExtractionOptions() { + } + + /** + * Creates or finds a DocumentIntelligenceLayoutSkillExtractionOptions from its string representation. + * + * @param name a name to look for. + * @return the corresponding DocumentIntelligenceLayoutSkillExtractionOptions. + */ + @Generated + public static DocumentIntelligenceLayoutSkillExtractionOptions fromString(String name) { + return fromString(name, DocumentIntelligenceLayoutSkillExtractionOptions.class); + } + + /** + * Gets known DocumentIntelligenceLayoutSkillExtractionOptions values. + * + * @return known DocumentIntelligenceLayoutSkillExtractionOptions values. + */ + @Generated + public static Collection values() { + return values(DocumentIntelligenceLayoutSkillExtractionOptions.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillMarkdownHeaderDepth.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillMarkdownHeaderDepth.java new file mode 100644 index 000000000000..3ea69461643a --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillMarkdownHeaderDepth.java @@ -0,0 +1,83 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The depth of headers in the markdown output. Default is h6. + */ +public final class DocumentIntelligenceLayoutSkillMarkdownHeaderDepth + extends ExpandableStringEnum { + /** + * Header level 1. + */ + @Generated + public static final DocumentIntelligenceLayoutSkillMarkdownHeaderDepth H1 = fromString("h1"); + + /** + * Header level 2. + */ + @Generated + public static final DocumentIntelligenceLayoutSkillMarkdownHeaderDepth H2 = fromString("h2"); + + /** + * Header level 3. + */ + @Generated + public static final DocumentIntelligenceLayoutSkillMarkdownHeaderDepth H3 = fromString("h3"); + + /** + * Header level 4. + */ + @Generated + public static final DocumentIntelligenceLayoutSkillMarkdownHeaderDepth H4 = fromString("h4"); + + /** + * Header level 5. + */ + @Generated + public static final DocumentIntelligenceLayoutSkillMarkdownHeaderDepth H5 = fromString("h5"); + + /** + * Header level 6. + */ + @Generated + public static final DocumentIntelligenceLayoutSkillMarkdownHeaderDepth H6 = fromString("h6"); + + /** + * Creates a new instance of DocumentIntelligenceLayoutSkillMarkdownHeaderDepth value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public DocumentIntelligenceLayoutSkillMarkdownHeaderDepth() { + } + + /** + * Creates or finds a DocumentIntelligenceLayoutSkillMarkdownHeaderDepth from its string representation. + * + * @param name a name to look for. + * @return the corresponding DocumentIntelligenceLayoutSkillMarkdownHeaderDepth. + */ + @Generated + public static DocumentIntelligenceLayoutSkillMarkdownHeaderDepth fromString(String name) { + return fromString(name, DocumentIntelligenceLayoutSkillMarkdownHeaderDepth.class); + } + + /** + * Gets known DocumentIntelligenceLayoutSkillMarkdownHeaderDepth values. + * + * @return known DocumentIntelligenceLayoutSkillMarkdownHeaderDepth values. + */ + @Generated + public static Collection values() { + return values(DocumentIntelligenceLayoutSkillMarkdownHeaderDepth.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillOutputFormat.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillOutputFormat.java new file mode 100644 index 000000000000..ddfd5609ff2a --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillOutputFormat.java @@ -0,0 +1,59 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Controls the cardinality of the output format. Default is 'markdown'. + */ +public final class DocumentIntelligenceLayoutSkillOutputFormat + extends ExpandableStringEnum { + /** + * Specify the format of the output as text. + */ + @Generated + public static final DocumentIntelligenceLayoutSkillOutputFormat TEXT = fromString("text"); + + /** + * Specify the format of the output as markdown. + */ + @Generated + public static final DocumentIntelligenceLayoutSkillOutputFormat MARKDOWN = fromString("markdown"); + + /** + * Creates a new instance of DocumentIntelligenceLayoutSkillOutputFormat value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public DocumentIntelligenceLayoutSkillOutputFormat() { + } + + /** + * Creates or finds a DocumentIntelligenceLayoutSkillOutputFormat from its string representation. + * + * @param name a name to look for. + * @return the corresponding DocumentIntelligenceLayoutSkillOutputFormat. + */ + @Generated + public static DocumentIntelligenceLayoutSkillOutputFormat fromString(String name) { + return fromString(name, DocumentIntelligenceLayoutSkillOutputFormat.class); + } + + /** + * Gets known DocumentIntelligenceLayoutSkillOutputFormat values. + * + * @return known DocumentIntelligenceLayoutSkillOutputFormat values. + */ + @Generated + public static Collection values() { + return values(DocumentIntelligenceLayoutSkillOutputFormat.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillOutputMode.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillOutputMode.java new file mode 100644 index 000000000000..905badcf955c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentIntelligenceLayoutSkillOutputMode.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Controls the cardinality of the output produced by the skill. Default is 'oneToMany'. + */ +public final class DocumentIntelligenceLayoutSkillOutputMode + extends ExpandableStringEnum { + /** + * Specify that the output should be parsed as 'oneToMany'. + */ + @Generated + public static final DocumentIntelligenceLayoutSkillOutputMode ONE_TO_MANY = fromString("oneToMany"); + + /** + * Creates a new instance of DocumentIntelligenceLayoutSkillOutputMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public DocumentIntelligenceLayoutSkillOutputMode() { + } + + /** + * Creates or finds a DocumentIntelligenceLayoutSkillOutputMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding DocumentIntelligenceLayoutSkillOutputMode. + */ + @Generated + public static DocumentIntelligenceLayoutSkillOutputMode fromString(String name) { + return fromString(name, DocumentIntelligenceLayoutSkillOutputMode.class); + } + + /** + * Gets known DocumentIntelligenceLayoutSkillOutputMode values. + * + * @return known DocumentIntelligenceLayoutSkillOutputMode values. + */ + @Generated + public static Collection values() { + return values(DocumentIntelligenceLayoutSkillOutputMode.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentKeysOrIds.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentKeysOrIds.java new file mode 100644 index 000000000000..0aa0cc37df81 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/DocumentKeysOrIds.java @@ -0,0 +1,128 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 + */ + @Generated + private List documentKeys; + + /* + * datasource document identifiers to be reset + */ + @Generated + private List datasourceDocumentIds; + + /** + * Creates an instance of DocumentKeysOrIds class. + */ + @Generated + public DocumentKeysOrIds() { + } + + /** + * Get the documentKeys property: document keys to be reset. + * + * @return the documentKeys value. + */ + @Generated + 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. + */ + @Generated + public DocumentKeysOrIds setDocumentKeys(List documentKeys) { + this.documentKeys = documentKeys; + return this; + } + + /** + * Get the datasourceDocumentIds property: datasource document identifiers to be reset. + * + * @return the datasourceDocumentIds value. + */ + @Generated + 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. + */ + @Generated + public DocumentKeysOrIds setDatasourceDocumentIds(List datasourceDocumentIds) { + this.datasourceDocumentIds = datasourceDocumentIds; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + 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/search/src/main/java/com/azure/search/models/EdgeNGramTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EdgeNGramTokenFilter.java new file mode 100644 index 000000000000..b6fb48e46c6a --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EdgeNGramTokenFilter.java @@ -0,0 +1,189 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Generates n-grams of the given size(s) starting from the front or the back of an input token. This token filter is + * implemented using Apache Lucene. + */ +@Fluent +public final class EdgeNGramTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.EdgeNGramTokenFilter"; + + /* + * The minimum n-gram length. Default is 1. Must be less than the value of maxGram. + */ + @Generated + private Integer minGram; + + /* + * The maximum n-gram length. Default is 2. + */ + @Generated + private Integer maxGram; + + /* + * Specifies which side of the input the n-gram should be generated from. Default is "front". + */ + @Generated + private EdgeNGramTokenFilterSide side; + + /** + * Creates an instance of EdgeNGramTokenFilter class. + */ + @Generated + public EdgeNGramTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the minGram property: The minimum n-gram length. Default is 1. Must be less than the value of maxGram. + * + * @return the minGram value. + */ + @Generated + public Integer getMinGram() { + return this.minGram; + } + + /** + * Set the minGram property: The minimum n-gram length. Default is 1. Must be less than the value of maxGram. + * + * @param minGram the minGram value to set. + * @return the EdgeNGramTokenFilter object itself. + */ + @Generated + public EdgeNGramTokenFilter setMinGram(Integer minGram) { + this.minGram = minGram; + return this; + } + + /** + * Get the maxGram property: The maximum n-gram length. Default is 2. + * + * @return the maxGram value. + */ + @Generated + public Integer getMaxGram() { + return this.maxGram; + } + + /** + * Set the maxGram property: The maximum n-gram length. Default is 2. + * + * @param maxGram the maxGram value to set. + * @return the EdgeNGramTokenFilter object itself. + */ + @Generated + public EdgeNGramTokenFilter setMaxGram(Integer maxGram) { + this.maxGram = maxGram; + return this; + } + + /** + * Get the side property: Specifies which side of the input the n-gram should be generated from. Default is "front". + * + * @return the side value. + */ + @Generated + public EdgeNGramTokenFilterSide getSide() { + return this.side; + } + + /** + * Set the side property: Specifies which side of the input the n-gram should be generated from. Default is "front". + * + * @param side the side value to set. + * @return the EdgeNGramTokenFilter object itself. + */ + @Generated + public EdgeNGramTokenFilter setSide(EdgeNGramTokenFilterSide side) { + this.side = side; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public EdgeNGramTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("minGram", this.minGram); + jsonWriter.writeNumberField("maxGram", this.maxGram); + jsonWriter.writeStringField("side", this.side == null ? null : this.side.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EdgeNGramTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EdgeNGramTokenFilter 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 EdgeNGramTokenFilter. + */ + @Generated + public static EdgeNGramTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EdgeNGramTokenFilter deserializedEdgeNGramTokenFilter = new EdgeNGramTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedEdgeNGramTokenFilter.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedEdgeNGramTokenFilter.odataType = reader.getString(); + } else if ("minGram".equals(fieldName)) { + deserializedEdgeNGramTokenFilter.minGram = reader.getNullable(JsonReader::getInt); + } else if ("maxGram".equals(fieldName)) { + deserializedEdgeNGramTokenFilter.maxGram = reader.getNullable(JsonReader::getInt); + } else if ("side".equals(fieldName)) { + deserializedEdgeNGramTokenFilter.side = EdgeNGramTokenFilterSide.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedEdgeNGramTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EdgeNGramTokenFilterSide.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EdgeNGramTokenFilterSide.java new file mode 100644 index 000000000000..1c8376680c08 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EdgeNGramTokenFilterSide.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.models; + +/** + * Specifies which side of the input an n-gram should be generated from. + */ +public enum EdgeNGramTokenFilterSide { + /** + * Specifies that the n-gram should be generated from the front of the input. + */ + FRONT("front"), + + /** + * Specifies that the n-gram should be generated from the back of the input. + */ + BACK("back"); + + /** + * The actual serialized value for a EdgeNGramTokenFilterSide instance. + */ + private final String value; + + EdgeNGramTokenFilterSide(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a EdgeNGramTokenFilterSide instance. + * + * @param value the serialized value to parse. + * @return the parsed EdgeNGramTokenFilterSide object, or null if unable to parse. + */ + public static EdgeNGramTokenFilterSide fromString(String value) { + if (value == null) { + return null; + } + EdgeNGramTokenFilterSide[] items = EdgeNGramTokenFilterSide.values(); + for (EdgeNGramTokenFilterSide item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EdgeNGramTokenFilterV2.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EdgeNGramTokenFilterV2.java new file mode 100644 index 000000000000..3e97abad7cfd --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EdgeNGramTokenFilterV2.java @@ -0,0 +1,191 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Generates n-grams of the given size(s) starting from the front or the back of an input token. This token filter is + * implemented using Apache Lucene. + */ +@Fluent +public final class EdgeNGramTokenFilterV2 extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.EdgeNGramTokenFilterV2"; + + /* + * The minimum n-gram length. Default is 1. Maximum is 300. Must be less than the value of maxGram. + */ + @Generated + private Integer minGram; + + /* + * The maximum n-gram length. Default is 2. Maximum is 300. + */ + @Generated + private Integer maxGram; + + /* + * Specifies which side of the input the n-gram should be generated from. Default is "front". + */ + @Generated + private EdgeNGramTokenFilterSide side; + + /** + * Creates an instance of EdgeNGramTokenFilterV2 class. + */ + @Generated + public EdgeNGramTokenFilterV2() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the minGram property: The minimum n-gram length. Default is 1. Maximum is 300. Must be less than the value of + * maxGram. + * + * @return the minGram value. + */ + @Generated + public Integer getMinGram() { + return this.minGram; + } + + /** + * Set the minGram property: The minimum n-gram length. Default is 1. Maximum is 300. Must be less than the value of + * maxGram. + * + * @param minGram the minGram value to set. + * @return the EdgeNGramTokenFilterV2 object itself. + */ + @Generated + public EdgeNGramTokenFilterV2 setMinGram(Integer minGram) { + this.minGram = minGram; + return this; + } + + /** + * Get the maxGram property: The maximum n-gram length. Default is 2. Maximum is 300. + * + * @return the maxGram value. + */ + @Generated + public Integer getMaxGram() { + return this.maxGram; + } + + /** + * Set the maxGram property: The maximum n-gram length. Default is 2. Maximum is 300. + * + * @param maxGram the maxGram value to set. + * @return the EdgeNGramTokenFilterV2 object itself. + */ + @Generated + public EdgeNGramTokenFilterV2 setMaxGram(Integer maxGram) { + this.maxGram = maxGram; + return this; + } + + /** + * Get the side property: Specifies which side of the input the n-gram should be generated from. Default is "front". + * + * @return the side value. + */ + @Generated + public EdgeNGramTokenFilterSide getSide() { + return this.side; + } + + /** + * Set the side property: Specifies which side of the input the n-gram should be generated from. Default is "front". + * + * @param side the side value to set. + * @return the EdgeNGramTokenFilterV2 object itself. + */ + @Generated + public EdgeNGramTokenFilterV2 setSide(EdgeNGramTokenFilterSide side) { + this.side = side; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public EdgeNGramTokenFilterV2 setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("minGram", this.minGram); + jsonWriter.writeNumberField("maxGram", this.maxGram); + jsonWriter.writeStringField("side", this.side == null ? null : this.side.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EdgeNGramTokenFilterV2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EdgeNGramTokenFilterV2 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 EdgeNGramTokenFilterV2. + */ + @Generated + public static EdgeNGramTokenFilterV2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EdgeNGramTokenFilterV2 deserializedEdgeNGramTokenFilterV2 = new EdgeNGramTokenFilterV2(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedEdgeNGramTokenFilterV2.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedEdgeNGramTokenFilterV2.odataType = reader.getString(); + } else if ("minGram".equals(fieldName)) { + deserializedEdgeNGramTokenFilterV2.minGram = reader.getNullable(JsonReader::getInt); + } else if ("maxGram".equals(fieldName)) { + deserializedEdgeNGramTokenFilterV2.maxGram = reader.getNullable(JsonReader::getInt); + } else if ("side".equals(fieldName)) { + deserializedEdgeNGramTokenFilterV2.side = EdgeNGramTokenFilterSide.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedEdgeNGramTokenFilterV2; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EdgeNGramTokenizer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EdgeNGramTokenizer.java new file mode 100644 index 000000000000..277ff4c7dfd4 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EdgeNGramTokenizer.java @@ -0,0 +1,195 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Tokenizes the input from an edge into n-grams of the given size(s). This tokenizer is implemented using Apache + * Lucene. + */ +@Fluent +public final class EdgeNGramTokenizer extends LexicalTokenizer { + /* + * A URI fragment specifying the type of tokenizer. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.EdgeNGramTokenizer"; + + /* + * The minimum n-gram length. Default is 1. Maximum is 300. Must be less than the value of maxGram. + */ + @Generated + private Integer minGram; + + /* + * The maximum n-gram length. Default is 2. Maximum is 300. + */ + @Generated + private Integer maxGram; + + /* + * Character classes to keep in the tokens. + */ + @Generated + private List tokenChars; + + /** + * Creates an instance of EdgeNGramTokenizer class. + */ + @Generated + public EdgeNGramTokenizer() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of tokenizer. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the minGram property: The minimum n-gram length. Default is 1. Maximum is 300. Must be less than the value of + * maxGram. + * + * @return the minGram value. + */ + @Generated + public Integer getMinGram() { + return this.minGram; + } + + /** + * Set the minGram property: The minimum n-gram length. Default is 1. Maximum is 300. Must be less than the value of + * maxGram. + * + * @param minGram the minGram value to set. + * @return the EdgeNGramTokenizer object itself. + */ + @Generated + public EdgeNGramTokenizer setMinGram(Integer minGram) { + this.minGram = minGram; + return this; + } + + /** + * Get the maxGram property: The maximum n-gram length. Default is 2. Maximum is 300. + * + * @return the maxGram value. + */ + @Generated + public Integer getMaxGram() { + return this.maxGram; + } + + /** + * Set the maxGram property: The maximum n-gram length. Default is 2. Maximum is 300. + * + * @param maxGram the maxGram value to set. + * @return the EdgeNGramTokenizer object itself. + */ + @Generated + public EdgeNGramTokenizer setMaxGram(Integer maxGram) { + this.maxGram = maxGram; + return this; + } + + /** + * Get the tokenChars property: Character classes to keep in the tokens. + * + * @return the tokenChars value. + */ + @Generated + public List getTokenChars() { + return this.tokenChars; + } + + /** + * Set the tokenChars property: Character classes to keep in the tokens. + * + * @param tokenChars the tokenChars value to set. + * @return the EdgeNGramTokenizer object itself. + */ + @Generated + public EdgeNGramTokenizer setTokenChars(List tokenChars) { + this.tokenChars = tokenChars; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public EdgeNGramTokenizer setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("minGram", this.minGram); + jsonWriter.writeNumberField("maxGram", this.maxGram); + jsonWriter.writeArrayField("tokenChars", this.tokenChars, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EdgeNGramTokenizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EdgeNGramTokenizer 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 EdgeNGramTokenizer. + */ + @Generated + public static EdgeNGramTokenizer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EdgeNGramTokenizer deserializedEdgeNGramTokenizer = new EdgeNGramTokenizer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedEdgeNGramTokenizer.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedEdgeNGramTokenizer.odataType = reader.getString(); + } else if ("minGram".equals(fieldName)) { + deserializedEdgeNGramTokenizer.minGram = reader.getNullable(JsonReader::getInt); + } else if ("maxGram".equals(fieldName)) { + deserializedEdgeNGramTokenizer.maxGram = reader.getNullable(JsonReader::getInt); + } else if ("tokenChars".equals(fieldName)) { + List tokenChars + = reader.readArray(reader1 -> TokenCharacterKind.fromString(reader1.getString())); + deserializedEdgeNGramTokenizer.tokenChars = tokenChars; + } else { + reader.skipChildren(); + } + } + + return deserializedEdgeNGramTokenizer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ElisionTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ElisionTokenFilter.java new file mode 100644 index 000000000000..fb885dd6f819 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ElisionTokenFilter.java @@ -0,0 +1,129 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Removes elisions. For example, "l'avion" (the plane) will be converted to "avion" (plane). This token filter is + * implemented using Apache Lucene. + */ +@Fluent +public final class ElisionTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.ElisionTokenFilter"; + + /* + * The set of articles to remove. + */ + @Generated + private List articles; + + /** + * Creates an instance of ElisionTokenFilter class. + */ + @Generated + public ElisionTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the articles property: The set of articles to remove. + * + * @return the articles value. + */ + @Generated + public List getArticles() { + return this.articles; + } + + /** + * Set the articles property: The set of articles to remove. + * + * @param articles the articles value to set. + * @return the ElisionTokenFilter object itself. + */ + @Generated + public ElisionTokenFilter setArticles(List articles) { + this.articles = articles; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ElisionTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeArrayField("articles", this.articles, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ElisionTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ElisionTokenFilter 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 ElisionTokenFilter. + */ + @Generated + public static ElisionTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ElisionTokenFilter deserializedElisionTokenFilter = new ElisionTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedElisionTokenFilter.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedElisionTokenFilter.odataType = reader.getString(); + } else if ("articles".equals(fieldName)) { + List articles = reader.readArray(reader1 -> reader1.getString()); + deserializedElisionTokenFilter.articles = articles; + } else { + reader.skipChildren(); + } + } + + return deserializedElisionTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityCategory.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityCategory.java new file mode 100644 index 000000000000..65c6faba8343 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityCategory.java @@ -0,0 +1,88 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * A string indicating what entity categories to return. + */ +public final class EntityCategory extends ExpandableStringEnum { + /** + * Entities describing a physical location. + */ + @Generated + public static final EntityCategory LOCATION = fromString("location"); + + /** + * Entities describing an organization. + */ + @Generated + public static final EntityCategory ORGANIZATION = fromString("organization"); + + /** + * Entities describing a person. + */ + @Generated + public static final EntityCategory PERSON = fromString("person"); + + /** + * Entities describing a quantity. + */ + @Generated + public static final EntityCategory QUANTITY = fromString("quantity"); + + /** + * Entities describing a date and time. + */ + @Generated + public static final EntityCategory DATETIME = fromString("datetime"); + + /** + * Entities describing a URL. + */ + @Generated + public static final EntityCategory URL = fromString("url"); + + /** + * Entities describing an email address. + */ + @Generated + public static final EntityCategory EMAIL = fromString("email"); + + /** + * Creates a new instance of EntityCategory value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public EntityCategory() { + } + + /** + * Creates or finds a EntityCategory from its string representation. + * + * @param name a name to look for. + * @return the corresponding EntityCategory. + */ + @Generated + public static EntityCategory fromString(String name) { + return fromString(name, EntityCategory.class); + } + + /** + * Gets known EntityCategory values. + * + * @return known EntityCategory values. + */ + @Generated + public static Collection values() { + return values(EntityCategory.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityLinkingSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityLinkingSkill.java new file mode 100644 index 000000000000..5727ab1626fe --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityLinkingSkill.java @@ -0,0 +1,255 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Using the Text Analytics API, extracts linked entities from text. + */ +@Fluent +public final class EntityLinkingSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Text.V3.EntityLinkingSkill"; + + /* + * A value indicating which language code to use. Default is `en`. + */ + @Generated + private String defaultLanguageCode; + + /* + * A value between 0 and 1 that be used to only include entities whose confidence score is greater than the value + * specified. If not set (default), or if explicitly set to null, all entities will be included. + */ + @Generated + private Double minimumPrecision; + + /* + * The version of the model to use when calling the Text Analytics service. It will default to the latest available + * when not specified. We recommend you do not specify this value unless absolutely necessary. + */ + @Generated + private String modelVersion; + + /** + * Creates an instance of EntityLinkingSkill class. + */ + @Generated + public EntityLinkingSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @return the defaultLanguageCode value. + */ + @Generated + public String getDefaultLanguageCode() { + return this.defaultLanguageCode; + } + + /** + * Set the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @param defaultLanguageCode the defaultLanguageCode value to set. + * @return the EntityLinkingSkill object itself. + */ + @Generated + public EntityLinkingSkill setDefaultLanguageCode(String defaultLanguageCode) { + this.defaultLanguageCode = defaultLanguageCode; + return this; + } + + /** + * Get the minimumPrecision property: A value between 0 and 1 that be used to only include entities whose confidence + * score is greater than the value specified. If not set (default), or if explicitly set to null, all entities will + * be included. + * + * @return the minimumPrecision value. + */ + @Generated + public Double getMinimumPrecision() { + return this.minimumPrecision; + } + + /** + * Set the minimumPrecision property: A value between 0 and 1 that be used to only include entities whose confidence + * score is greater than the value specified. If not set (default), or if explicitly set to null, all entities will + * be included. + * + * @param minimumPrecision the minimumPrecision value to set. + * @return the EntityLinkingSkill object itself. + */ + @Generated + public EntityLinkingSkill setMinimumPrecision(Double minimumPrecision) { + this.minimumPrecision = minimumPrecision; + return this; + } + + /** + * Get the modelVersion property: The version of the model to use when calling the Text Analytics service. It will + * default to the latest available when not specified. We recommend you do not specify this value unless absolutely + * necessary. + * + * @return the modelVersion value. + */ + @Generated + public String getModelVersion() { + return this.modelVersion; + } + + /** + * Set the modelVersion property: The version of the model to use when calling the Text Analytics service. It will + * default to the latest available when not specified. We recommend you do not specify this value unless absolutely + * necessary. + * + * @param modelVersion the modelVersion value to set. + * @return the EntityLinkingSkill object itself. + */ + @Generated + public EntityLinkingSkill setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public EntityLinkingSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public EntityLinkingSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public EntityLinkingSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public EntityLinkingSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public EntityLinkingSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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("defaultLanguageCode", this.defaultLanguageCode); + jsonWriter.writeNumberField("minimumPrecision", this.minimumPrecision); + jsonWriter.writeStringField("modelVersion", this.modelVersion); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityLinkingSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityLinkingSkill 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 EntityLinkingSkill. + */ + @Generated + public static EntityLinkingSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityLinkingSkill deserializedEntityLinkingSkill = new EntityLinkingSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedEntityLinkingSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedEntityLinkingSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedEntityLinkingSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedEntityLinkingSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedEntityLinkingSkill.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedEntityLinkingSkill.odataType = reader.getString(); + } else if ("defaultLanguageCode".equals(fieldName)) { + deserializedEntityLinkingSkill.defaultLanguageCode = reader.getString(); + } else if ("minimumPrecision".equals(fieldName)) { + deserializedEntityLinkingSkill.minimumPrecision = reader.getNullable(JsonReader::getDouble); + } else if ("modelVersion".equals(fieldName)) { + deserializedEntityLinkingSkill.modelVersion = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityLinkingSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityRecognitionSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityRecognitionSkill.java new file mode 100644 index 000000000000..47924c7d52bd --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityRecognitionSkill.java @@ -0,0 +1,293 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * This skill is deprecated. Use the V3.EntityRecognitionSkill instead. + */ +@Fluent +public final class EntityRecognitionSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Text.EntityRecognitionSkill"; + + /* + * A list of entity categories that should be extracted. + */ + @Generated + private List categories; + + /* + * A value indicating which language code to use. Default is `en`. + */ + @Generated + private EntityRecognitionSkillLanguage defaultLanguageCode; + + /* + * Determines whether or not to include entities which are well known but don't conform to a pre-defined type. If + * this configuration is not set (default), set to null or set to false, entities which don't conform to one of the + * pre-defined types will not be surfaced. + */ + @Generated + private Boolean includeTypelessEntities; + + /* + * A value between 0 and 1 that be used to only include entities whose confidence score is greater than the value + * specified. If not set (default), or if explicitly set to null, all entities will be included. + */ + @Generated + private Double minimumPrecision; + + /** + * Creates an instance of EntityRecognitionSkill class. + */ + @Generated + public EntityRecognitionSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the categories property: A list of entity categories that should be extracted. + * + * @return the categories value. + */ + @Generated + public List getCategories() { + return this.categories; + } + + /** + * Set the categories property: A list of entity categories that should be extracted. + * + * @param categories the categories value to set. + * @return the EntityRecognitionSkill object itself. + */ + @Generated + public EntityRecognitionSkill setCategories(List categories) { + this.categories = categories; + return this; + } + + /** + * Get the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @return the defaultLanguageCode value. + */ + @Generated + public EntityRecognitionSkillLanguage getDefaultLanguageCode() { + return this.defaultLanguageCode; + } + + /** + * Set the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @param defaultLanguageCode the defaultLanguageCode value to set. + * @return the EntityRecognitionSkill object itself. + */ + @Generated + public EntityRecognitionSkill setDefaultLanguageCode(EntityRecognitionSkillLanguage defaultLanguageCode) { + this.defaultLanguageCode = defaultLanguageCode; + return this; + } + + /** + * Get the includeTypelessEntities property: Determines whether or not to include entities which are well known but + * don't conform to a pre-defined type. If this configuration is not set (default), set to null or set to false, + * entities which don't conform to one of the pre-defined types will not be surfaced. + * + * @return the includeTypelessEntities value. + */ + @Generated + public Boolean isIncludeTypelessEntities() { + return this.includeTypelessEntities; + } + + /** + * Set the includeTypelessEntities property: Determines whether or not to include entities which are well known but + * don't conform to a pre-defined type. If this configuration is not set (default), set to null or set to false, + * entities which don't conform to one of the pre-defined types will not be surfaced. + * + * @param includeTypelessEntities the includeTypelessEntities value to set. + * @return the EntityRecognitionSkill object itself. + */ + @Generated + public EntityRecognitionSkill setIncludeTypelessEntities(Boolean includeTypelessEntities) { + this.includeTypelessEntities = includeTypelessEntities; + return this; + } + + /** + * Get the minimumPrecision property: A value between 0 and 1 that be used to only include entities whose confidence + * score is greater than the value specified. If not set (default), or if explicitly set to null, all entities will + * be included. + * + * @return the minimumPrecision value. + */ + @Generated + public Double getMinimumPrecision() { + return this.minimumPrecision; + } + + /** + * Set the minimumPrecision property: A value between 0 and 1 that be used to only include entities whose confidence + * score is greater than the value specified. If not set (default), or if explicitly set to null, all entities will + * be included. + * + * @param minimumPrecision the minimumPrecision value to set. + * @return the EntityRecognitionSkill object itself. + */ + @Generated + public EntityRecognitionSkill setMinimumPrecision(Double minimumPrecision) { + this.minimumPrecision = minimumPrecision; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public EntityRecognitionSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public EntityRecognitionSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public EntityRecognitionSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public EntityRecognitionSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public EntityRecognitionSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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.writeArrayField("categories", this.categories, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("defaultLanguageCode", + this.defaultLanguageCode == null ? null : this.defaultLanguageCode.toString()); + jsonWriter.writeBooleanField("includeTypelessEntities", this.includeTypelessEntities); + jsonWriter.writeNumberField("minimumPrecision", this.minimumPrecision); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityRecognitionSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityRecognitionSkill 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 EntityRecognitionSkill. + */ + @Generated + public static EntityRecognitionSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityRecognitionSkill deserializedEntityRecognitionSkill = new EntityRecognitionSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedEntityRecognitionSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedEntityRecognitionSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedEntityRecognitionSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedEntityRecognitionSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedEntityRecognitionSkill.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedEntityRecognitionSkill.odataType = reader.getString(); + } else if ("categories".equals(fieldName)) { + List categories + = reader.readArray(reader1 -> EntityCategory.fromString(reader1.getString())); + deserializedEntityRecognitionSkill.categories = categories; + } else if ("defaultLanguageCode".equals(fieldName)) { + deserializedEntityRecognitionSkill.defaultLanguageCode + = EntityRecognitionSkillLanguage.fromString(reader.getString()); + } else if ("includeTypelessEntities".equals(fieldName)) { + deserializedEntityRecognitionSkill.includeTypelessEntities + = reader.getNullable(JsonReader::getBoolean); + } else if ("minimumPrecision".equals(fieldName)) { + deserializedEntityRecognitionSkill.minimumPrecision = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityRecognitionSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityRecognitionSkillLanguage.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityRecognitionSkillLanguage.java new file mode 100644 index 000000000000..78ed38956371 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityRecognitionSkillLanguage.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Deprecated. The language codes supported for input text by EntityRecognitionSkill. + */ +public final class EntityRecognitionSkillLanguage extends ExpandableStringEnum { + /** + * Arabic. + */ + @Generated + public static final EntityRecognitionSkillLanguage AR = fromString("ar"); + + /** + * Czech. + */ + @Generated + public static final EntityRecognitionSkillLanguage CS = fromString("cs"); + + /** + * Chinese-Simplified. + */ + @Generated + public static final EntityRecognitionSkillLanguage ZH_HANS = fromString("zh-Hans"); + + /** + * Chinese-Traditional. + */ + @Generated + public static final EntityRecognitionSkillLanguage ZH_HANT = fromString("zh-Hant"); + + /** + * Danish. + */ + @Generated + public static final EntityRecognitionSkillLanguage DA = fromString("da"); + + /** + * Dutch. + */ + @Generated + public static final EntityRecognitionSkillLanguage NL = fromString("nl"); + + /** + * English. + */ + @Generated + public static final EntityRecognitionSkillLanguage EN = fromString("en"); + + /** + * Finnish. + */ + @Generated + public static final EntityRecognitionSkillLanguage FI = fromString("fi"); + + /** + * French. + */ + @Generated + public static final EntityRecognitionSkillLanguage FR = fromString("fr"); + + /** + * German. + */ + @Generated + public static final EntityRecognitionSkillLanguage DE = fromString("de"); + + /** + * Greek. + */ + @Generated + public static final EntityRecognitionSkillLanguage EL = fromString("el"); + + /** + * Hungarian. + */ + @Generated + public static final EntityRecognitionSkillLanguage HU = fromString("hu"); + + /** + * Italian. + */ + @Generated + public static final EntityRecognitionSkillLanguage IT = fromString("it"); + + /** + * Japanese. + */ + @Generated + public static final EntityRecognitionSkillLanguage JA = fromString("ja"); + + /** + * Korean. + */ + @Generated + public static final EntityRecognitionSkillLanguage KO = fromString("ko"); + + /** + * Norwegian (Bokmaal). + */ + @Generated + public static final EntityRecognitionSkillLanguage NO = fromString("no"); + + /** + * Polish. + */ + @Generated + public static final EntityRecognitionSkillLanguage PL = fromString("pl"); + + /** + * Portuguese (Portugal). + */ + @Generated + public static final EntityRecognitionSkillLanguage PT_PT = fromString("pt-PT"); + + /** + * Portuguese (Brazil). + */ + @Generated + public static final EntityRecognitionSkillLanguage PT_BR = fromString("pt-BR"); + + /** + * Russian. + */ + @Generated + public static final EntityRecognitionSkillLanguage RU = fromString("ru"); + + /** + * Spanish. + */ + @Generated + public static final EntityRecognitionSkillLanguage ES = fromString("es"); + + /** + * Swedish. + */ + @Generated + public static final EntityRecognitionSkillLanguage SV = fromString("sv"); + + /** + * Turkish. + */ + @Generated + public static final EntityRecognitionSkillLanguage TR = fromString("tr"); + + /** + * Creates a new instance of EntityRecognitionSkillLanguage value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public EntityRecognitionSkillLanguage() { + } + + /** + * Creates or finds a EntityRecognitionSkillLanguage from its string representation. + * + * @param name a name to look for. + * @return the corresponding EntityRecognitionSkillLanguage. + */ + @Generated + public static EntityRecognitionSkillLanguage fromString(String name) { + return fromString(name, EntityRecognitionSkillLanguage.class); + } + + /** + * Gets known EntityRecognitionSkillLanguage values. + * + * @return known EntityRecognitionSkillLanguage values. + */ + @Generated + public static Collection values() { + return values(EntityRecognitionSkillLanguage.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityRecognitionSkillV3.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityRecognitionSkillV3.java new file mode 100644 index 000000000000..ab0c1d677b02 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/EntityRecognitionSkillV3.java @@ -0,0 +1,287 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Using the Text Analytics API, extracts entities of different types from text. + */ +@Fluent +public final class EntityRecognitionSkillV3 extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Text.V3.EntityRecognitionSkill"; + + /* + * A list of entity categories that should be extracted. + */ + @Generated + private List categories; + + /* + * A value indicating which language code to use. Default is `en`. + */ + @Generated + private String defaultLanguageCode; + + /* + * A value between 0 and 1 that be used to only include entities whose confidence score is greater than the value + * specified. If not set (default), or if explicitly set to null, all entities will be included. + */ + @Generated + private Double minimumPrecision; + + /* + * The version of the model to use when calling the Text Analytics API. It will default to the latest available when + * not specified. We recommend you do not specify this value unless absolutely necessary. + */ + @Generated + private String modelVersion; + + /** + * Creates an instance of EntityRecognitionSkillV3 class. + */ + @Generated + public EntityRecognitionSkillV3() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the categories property: A list of entity categories that should be extracted. + * + * @return the categories value. + */ + @Generated + public List getCategories() { + return this.categories; + } + + /** + * Set the categories property: A list of entity categories that should be extracted. + * + * @param categories the categories value to set. + * @return the EntityRecognitionSkillV3 object itself. + */ + @Generated + public EntityRecognitionSkillV3 setCategories(List categories) { + this.categories = categories; + return this; + } + + /** + * Get the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @return the defaultLanguageCode value. + */ + @Generated + public String getDefaultLanguageCode() { + return this.defaultLanguageCode; + } + + /** + * Set the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @param defaultLanguageCode the defaultLanguageCode value to set. + * @return the EntityRecognitionSkillV3 object itself. + */ + @Generated + public EntityRecognitionSkillV3 setDefaultLanguageCode(String defaultLanguageCode) { + this.defaultLanguageCode = defaultLanguageCode; + return this; + } + + /** + * Get the minimumPrecision property: A value between 0 and 1 that be used to only include entities whose confidence + * score is greater than the value specified. If not set (default), or if explicitly set to null, all entities will + * be included. + * + * @return the minimumPrecision value. + */ + @Generated + public Double getMinimumPrecision() { + return this.minimumPrecision; + } + + /** + * Set the minimumPrecision property: A value between 0 and 1 that be used to only include entities whose confidence + * score is greater than the value specified. If not set (default), or if explicitly set to null, all entities will + * be included. + * + * @param minimumPrecision the minimumPrecision value to set. + * @return the EntityRecognitionSkillV3 object itself. + */ + @Generated + public EntityRecognitionSkillV3 setMinimumPrecision(Double minimumPrecision) { + this.minimumPrecision = minimumPrecision; + return this; + } + + /** + * Get the modelVersion property: The version of the model to use when calling the Text Analytics API. It will + * default to the latest available when not specified. We recommend you do not specify this value unless absolutely + * necessary. + * + * @return the modelVersion value. + */ + @Generated + public String getModelVersion() { + return this.modelVersion; + } + + /** + * Set the modelVersion property: The version of the model to use when calling the Text Analytics API. It will + * default to the latest available when not specified. We recommend you do not specify this value unless absolutely + * necessary. + * + * @param modelVersion the modelVersion value to set. + * @return the EntityRecognitionSkillV3 object itself. + */ + @Generated + public EntityRecognitionSkillV3 setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public EntityRecognitionSkillV3 setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public EntityRecognitionSkillV3 setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public EntityRecognitionSkillV3 setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public EntityRecognitionSkillV3 setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public EntityRecognitionSkillV3 setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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.writeArrayField("categories", this.categories, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("defaultLanguageCode", this.defaultLanguageCode); + jsonWriter.writeNumberField("minimumPrecision", this.minimumPrecision); + jsonWriter.writeStringField("modelVersion", this.modelVersion); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityRecognitionSkillV3 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityRecognitionSkillV3 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 EntityRecognitionSkillV3. + */ + @Generated + public static EntityRecognitionSkillV3 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityRecognitionSkillV3 deserializedEntityRecognitionSkillV3 = new EntityRecognitionSkillV3(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedEntityRecognitionSkillV3.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedEntityRecognitionSkillV3.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedEntityRecognitionSkillV3.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedEntityRecognitionSkillV3.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedEntityRecognitionSkillV3.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedEntityRecognitionSkillV3.odataType = reader.getString(); + } else if ("categories".equals(fieldName)) { + List categories = reader.readArray(reader1 -> reader1.getString()); + deserializedEntityRecognitionSkillV3.categories = categories; + } else if ("defaultLanguageCode".equals(fieldName)) { + deserializedEntityRecognitionSkillV3.defaultLanguageCode = reader.getString(); + } else if ("minimumPrecision".equals(fieldName)) { + deserializedEntityRecognitionSkillV3.minimumPrecision = reader.getNullable(JsonReader::getDouble); + } else if ("modelVersion".equals(fieldName)) { + deserializedEntityRecognitionSkillV3.modelVersion = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityRecognitionSkillV3; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ErrorAdditionalInfo.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ErrorAdditionalInfo.java new file mode 100644 index 000000000000..0072c1e5551f --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ErrorAdditionalInfo.java @@ -0,0 +1,98 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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 resource management error additional info. + */ +@Immutable +public final class ErrorAdditionalInfo implements JsonSerializable { + /* + * The additional info type. + */ + @Generated + private String type; + + /* + * The additional info. + */ + @Generated + private Object info; + + /** + * Creates an instance of ErrorAdditionalInfo class. + */ + @Generated + public ErrorAdditionalInfo() { + } + + /** + * Get the type property: The additional info type. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * Get the info property: The additional info. + * + * @return the info value. + */ + @Generated + public Object getInfo() { + return this.info; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ErrorAdditionalInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ErrorAdditionalInfo 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 ErrorAdditionalInfo. + */ + @Generated + public static ErrorAdditionalInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ErrorAdditionalInfo deserializedErrorAdditionalInfo = new ErrorAdditionalInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedErrorAdditionalInfo.type = reader.getString(); + } else if ("info".equals(fieldName)) { + deserializedErrorAdditionalInfo.info = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedErrorAdditionalInfo; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ErrorDetail.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ErrorDetail.java new file mode 100644 index 000000000000..f446cbead840 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ErrorDetail.java @@ -0,0 +1,156 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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 error detail. + */ +@Immutable +public final class ErrorDetail implements JsonSerializable { + /* + * The error code. + */ + @Generated + private String code; + + /* + * The error message. + */ + @Generated + private String message; + + /* + * The error target. + */ + @Generated + private String target; + + /* + * The error details. + */ + @Generated + private List details; + + /* + * The error additional info. + */ + @Generated + private List additionalInfo; + + /** + * Creates an instance of ErrorDetail class. + */ + @Generated + public ErrorDetail() { + } + + /** + * Get the code property: The error code. + * + * @return the code value. + */ + @Generated + public String getCode() { + return this.code; + } + + /** + * Get the message property: The error message. + * + * @return the message value. + */ + @Generated + public String getMessage() { + return this.message; + } + + /** + * Get the target property: The error target. + * + * @return the target value. + */ + @Generated + public String getTarget() { + return this.target; + } + + /** + * Get the details property: The error details. + * + * @return the details value. + */ + @Generated + public List getDetails() { + return this.details; + } + + /** + * Get the additionalInfo property: The error additional info. + * + * @return the additionalInfo value. + */ + @Generated + public List getAdditionalInfo() { + return this.additionalInfo; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ErrorDetail from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ErrorDetail 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 ErrorDetail. + */ + @Generated + public static ErrorDetail fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ErrorDetail deserializedErrorDetail = new ErrorDetail(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedErrorDetail.code = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedErrorDetail.message = reader.getString(); + } else if ("target".equals(fieldName)) { + deserializedErrorDetail.target = reader.getString(); + } else if ("details".equals(fieldName)) { + List details = reader.readArray(reader1 -> ErrorDetail.fromJson(reader1)); + deserializedErrorDetail.details = details; + } else if ("additionalInfo".equals(fieldName)) { + List additionalInfo + = reader.readArray(reader1 -> ErrorAdditionalInfo.fromJson(reader1)); + deserializedErrorDetail.additionalInfo = additionalInfo; + } else { + reader.skipChildren(); + } + } + + return deserializedErrorDetail; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ErrorResponse.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ErrorResponse.java new file mode 100644 index 000000000000..6f0b609500a4 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ErrorResponse.java @@ -0,0 +1,96 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Error response + * + * Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also + * follows the OData error response format.). + */ +@Fluent +public final class ErrorResponse implements JsonSerializable { + /* + * The error object. + */ + @Generated + private ErrorDetail error; + + /** + * Creates an instance of ErrorResponse class. + */ + @Generated + public ErrorResponse() { + } + + /** + * Get the error property: The error object. + * + * @return the error value. + */ + @Generated + public ErrorDetail getError() { + return this.error; + } + + /** + * Set the error property: The error object. + * + * @param error the error value to set. + * @return the ErrorResponse object itself. + */ + @Generated + public ErrorResponse setError(ErrorDetail error) { + this.error = error; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("error", this.error); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ErrorResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ErrorResponse 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 ErrorResponse. + */ + @Generated + public static ErrorResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ErrorResponse deserializedErrorResponse = new ErrorResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("error".equals(fieldName)) { + deserializedErrorResponse.error = ErrorDetail.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedErrorResponse; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ErrorResponseException.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ErrorResponseException.java new file mode 100644 index 000000000000..359d3f7c4093 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ErrorResponseException.java @@ -0,0 +1,43 @@ +// 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.models; + +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.HttpResponse; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public final class ErrorResponseException extends HttpResponseException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + */ + public ErrorResponseException(String message, HttpResponse response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + * @param value the deserialized response value. + */ + public ErrorResponseException(String message, HttpResponse response, ErrorResponse value) { + super(message, response, value); + } + + /** + * {@inheritDoc} + */ + @Override + public ErrorResponse getValue() { + return (ErrorResponse) super.getValue(); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ExhaustiveKnnAlgorithmConfiguration.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ExhaustiveKnnAlgorithmConfiguration.java new file mode 100644 index 000000000000..8c69f4f8c8e9 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ExhaustiveKnnAlgorithmConfiguration.java @@ -0,0 +1,130 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Contains configuration options specific to the exhaustive KNN algorithm used during querying, which will perform + * brute-force search across the entire vector index. + */ +@Fluent +public final class ExhaustiveKnnAlgorithmConfiguration extends VectorSearchAlgorithmConfiguration { + /* + * The name of the kind of algorithm being configured for use with vector search. + */ + @Generated + private VectorSearchAlgorithmKind kind = VectorSearchAlgorithmKind.EXHAUSTIVE_KNN; + + /* + * Contains the parameters specific to exhaustive KNN algorithm. + */ + @Generated + private ExhaustiveKnnParameters parameters; + + /** + * Creates an instance of ExhaustiveKnnAlgorithmConfiguration class. + */ + @Generated + public ExhaustiveKnnAlgorithmConfiguration() { + } + + /** + * Get the kind property: The name of the kind of algorithm being configured for use with vector search. + * + * @return the kind value. + */ + @Generated + @Override + public VectorSearchAlgorithmKind getKind() { + return this.kind; + } + + /** + * Get the parameters property: Contains the parameters specific to exhaustive KNN algorithm. + * + * @return the parameters value. + */ + @Generated + public ExhaustiveKnnParameters getParameters() { + return this.parameters; + } + + /** + * Set the parameters property: Contains the parameters specific to exhaustive KNN algorithm. + * + * @param parameters the parameters value to set. + * @return the ExhaustiveKnnAlgorithmConfiguration object itself. + */ + @Generated + public ExhaustiveKnnAlgorithmConfiguration setParameters(ExhaustiveKnnParameters parameters) { + this.parameters = parameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ExhaustiveKnnAlgorithmConfiguration setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("exhaustiveKnnParameters", this.parameters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExhaustiveKnnAlgorithmConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExhaustiveKnnAlgorithmConfiguration 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 ExhaustiveKnnAlgorithmConfiguration. + */ + @Generated + public static ExhaustiveKnnAlgorithmConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExhaustiveKnnAlgorithmConfiguration deserializedExhaustiveKnnAlgorithmConfiguration + = new ExhaustiveKnnAlgorithmConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedExhaustiveKnnAlgorithmConfiguration.setName(reader.getString()); + } else if ("kind".equals(fieldName)) { + deserializedExhaustiveKnnAlgorithmConfiguration.kind + = VectorSearchAlgorithmKind.fromString(reader.getString()); + } else if ("exhaustiveKnnParameters".equals(fieldName)) { + deserializedExhaustiveKnnAlgorithmConfiguration.parameters + = ExhaustiveKnnParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedExhaustiveKnnAlgorithmConfiguration; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ExhaustiveKnnParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ExhaustiveKnnParameters.java new file mode 100644 index 000000000000..380911500946 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ExhaustiveKnnParameters.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 the parameters specific to exhaustive KNN algorithm. + */ +@Fluent +public final class ExhaustiveKnnParameters implements JsonSerializable { + /* + * The similarity metric to use for vector comparisons. + */ + @Generated + private VectorSearchAlgorithmMetric metric; + + /** + * Creates an instance of ExhaustiveKnnParameters class. + */ + @Generated + public ExhaustiveKnnParameters() { + } + + /** + * Get the metric property: The similarity metric to use for vector comparisons. + * + * @return the metric value. + */ + @Generated + public VectorSearchAlgorithmMetric getMetric() { + return this.metric; + } + + /** + * Set the metric property: The similarity metric to use for vector comparisons. + * + * @param metric the metric value to set. + * @return the ExhaustiveKnnParameters object itself. + */ + @Generated + public ExhaustiveKnnParameters setMetric(VectorSearchAlgorithmMetric metric) { + this.metric = metric; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("metric", this.metric == null ? null : this.metric.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExhaustiveKnnParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExhaustiveKnnParameters 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 ExhaustiveKnnParameters. + */ + @Generated + public static ExhaustiveKnnParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExhaustiveKnnParameters deserializedExhaustiveKnnParameters = new ExhaustiveKnnParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("metric".equals(fieldName)) { + deserializedExhaustiveKnnParameters.metric + = VectorSearchAlgorithmMetric.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedExhaustiveKnnParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FacetResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FacetResult.java new file mode 100644 index 000000000000..c918863a6362 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FacetResult.java @@ -0,0 +1,239 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * A single bucket of a facet query result. Reports the number of documents with a field value falling within a + * particular range or having a particular value or interval. + */ +@Fluent +public final class FacetResult implements JsonSerializable { + /* + * The approximate count of documents falling within the bucket described by this facet. + */ + @Generated + private Long count; + + /* + * The resulting total avg for the facet when a avg metric is requested. + */ + @Generated + private Double avg; + + /* + * The resulting total min for the facet when a min metric is requested. + */ + @Generated + private Double min; + + /* + * The resulting total max for the facet when a max metric is requested. + */ + @Generated + private Double max; + + /* + * The resulting total sum for the facet when a sum metric is requested. + */ + @Generated + private Double sum; + + /* + * The resulting total cardinality for the facet when a cardinality metric is requested. + */ + @Generated + private Long cardinality; + + /* + * The nested facet query results for the search operation, organized as a collection of buckets for each faceted + * field; null if the query did not contain any nested facets. + */ + @Generated + private Map> facets; + + /* + * A single bucket of a facet query result. Reports the number of documents with a field value falling within a + * particular range or having a particular value or interval. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of FacetResult class. + */ + @Generated + public FacetResult() { + } + + /** + * Get the count property: The approximate count of documents falling within the bucket described by this facet. + * + * @return the count value. + */ + @Generated + public Long getCount() { + return this.count; + } + + /** + * Get the avg property: The resulting total avg for the facet when a avg metric is requested. + * + * @return the avg value. + */ + @Generated + public Double getAvg() { + return this.avg; + } + + /** + * Get the min property: The resulting total min for the facet when a min metric is requested. + * + * @return the min value. + */ + @Generated + public Double getMin() { + return this.min; + } + + /** + * Get the max property: The resulting total max for the facet when a max metric is requested. + * + * @return the max value. + */ + @Generated + public Double getMax() { + return this.max; + } + + /** + * Get the sum property: The resulting total sum for the facet when a sum metric is requested. + * + * @return the sum value. + */ + @Generated + public Double getSum() { + return this.sum; + } + + /** + * Get the cardinality property: The resulting total cardinality for the facet when a cardinality metric is + * requested. + * + * @return the cardinality value. + */ + @Generated + public Long getCardinality() { + return this.cardinality; + } + + /** + * Get the facets property: The nested facet query results for the search operation, organized as a collection of + * buckets for each faceted field; null if the query did not contain any nested facets. + * + * @return the facets value. + */ + @Generated + public Map> getFacets() { + return this.facets; + } + + /** + * Get the additionalProperties property: A single bucket of a facet query result. Reports the number of documents + * with a field value falling within a particular range or having a particular value or interval. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: A single bucket of a facet query result. Reports the number of documents + * with a field value falling within a particular range or having a particular value or interval. + * + * @param additionalProperties the additionalProperties value to set. + * @return the FacetResult object itself. + */ + @Generated + public FacetResult setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FacetResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FacetResult 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 FacetResult. + */ + @Generated + public static FacetResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FacetResult deserializedFacetResult = new FacetResult(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("count".equals(fieldName)) { + deserializedFacetResult.count = reader.getNullable(JsonReader::getLong); + } else if ("avg".equals(fieldName)) { + deserializedFacetResult.avg = reader.getNullable(JsonReader::getDouble); + } else if ("min".equals(fieldName)) { + deserializedFacetResult.min = reader.getNullable(JsonReader::getDouble); + } else if ("max".equals(fieldName)) { + deserializedFacetResult.max = reader.getNullable(JsonReader::getDouble); + } else if ("sum".equals(fieldName)) { + deserializedFacetResult.sum = reader.getNullable(JsonReader::getDouble); + } else if ("cardinality".equals(fieldName)) { + deserializedFacetResult.cardinality = reader.getNullable(JsonReader::getLong); + } else if ("@search.facets".equals(fieldName)) { + Map> facets + = reader.readMap(reader1 -> reader1.readArray(reader2 -> FacetResult.fromJson(reader2))); + deserializedFacetResult.facets = facets; + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedFacetResult.additionalProperties = additionalProperties; + + return deserializedFacetResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FieldMapping.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FieldMapping.java new file mode 100644 index 000000000000..538b5387d532 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FieldMapping.java @@ -0,0 +1,158 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines a mapping between a field in a data source and a target field in an index. + */ +@Fluent +public final class FieldMapping implements JsonSerializable { + /* + * The name of the field in the data source. + */ + @Generated + private String sourceFieldName; + + /* + * The name of the target field in the index. Same as the source field name by default. + */ + @Generated + private String targetFieldName; + + /* + * A function to apply to each source field value before indexing. + */ + @Generated + private FieldMappingFunction mappingFunction; + + /** + * Creates an instance of FieldMapping class. + */ + @Generated + public FieldMapping() { + } + + /** + * Get the sourceFieldName property: The name of the field in the data source. + * + * @return the sourceFieldName value. + */ + @Generated + public String getSourceFieldName() { + return this.sourceFieldName; + } + + /** + * Set the sourceFieldName property: The name of the field in the data source. + * + * @param sourceFieldName the sourceFieldName value to set. + * @return the FieldMapping object itself. + */ + @Generated + public FieldMapping setSourceFieldName(String sourceFieldName) { + this.sourceFieldName = sourceFieldName; + return this; + } + + /** + * Get the targetFieldName property: The name of the target field in the index. Same as the source field name by + * default. + * + * @return the targetFieldName value. + */ + @Generated + public String getTargetFieldName() { + return this.targetFieldName; + } + + /** + * Set the targetFieldName property: The name of the target field in the index. Same as the source field name by + * default. + * + * @param targetFieldName the targetFieldName value to set. + * @return the FieldMapping object itself. + */ + @Generated + public FieldMapping setTargetFieldName(String targetFieldName) { + this.targetFieldName = targetFieldName; + return this; + } + + /** + * Get the mappingFunction property: A function to apply to each source field value before indexing. + * + * @return the mappingFunction value. + */ + @Generated + public FieldMappingFunction getMappingFunction() { + return this.mappingFunction; + } + + /** + * Set the mappingFunction property: A function to apply to each source field value before indexing. + * + * @param mappingFunction the mappingFunction value to set. + * @return the FieldMapping object itself. + */ + @Generated + public FieldMapping setMappingFunction(FieldMappingFunction mappingFunction) { + this.mappingFunction = mappingFunction; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("sourceFieldName", this.sourceFieldName); + jsonWriter.writeStringField("targetFieldName", this.targetFieldName); + jsonWriter.writeJsonField("mappingFunction", this.mappingFunction); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FieldMapping from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FieldMapping 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 FieldMapping. + */ + @Generated + public static FieldMapping fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FieldMapping deserializedFieldMapping = new FieldMapping(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceFieldName".equals(fieldName)) { + deserializedFieldMapping.sourceFieldName = reader.getString(); + } else if ("targetFieldName".equals(fieldName)) { + deserializedFieldMapping.targetFieldName = reader.getString(); + } else if ("mappingFunction".equals(fieldName)) { + deserializedFieldMapping.mappingFunction = FieldMappingFunction.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFieldMapping; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FieldMappingFunction.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FieldMappingFunction.java new file mode 100644 index 000000000000..05088abebeab --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FieldMappingFunction.java @@ -0,0 +1,129 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.Map; + +/** + * Represents a function that transforms a value from a data source before indexing. + */ +@Fluent +public final class FieldMappingFunction implements JsonSerializable { + /* + * The name of the field mapping function. + */ + @Generated + private String name; + + /* + * A dictionary of parameter name/value pairs to pass to the function. Each value must be of a primitive type. + */ + @Generated + private Map parameters; + + /** + * Creates an instance of FieldMappingFunction class. + */ + @Generated + public FieldMappingFunction() { + } + + /** + * Get the name property: The name of the field mapping function. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the field mapping function. + * + * @param name the name value to set. + * @return the FieldMappingFunction object itself. + */ + @Generated + public FieldMappingFunction setName(String name) { + this.name = name; + return this; + } + + /** + * Get the parameters property: A dictionary of parameter name/value pairs to pass to the function. Each value must + * be of a primitive type. + * + * @return the parameters value. + */ + @Generated + public Map getParameters() { + return this.parameters; + } + + /** + * Set the parameters property: A dictionary of parameter name/value pairs to pass to the function. Each value must + * be of a primitive type. + * + * @param parameters the parameters value to set. + * @return the FieldMappingFunction object itself. + */ + @Generated + public FieldMappingFunction setParameters(Map parameters) { + this.parameters = parameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeMapField("parameters", this.parameters, (writer, element) -> writer.writeUntyped(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FieldMappingFunction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FieldMappingFunction 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 FieldMappingFunction. + */ + @Generated + public static FieldMappingFunction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FieldMappingFunction deserializedFieldMappingFunction = new FieldMappingFunction(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedFieldMappingFunction.name = reader.getString(); + } else if ("parameters".equals(fieldName)) { + Map parameters = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedFieldMappingFunction.parameters = parameters; + } else { + reader.skipChildren(); + } + } + + return deserializedFieldMappingFunction; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FreshnessScoringFunction.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FreshnessScoringFunction.java new file mode 100644 index 000000000000..de0aecc8df58 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FreshnessScoringFunction.java @@ -0,0 +1,155 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines a function that boosts scores based on the value of a date-time field. + */ +@Fluent +public final class FreshnessScoringFunction extends ScoringFunction { + /* + * Indicates the type of function to use. Valid values include magnitude, freshness, distance, and tag. The function + * type must be lower case. + */ + @Generated + private String type = "freshness"; + + /* + * Parameter values for the freshness scoring function. + */ + @Generated + private FreshnessScoringParameters parameters; + + /** + * Creates an instance of FreshnessScoringFunction class. + */ + @Generated + public FreshnessScoringFunction() { + } + + /** + * Get the type property: Indicates the type of function to use. Valid values include magnitude, freshness, + * distance, and tag. The function type must be lower case. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the parameters property: Parameter values for the freshness scoring function. + * + * @return the parameters value. + */ + @Generated + public FreshnessScoringParameters getParameters() { + return this.parameters; + } + + /** + * Set the parameters property: Parameter values for the freshness scoring function. + * + * @param parameters the parameters value to set. + * @return the FreshnessScoringFunction object itself. + */ + @Generated + public FreshnessScoringFunction setParameters(FreshnessScoringParameters parameters) { + this.parameters = parameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public FreshnessScoringFunction setFieldName(String fieldName) { + super.setFieldName(fieldName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public FreshnessScoringFunction setBoost(double boost) { + super.setBoost(boost); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public FreshnessScoringFunction setInterpolation(ScoringFunctionInterpolation interpolation) { + super.setInterpolation(interpolation); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("fieldName", getFieldName()); + jsonWriter.writeDoubleField("boost", getBoost()); + jsonWriter.writeStringField("interpolation", getInterpolation() == null ? null : getInterpolation().toString()); + jsonWriter.writeJsonField("freshness", this.parameters); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FreshnessScoringFunction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FreshnessScoringFunction 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 FreshnessScoringFunction. + */ + @Generated + public static FreshnessScoringFunction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FreshnessScoringFunction deserializedFreshnessScoringFunction = new FreshnessScoringFunction(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String jsonFieldName = reader.getFieldName(); + reader.nextToken(); + + if ("fieldName".equals(jsonFieldName)) { + deserializedFreshnessScoringFunction.setFieldName(reader.getString()); + } else if ("boost".equals(jsonFieldName)) { + deserializedFreshnessScoringFunction.setBoost(reader.getDouble()); + } else if ("interpolation".equals(jsonFieldName)) { + deserializedFreshnessScoringFunction + .setInterpolation(ScoringFunctionInterpolation.fromString(reader.getString())); + } else if ("freshness".equals(jsonFieldName)) { + deserializedFreshnessScoringFunction.parameters = FreshnessScoringParameters.fromJson(reader); + } else if ("type".equals(jsonFieldName)) { + deserializedFreshnessScoringFunction.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFreshnessScoringFunction; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FreshnessScoringParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FreshnessScoringParameters.java new file mode 100644 index 000000000000..536d3261ad22 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/FreshnessScoringParameters.java @@ -0,0 +1,99 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Provides parameter values to a freshness scoring function. + */ +@Fluent +public final class FreshnessScoringParameters implements JsonSerializable { + /* + * The expiration period after which boosting will stop for a particular document. + */ + @Generated + private Duration boostingDuration; + + /** + * Creates an instance of FreshnessScoringParameters class. + */ + @Generated + public FreshnessScoringParameters() { + } + + /** + * Get the boostingDuration property: The expiration period after which boosting will stop for a particular + * document. + * + * @return the boostingDuration value. + */ + @Generated + public Duration getBoostingDuration() { + return this.boostingDuration; + } + + /** + * Set the boostingDuration property: The expiration period after which boosting will stop for a particular + * document. + * + * @param boostingDuration the boostingDuration value to set. + * @return the FreshnessScoringParameters object itself. + */ + @Generated + public FreshnessScoringParameters setBoostingDuration(Duration boostingDuration) { + this.boostingDuration = boostingDuration; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("boostingDuration", CoreUtils.durationToStringWithDays(this.boostingDuration)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FreshnessScoringParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FreshnessScoringParameters 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 FreshnessScoringParameters. + */ + @Generated + public static FreshnessScoringParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FreshnessScoringParameters deserializedFreshnessScoringParameters = new FreshnessScoringParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("boostingDuration".equals(fieldName)) { + deserializedFreshnessScoringParameters.boostingDuration + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedFreshnessScoringParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/GetIndexStatisticsResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/GetIndexStatisticsResult.java new file mode 100644 index 000000000000..35021e45d340 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/GetIndexStatisticsResult.java @@ -0,0 +1,117 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Statistics for a given index. Statistics are collected periodically and are not guaranteed to always be up-to-date. + */ +@Immutable +public final class GetIndexStatisticsResult implements JsonSerializable { + /* + * The number of documents in the index. + */ + @Generated + private long documentCount; + + /* + * The amount of storage in bytes consumed by the index. + */ + @Generated + private long storageSize; + + /* + * The amount of memory in bytes consumed by vectors in the index. + */ + @Generated + private long vectorIndexSize; + + /** + * Creates an instance of GetIndexStatisticsResult class. + */ + @Generated + public GetIndexStatisticsResult() { + } + + /** + * Get the documentCount property: The number of documents in the index. + * + * @return the documentCount value. + */ + @Generated + public long getDocumentCount() { + return this.documentCount; + } + + /** + * Get the storageSize property: The amount of storage in bytes consumed by the index. + * + * @return the storageSize value. + */ + @Generated + public long getStorageSize() { + return this.storageSize; + } + + /** + * Get the vectorIndexSize property: The amount of memory in bytes consumed by vectors in the index. + * + * @return the vectorIndexSize value. + */ + @Generated + public long getVectorIndexSize() { + return this.vectorIndexSize; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetIndexStatisticsResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetIndexStatisticsResult 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 GetIndexStatisticsResult. + */ + @Generated + public static GetIndexStatisticsResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetIndexStatisticsResult deserializedGetIndexStatisticsResult = new GetIndexStatisticsResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("documentCount".equals(fieldName)) { + deserializedGetIndexStatisticsResult.documentCount = reader.getLong(); + } else if ("storageSize".equals(fieldName)) { + deserializedGetIndexStatisticsResult.storageSize = reader.getLong(); + } else if ("vectorIndexSize".equals(fieldName)) { + deserializedGetIndexStatisticsResult.vectorIndexSize = reader.getLong(); + } else { + reader.skipChildren(); + } + } + + return deserializedGetIndexStatisticsResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HighWaterMarkChangeDetectionPolicy.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HighWaterMarkChangeDetectionPolicy.java new file mode 100644 index 000000000000..db2f1327aaa7 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HighWaterMarkChangeDetectionPolicy.java @@ -0,0 +1,114 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines a data change detection policy that captures changes based on the value of a high water mark column. + */ +@Fluent +public final class HighWaterMarkChangeDetectionPolicy extends DataChangeDetectionPolicy { + /* + * A URI fragment specifying the type of data change detection policy. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.HighWaterMarkChangeDetectionPolicy"; + + /* + * The name of the high water mark column. + */ + @Generated + private String highWaterMarkColumnName; + + /** + * Creates an instance of HighWaterMarkChangeDetectionPolicy class. + */ + @Generated + public HighWaterMarkChangeDetectionPolicy() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of data change detection policy. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the highWaterMarkColumnName property: The name of the high water mark column. + * + * @return the highWaterMarkColumnName value. + */ + @Generated + public String getHighWaterMarkColumnName() { + return this.highWaterMarkColumnName; + } + + /** + * Set the highWaterMarkColumnName property: The name of the high water mark column. + * + * @param highWaterMarkColumnName the highWaterMarkColumnName value to set. + * @return the HighWaterMarkChangeDetectionPolicy object itself. + */ + @Generated + public HighWaterMarkChangeDetectionPolicy setHighWaterMarkColumnName(String highWaterMarkColumnName) { + this.highWaterMarkColumnName = highWaterMarkColumnName; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("highWaterMarkColumnName", this.highWaterMarkColumnName); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HighWaterMarkChangeDetectionPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HighWaterMarkChangeDetectionPolicy 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 HighWaterMarkChangeDetectionPolicy. + */ + @Generated + public static HighWaterMarkChangeDetectionPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HighWaterMarkChangeDetectionPolicy deserializedHighWaterMarkChangeDetectionPolicy + = new HighWaterMarkChangeDetectionPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("highWaterMarkColumnName".equals(fieldName)) { + deserializedHighWaterMarkChangeDetectionPolicy.highWaterMarkColumnName = reader.getString(); + } else if ("@odata.type".equals(fieldName)) { + deserializedHighWaterMarkChangeDetectionPolicy.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedHighWaterMarkChangeDetectionPolicy; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HnswAlgorithmConfiguration.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HnswAlgorithmConfiguration.java new file mode 100644 index 000000000000..0753533a146d --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HnswAlgorithmConfiguration.java @@ -0,0 +1,128 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Contains configuration options specific to the HNSW approximate nearest neighbors algorithm used during indexing and + * querying. The HNSW algorithm offers a tunable trade-off between search speed and accuracy. + */ +@Fluent +public final class HnswAlgorithmConfiguration extends VectorSearchAlgorithmConfiguration { + /* + * The name of the kind of algorithm being configured for use with vector search. + */ + @Generated + private VectorSearchAlgorithmKind kind = VectorSearchAlgorithmKind.HNSW; + + /* + * Contains the parameters specific to HNSW algorithm. + */ + @Generated + private HnswParameters parameters; + + /** + * Creates an instance of HnswAlgorithmConfiguration class. + */ + @Generated + public HnswAlgorithmConfiguration() { + } + + /** + * Get the kind property: The name of the kind of algorithm being configured for use with vector search. + * + * @return the kind value. + */ + @Generated + @Override + public VectorSearchAlgorithmKind getKind() { + return this.kind; + } + + /** + * Get the parameters property: Contains the parameters specific to HNSW algorithm. + * + * @return the parameters value. + */ + @Generated + public HnswParameters getParameters() { + return this.parameters; + } + + /** + * Set the parameters property: Contains the parameters specific to HNSW algorithm. + * + * @param parameters the parameters value to set. + * @return the HnswAlgorithmConfiguration object itself. + */ + @Generated + public HnswAlgorithmConfiguration setParameters(HnswParameters parameters) { + this.parameters = parameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public HnswAlgorithmConfiguration setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("hnswParameters", this.parameters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HnswAlgorithmConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HnswAlgorithmConfiguration 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 HnswAlgorithmConfiguration. + */ + @Generated + public static HnswAlgorithmConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HnswAlgorithmConfiguration deserializedHnswAlgorithmConfiguration = new HnswAlgorithmConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedHnswAlgorithmConfiguration.setName(reader.getString()); + } else if ("kind".equals(fieldName)) { + deserializedHnswAlgorithmConfiguration.kind + = VectorSearchAlgorithmKind.fromString(reader.getString()); + } else if ("hnswParameters".equals(fieldName)) { + deserializedHnswAlgorithmConfiguration.parameters = HnswParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedHnswAlgorithmConfiguration; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HnswParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HnswParameters.java new file mode 100644 index 000000000000..b70d2aa2b360 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HnswParameters.java @@ -0,0 +1,204 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 the parameters specific to the HNSW algorithm. + */ +@Fluent +public final class HnswParameters implements JsonSerializable { + /* + * The number of bi-directional links created for every new element during construction. Increasing this parameter + * value may improve recall and reduce retrieval times for datasets with high intrinsic dimensionality at the + * expense of increased memory consumption and longer indexing time. + */ + @Generated + private Integer m; + + /* + * The size of the dynamic list containing the nearest neighbors, which is used during index time. Increasing this + * parameter may improve index quality, at the expense of increased indexing time. At a certain point, increasing + * this parameter leads to diminishing returns. + */ + @Generated + private Integer efConstruction; + + /* + * The size of the dynamic list containing the nearest neighbors, which is used during search time. Increasing this + * parameter may improve search results, at the expense of slower search. At a certain point, increasing this + * parameter leads to diminishing returns. + */ + @Generated + private Integer efSearch; + + /* + * The similarity metric to use for vector comparisons. + */ + @Generated + private VectorSearchAlgorithmMetric metric; + + /** + * Creates an instance of HnswParameters class. + */ + @Generated + public HnswParameters() { + } + + /** + * Get the m property: The number of bi-directional links created for every new element during construction. + * Increasing this parameter value may improve recall and reduce retrieval times for datasets with high intrinsic + * dimensionality at the expense of increased memory consumption and longer indexing time. + * + * @return the m value. + */ + @Generated + public Integer getM() { + return this.m; + } + + /** + * Set the m property: The number of bi-directional links created for every new element during construction. + * Increasing this parameter value may improve recall and reduce retrieval times for datasets with high intrinsic + * dimensionality at the expense of increased memory consumption and longer indexing time. + * + * @param m the m value to set. + * @return the HnswParameters object itself. + */ + @Generated + public HnswParameters setM(Integer m) { + this.m = m; + return this; + } + + /** + * Get the efConstruction property: The size of the dynamic list containing the nearest neighbors, which is used + * during index time. Increasing this parameter may improve index quality, at the expense of increased indexing + * time. At a certain point, increasing this parameter leads to diminishing returns. + * + * @return the efConstruction value. + */ + @Generated + public Integer getEfConstruction() { + return this.efConstruction; + } + + /** + * Set the efConstruction property: The size of the dynamic list containing the nearest neighbors, which is used + * during index time. Increasing this parameter may improve index quality, at the expense of increased indexing + * time. At a certain point, increasing this parameter leads to diminishing returns. + * + * @param efConstruction the efConstruction value to set. + * @return the HnswParameters object itself. + */ + @Generated + public HnswParameters setEfConstruction(Integer efConstruction) { + this.efConstruction = efConstruction; + return this; + } + + /** + * Get the efSearch property: The size of the dynamic list containing the nearest neighbors, which is used during + * search time. Increasing this parameter may improve search results, at the expense of slower search. At a certain + * point, increasing this parameter leads to diminishing returns. + * + * @return the efSearch value. + */ + @Generated + public Integer getEfSearch() { + return this.efSearch; + } + + /** + * Set the efSearch property: The size of the dynamic list containing the nearest neighbors, which is used during + * search time. Increasing this parameter may improve search results, at the expense of slower search. At a certain + * point, increasing this parameter leads to diminishing returns. + * + * @param efSearch the efSearch value to set. + * @return the HnswParameters object itself. + */ + @Generated + public HnswParameters setEfSearch(Integer efSearch) { + this.efSearch = efSearch; + return this; + } + + /** + * Get the metric property: The similarity metric to use for vector comparisons. + * + * @return the metric value. + */ + @Generated + public VectorSearchAlgorithmMetric getMetric() { + return this.metric; + } + + /** + * Set the metric property: The similarity metric to use for vector comparisons. + * + * @param metric the metric value to set. + * @return the HnswParameters object itself. + */ + @Generated + public HnswParameters setMetric(VectorSearchAlgorithmMetric metric) { + this.metric = metric; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("m", this.m); + jsonWriter.writeNumberField("efConstruction", this.efConstruction); + jsonWriter.writeNumberField("efSearch", this.efSearch); + jsonWriter.writeStringField("metric", this.metric == null ? null : this.metric.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HnswParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HnswParameters 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 HnswParameters. + */ + @Generated + public static HnswParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HnswParameters deserializedHnswParameters = new HnswParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("m".equals(fieldName)) { + deserializedHnswParameters.m = reader.getNullable(JsonReader::getInt); + } else if ("efConstruction".equals(fieldName)) { + deserializedHnswParameters.efConstruction = reader.getNullable(JsonReader::getInt); + } else if ("efSearch".equals(fieldName)) { + deserializedHnswParameters.efSearch = reader.getNullable(JsonReader::getInt); + } else if ("metric".equals(fieldName)) { + deserializedHnswParameters.metric = VectorSearchAlgorithmMetric.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedHnswParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HybridCountAndFacetMode.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HybridCountAndFacetMode.java new file mode 100644 index 000000000000..eb1c229eff25 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HybridCountAndFacetMode.java @@ -0,0 +1,61 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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'. + */ + @Generated + 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. + */ + @Generated + public static final HybridCountAndFacetMode COUNT_ALL_RESULTS = fromString("countAllResults"); + + /** + * Creates a new instance of HybridCountAndFacetMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public HybridCountAndFacetMode() { + } + + /** + * Creates or finds a HybridCountAndFacetMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding HybridCountAndFacetMode. + */ + @Generated + public static HybridCountAndFacetMode fromString(String name) { + return fromString(name, HybridCountAndFacetMode.class); + } + + /** + * Gets known HybridCountAndFacetMode values. + * + * @return known HybridCountAndFacetMode values. + */ + @Generated + public static Collection values() { + return values(HybridCountAndFacetMode.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HybridSearch.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HybridSearch.java new file mode 100644 index 000000000000..928e5323f839 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/HybridSearch.java @@ -0,0 +1,140 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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. + */ + @Generated + 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. + */ + @Generated + private HybridCountAndFacetMode countAndFacetMode; + + /** + * Creates an instance of HybridSearch class. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + public HybridSearch setCountAndFacetMode(HybridCountAndFacetMode countAndFacetMode) { + this.countAndFacetMode = countAndFacetMode; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + 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/search/src/main/java/com/azure/search/models/ImageAnalysisSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ImageAnalysisSkill.java new file mode 100644 index 000000000000..44a3c9ef490c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ImageAnalysisSkill.java @@ -0,0 +1,253 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A skill that analyzes image files. It extracts a rich set of visual features based on the image content. + */ +@Fluent +public final class ImageAnalysisSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Vision.ImageAnalysisSkill"; + + /* + * A value indicating which language code to use. Default is `en`. + */ + @Generated + private ImageAnalysisSkillLanguage defaultLanguageCode; + + /* + * A list of visual features. + */ + @Generated + private List visualFeatures; + + /* + * A string indicating which domain-specific details to return. + */ + @Generated + private List details; + + /** + * Creates an instance of ImageAnalysisSkill class. + */ + @Generated + public ImageAnalysisSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @return the defaultLanguageCode value. + */ + @Generated + public ImageAnalysisSkillLanguage getDefaultLanguageCode() { + return this.defaultLanguageCode; + } + + /** + * Set the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @param defaultLanguageCode the defaultLanguageCode value to set. + * @return the ImageAnalysisSkill object itself. + */ + @Generated + public ImageAnalysisSkill setDefaultLanguageCode(ImageAnalysisSkillLanguage defaultLanguageCode) { + this.defaultLanguageCode = defaultLanguageCode; + return this; + } + + /** + * Get the visualFeatures property: A list of visual features. + * + * @return the visualFeatures value. + */ + @Generated + public List getVisualFeatures() { + return this.visualFeatures; + } + + /** + * Set the visualFeatures property: A list of visual features. + * + * @param visualFeatures the visualFeatures value to set. + * @return the ImageAnalysisSkill object itself. + */ + @Generated + public ImageAnalysisSkill setVisualFeatures(List visualFeatures) { + this.visualFeatures = visualFeatures; + return this; + } + + /** + * Get the details property: A string indicating which domain-specific details to return. + * + * @return the details value. + */ + @Generated + public List getDetails() { + return this.details; + } + + /** + * Set the details property: A string indicating which domain-specific details to return. + * + * @param details the details value to set. + * @return the ImageAnalysisSkill object itself. + */ + @Generated + public ImageAnalysisSkill setDetails(List details) { + this.details = details; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ImageAnalysisSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ImageAnalysisSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ImageAnalysisSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ImageAnalysisSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ImageAnalysisSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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("defaultLanguageCode", + this.defaultLanguageCode == null ? null : this.defaultLanguageCode.toString()); + jsonWriter.writeArrayField("visualFeatures", this.visualFeatures, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("details", this.details, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ImageAnalysisSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ImageAnalysisSkill 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 ImageAnalysisSkill. + */ + @Generated + public static ImageAnalysisSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ImageAnalysisSkill deserializedImageAnalysisSkill = new ImageAnalysisSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedImageAnalysisSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedImageAnalysisSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedImageAnalysisSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedImageAnalysisSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedImageAnalysisSkill.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedImageAnalysisSkill.odataType = reader.getString(); + } else if ("defaultLanguageCode".equals(fieldName)) { + deserializedImageAnalysisSkill.defaultLanguageCode + = ImageAnalysisSkillLanguage.fromString(reader.getString()); + } else if ("visualFeatures".equals(fieldName)) { + List visualFeatures + = reader.readArray(reader1 -> VisualFeature.fromString(reader1.getString())); + deserializedImageAnalysisSkill.visualFeatures = visualFeatures; + } else if ("details".equals(fieldName)) { + List details + = reader.readArray(reader1 -> ImageDetail.fromString(reader1.getString())); + deserializedImageAnalysisSkill.details = details; + } else { + reader.skipChildren(); + } + } + + return deserializedImageAnalysisSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ImageAnalysisSkillLanguage.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ImageAnalysisSkillLanguage.java new file mode 100644 index 000000000000..252def01f493 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ImageAnalysisSkillLanguage.java @@ -0,0 +1,358 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The language codes supported for input by ImageAnalysisSkill. + */ +public final class ImageAnalysisSkillLanguage extends ExpandableStringEnum { + /** + * Arabic. + */ + @Generated + public static final ImageAnalysisSkillLanguage AR = fromString("ar"); + + /** + * Azerbaijani. + */ + @Generated + public static final ImageAnalysisSkillLanguage AZ = fromString("az"); + + /** + * Bulgarian. + */ + @Generated + public static final ImageAnalysisSkillLanguage BG = fromString("bg"); + + /** + * Bosnian Latin. + */ + @Generated + public static final ImageAnalysisSkillLanguage BS = fromString("bs"); + + /** + * Catalan. + */ + @Generated + public static final ImageAnalysisSkillLanguage CA = fromString("ca"); + + /** + * Czech. + */ + @Generated + public static final ImageAnalysisSkillLanguage CS = fromString("cs"); + + /** + * Welsh. + */ + @Generated + public static final ImageAnalysisSkillLanguage CY = fromString("cy"); + + /** + * Danish. + */ + @Generated + public static final ImageAnalysisSkillLanguage DA = fromString("da"); + + /** + * German. + */ + @Generated + public static final ImageAnalysisSkillLanguage DE = fromString("de"); + + /** + * Greek. + */ + @Generated + public static final ImageAnalysisSkillLanguage EL = fromString("el"); + + /** + * English. + */ + @Generated + public static final ImageAnalysisSkillLanguage EN = fromString("en"); + + /** + * Spanish. + */ + @Generated + public static final ImageAnalysisSkillLanguage ES = fromString("es"); + + /** + * Estonian. + */ + @Generated + public static final ImageAnalysisSkillLanguage ET = fromString("et"); + + /** + * Basque. + */ + @Generated + public static final ImageAnalysisSkillLanguage EU = fromString("eu"); + + /** + * Finnish. + */ + @Generated + public static final ImageAnalysisSkillLanguage FI = fromString("fi"); + + /** + * French. + */ + @Generated + public static final ImageAnalysisSkillLanguage FR = fromString("fr"); + + /** + * Irish. + */ + @Generated + public static final ImageAnalysisSkillLanguage GA = fromString("ga"); + + /** + * Galician. + */ + @Generated + public static final ImageAnalysisSkillLanguage GL = fromString("gl"); + + /** + * Hebrew. + */ + @Generated + public static final ImageAnalysisSkillLanguage HE = fromString("he"); + + /** + * Hindi. + */ + @Generated + public static final ImageAnalysisSkillLanguage HI = fromString("hi"); + + /** + * Croatian. + */ + @Generated + public static final ImageAnalysisSkillLanguage HR = fromString("hr"); + + /** + * Hungarian. + */ + @Generated + public static final ImageAnalysisSkillLanguage HU = fromString("hu"); + + /** + * Indonesian. + */ + @Generated + public static final ImageAnalysisSkillLanguage ID = fromString("id"); + + /** + * Italian. + */ + @Generated + public static final ImageAnalysisSkillLanguage IT = fromString("it"); + + /** + * Japanese. + */ + @Generated + public static final ImageAnalysisSkillLanguage JA = fromString("ja"); + + /** + * Kazakh. + */ + @Generated + public static final ImageAnalysisSkillLanguage KK = fromString("kk"); + + /** + * Korean. + */ + @Generated + public static final ImageAnalysisSkillLanguage KO = fromString("ko"); + + /** + * Lithuanian. + */ + @Generated + public static final ImageAnalysisSkillLanguage LT = fromString("lt"); + + /** + * Latvian. + */ + @Generated + public static final ImageAnalysisSkillLanguage LV = fromString("lv"); + + /** + * Macedonian. + */ + @Generated + public static final ImageAnalysisSkillLanguage MK = fromString("mk"); + + /** + * Malay Malaysia. + */ + @Generated + public static final ImageAnalysisSkillLanguage MS = fromString("ms"); + + /** + * Norwegian (Bokmal). + */ + @Generated + public static final ImageAnalysisSkillLanguage NB = fromString("nb"); + + /** + * Dutch. + */ + @Generated + public static final ImageAnalysisSkillLanguage NL = fromString("nl"); + + /** + * Polish. + */ + @Generated + public static final ImageAnalysisSkillLanguage PL = fromString("pl"); + + /** + * Dari. + */ + @Generated + public static final ImageAnalysisSkillLanguage PRS = fromString("prs"); + + /** + * Portuguese-Brazil. + */ + @Generated + public static final ImageAnalysisSkillLanguage PT_BR = fromString("pt-BR"); + + /** + * Portuguese-Portugal. + */ + @Generated + public static final ImageAnalysisSkillLanguage PT = fromString("pt"); + + /** + * Portuguese-Portugal. + */ + @Generated + public static final ImageAnalysisSkillLanguage PT_PT = fromString("pt-PT"); + + /** + * Romanian. + */ + @Generated + public static final ImageAnalysisSkillLanguage RO = fromString("ro"); + + /** + * Russian. + */ + @Generated + public static final ImageAnalysisSkillLanguage RU = fromString("ru"); + + /** + * Slovak. + */ + @Generated + public static final ImageAnalysisSkillLanguage SK = fromString("sk"); + + /** + * Slovenian. + */ + @Generated + public static final ImageAnalysisSkillLanguage SL = fromString("sl"); + + /** + * Serbian - Cyrillic RS. + */ + @Generated + public static final ImageAnalysisSkillLanguage SR_CYRL = fromString("sr-Cyrl"); + + /** + * Serbian - Latin RS. + */ + @Generated + public static final ImageAnalysisSkillLanguage SR_LATN = fromString("sr-Latn"); + + /** + * Swedish. + */ + @Generated + public static final ImageAnalysisSkillLanguage SV = fromString("sv"); + + /** + * Thai. + */ + @Generated + public static final ImageAnalysisSkillLanguage TH = fromString("th"); + + /** + * Turkish. + */ + @Generated + public static final ImageAnalysisSkillLanguage TR = fromString("tr"); + + /** + * Ukrainian. + */ + @Generated + public static final ImageAnalysisSkillLanguage UK = fromString("uk"); + + /** + * Vietnamese. + */ + @Generated + public static final ImageAnalysisSkillLanguage VI = fromString("vi"); + + /** + * Chinese Simplified. + */ + @Generated + public static final ImageAnalysisSkillLanguage ZH = fromString("zh"); + + /** + * Chinese Simplified. + */ + @Generated + public static final ImageAnalysisSkillLanguage ZH_HANS = fromString("zh-Hans"); + + /** + * Chinese Traditional. + */ + @Generated + public static final ImageAnalysisSkillLanguage ZH_HANT = fromString("zh-Hant"); + + /** + * Creates a new instance of ImageAnalysisSkillLanguage value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ImageAnalysisSkillLanguage() { + } + + /** + * Creates or finds a ImageAnalysisSkillLanguage from its string representation. + * + * @param name a name to look for. + * @return the corresponding ImageAnalysisSkillLanguage. + */ + @Generated + public static ImageAnalysisSkillLanguage fromString(String name) { + return fromString(name, ImageAnalysisSkillLanguage.class); + } + + /** + * Gets known ImageAnalysisSkillLanguage values. + * + * @return known ImageAnalysisSkillLanguage values. + */ + @Generated + public static Collection values() { + return values(ImageAnalysisSkillLanguage.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ImageDetail.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ImageDetail.java new file mode 100644 index 000000000000..42a78834f853 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ImageDetail.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * A string indicating which domain-specific details to return. + */ +public final class ImageDetail extends ExpandableStringEnum { + /** + * Details recognized as celebrities. + */ + @Generated + public static final ImageDetail CELEBRITIES = fromString("celebrities"); + + /** + * Details recognized as landmarks. + */ + @Generated + public static final ImageDetail LANDMARKS = fromString("landmarks"); + + /** + * Creates a new instance of ImageDetail value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ImageDetail() { + } + + /** + * Creates or finds a ImageDetail from its string representation. + * + * @param name a name to look for. + * @return the corresponding ImageDetail. + */ + @Generated + public static ImageDetail fromString(String name) { + return fromString(name, ImageDetail.class); + } + + /** + * Gets known ImageDetail values. + * + * @return known ImageDetail values. + */ + @Generated + public static Collection values() { + return values(ImageDetail.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexAction.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexAction.java new file mode 100644 index 000000000000..7c34c86171ff --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexAction.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.LinkedHashMap; +import java.util.Map; + +/** + * Represents an index action that operates on a document. + */ +@Fluent +public final class IndexAction implements JsonSerializable { + /* + * The operation to perform on a document in an indexing batch. + */ + @Generated + private IndexActionType actionType; + + /* + * Represents an index action that operates on a document. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of IndexAction class. + */ + @Generated + public IndexAction() { + } + + /** + * Get the actionType property: The operation to perform on a document in an indexing batch. + * + * @return the actionType value. + */ + @Generated + public IndexActionType getActionType() { + return this.actionType; + } + + /** + * Set the actionType property: The operation to perform on a document in an indexing batch. + * + * @param actionType the actionType value to set. + * @return the IndexAction object itself. + */ + @Generated + public IndexAction setActionType(IndexActionType actionType) { + this.actionType = actionType; + return this; + } + + /** + * Get the additionalProperties property: Represents an index action that operates on a document. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: Represents an index action that operates on a document. + * + * @param additionalProperties the additionalProperties value to set. + * @return the IndexAction object itself. + */ + @Generated + public IndexAction setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("@search.action", this.actionType == null ? null : this.actionType.toString()); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexAction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexAction 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 IndexAction. + */ + @Generated + public static IndexAction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndexAction deserializedIndexAction = new IndexAction(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("@search.action".equals(fieldName)) { + deserializedIndexAction.actionType = IndexActionType.fromString(reader.getString()); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedIndexAction.additionalProperties = additionalProperties; + + return deserializedIndexAction; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexActionType.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexActionType.java new file mode 100644 index 000000000000..250456a7f8c4 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexActionType.java @@ -0,0 +1,73 @@ +// 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.models; + +/** + * The operation to perform on a document in an indexing batch. + */ +public enum IndexActionType { + /** + * Inserts the document into the index if it is new and updates it if it exists. All fields are replaced in the + * update case. + */ + UPLOAD("upload"), + + /** + * Merges the specified field values with an existing document. If the document does not exist, the merge will fail. + * Any field you specify in a merge will replace the existing field in the document. This also applies to + * collections of primitive and complex types. + */ + MERGE("merge"), + + /** + * Behaves like merge if a document with the given key already exists in the index. If the document does not exist, + * it behaves like upload with a new document. + */ + MERGE_OR_UPLOAD("mergeOrUpload"), + + /** + * Removes the specified document from the index. Any field you specify in a delete operation other than the key + * field will be ignored. If you want to remove an individual field from a document, use merge instead and set the + * field explicitly to null. + */ + DELETE("delete"); + + /** + * The actual serialized value for a IndexActionType instance. + */ + private final String value; + + IndexActionType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IndexActionType instance. + * + * @param value the serialized value to parse. + * @return the parsed IndexActionType object, or null if unable to parse. + */ + public static IndexActionType fromString(String value) { + if (value == null) { + return null; + } + IndexActionType[] items = IndexActionType.values(); + for (IndexActionType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexBatchImpl.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexBatchImpl.java new file mode 100644 index 000000000000..85534725f3c2 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexBatchImpl.java @@ -0,0 +1,96 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Contains a batch of document write actions to send to the index. + */ +@Fluent +public final class IndexBatchImpl implements JsonSerializable { + /* + * The actions in the batch. + */ + @Generated + private List actions; + + /** + * Creates an instance of IndexBatchImpl class. + */ + @Generated + public IndexBatchImpl() { + } + + /** + * Get the actions property: The actions in the batch. + * + * @return the actions value. + */ + @Generated + public List getActions() { + return this.actions; + } + + /** + * Set the actions property: The actions in the batch. + * + * @param actions the actions value to set. + * @return the IndexBatchImpl object itself. + */ + @Generated + public IndexBatchImpl setActions(List actions) { + this.actions = actions; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.actions, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexBatchImpl from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexBatchImpl 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 IndexBatchImpl. + */ + @Generated + public static IndexBatchImpl fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndexBatchImpl deserializedIndexBatchImpl = new IndexBatchImpl(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List actions = reader.readArray(reader1 -> IndexAction.fromJson(reader1)); + deserializedIndexBatchImpl.actions = actions; + } else { + reader.skipChildren(); + } + } + + return deserializedIndexBatchImpl; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexDocumentsResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexDocumentsResult.java new file mode 100644 index 000000000000..86187cacd779 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexDocumentsResult.java @@ -0,0 +1,83 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Response containing the status of operations for all documents in the indexing request. + */ +@Immutable +public final class IndexDocumentsResult implements JsonSerializable { + /* + * The list of status information for each document in the indexing request. + */ + @Generated + private List results; + + /** + * Creates an instance of IndexDocumentsResult class. + */ + @Generated + public IndexDocumentsResult() { + } + + /** + * Get the results property: The list of status information for each document in the indexing request. + * + * @return the results value. + */ + @Generated + public List getResults() { + return this.results; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexDocumentsResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexDocumentsResult 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 IndexDocumentsResult. + */ + @Generated + public static IndexDocumentsResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndexDocumentsResult deserializedIndexDocumentsResult = new IndexDocumentsResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List results = reader.readArray(reader1 -> IndexingResult.fromJson(reader1)); + deserializedIndexDocumentsResult.results = results; + } else { + reader.skipChildren(); + } + } + + return deserializedIndexDocumentsResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexProjectionMode.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexProjectionMode.java new file mode 100644 index 000000000000..6a7c2d905702 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexProjectionMode.java @@ -0,0 +1,59 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines behavior of the index projections in relation to the rest of the indexer. + */ +public final class IndexProjectionMode extends ExpandableStringEnum { + /** + * The source document will be skipped from writing into the indexer's target index. + */ + @Generated + public static final IndexProjectionMode SKIP_INDEXING_PARENT_DOCUMENTS = fromString("skipIndexingParentDocuments"); + + /** + * The source document will be written into the indexer's target index. This is the default pattern. + */ + @Generated + public static final IndexProjectionMode INCLUDE_INDEXING_PARENT_DOCUMENTS + = fromString("includeIndexingParentDocuments"); + + /** + * Creates a new instance of IndexProjectionMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public IndexProjectionMode() { + } + + /** + * Creates or finds a IndexProjectionMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding IndexProjectionMode. + */ + @Generated + public static IndexProjectionMode fromString(String name) { + return fromString(name, IndexProjectionMode.class); + } + + /** + * Gets known IndexProjectionMode values. + * + * @return known IndexProjectionMode values. + */ + @Generated + public static Collection values() { + return values(IndexProjectionMode.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexStatisticsSummary.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexStatisticsSummary.java new file mode 100644 index 000000000000..0b262dd2e7f6 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexStatisticsSummary.java @@ -0,0 +1,148 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Statistics for a given index. Statistics are collected periodically and are not guaranteed to always be up-to-date. + */ +@Fluent +public final class IndexStatisticsSummary implements JsonSerializable { + /* + * The name of the index. + */ + @Generated + private String name; + + /* + * The number of documents in the index. + */ + @Generated + private long documentCount; + + /* + * The amount of storage in bytes consumed by the index. + */ + @Generated + private long storageSize; + + /* + * The amount of memory in bytes consumed by vectors in the index. + */ + @Generated + private long vectorIndexSize; + + /** + * Creates an instance of IndexStatisticsSummary class. + */ + @Generated + public IndexStatisticsSummary() { + } + + /** + * Get the name property: The name of the index. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the index. + * + * @param name the name value to set. + * @return the IndexStatisticsSummary object itself. + */ + @Generated + public IndexStatisticsSummary setName(String name) { + this.name = name; + return this; + } + + /** + * Get the documentCount property: The number of documents in the index. + * + * @return the documentCount value. + */ + @Generated + public long getDocumentCount() { + return this.documentCount; + } + + /** + * Get the storageSize property: The amount of storage in bytes consumed by the index. + * + * @return the storageSize value. + */ + @Generated + public long getStorageSize() { + return this.storageSize; + } + + /** + * Get the vectorIndexSize property: The amount of memory in bytes consumed by vectors in the index. + * + * @return the vectorIndexSize value. + */ + @Generated + public long getVectorIndexSize() { + return this.vectorIndexSize; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexStatisticsSummary from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexStatisticsSummary 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 IndexStatisticsSummary. + */ + @Generated + public static IndexStatisticsSummary fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndexStatisticsSummary deserializedIndexStatisticsSummary = new IndexStatisticsSummary(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedIndexStatisticsSummary.name = reader.getString(); + } else if ("documentCount".equals(fieldName)) { + deserializedIndexStatisticsSummary.documentCount = reader.getLong(); + } else if ("storageSize".equals(fieldName)) { + deserializedIndexStatisticsSummary.storageSize = reader.getLong(); + } else if ("vectorIndexSize".equals(fieldName)) { + deserializedIndexStatisticsSummary.vectorIndexSize = reader.getLong(); + } else { + reader.skipChildren(); + } + } + + return deserializedIndexStatisticsSummary; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedOneLakeKnowledgeSource.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedOneLakeKnowledgeSource.java new file mode 100644 index 000000000000..7bfddc0a1d68 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedOneLakeKnowledgeSource.java @@ -0,0 +1,169 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Configuration for OneLake knowledge source. + */ +@Fluent +public final class IndexedOneLakeKnowledgeSource extends KnowledgeSource { + /* + * The type of the knowledge source. + */ + @Generated + private KnowledgeSourceKind kind = KnowledgeSourceKind.INDEXED_ONE_LAKE; + + /* + * The parameters for the OneLake knowledge source. + */ + @Generated + private IndexedOneLakeKnowledgeSourceParameters indexedOneLakeParameters; + + /** + * Creates an instance of IndexedOneLakeKnowledgeSource class. + */ + @Generated + public IndexedOneLakeKnowledgeSource() { + } + + /** + * Get the kind property: The type of the knowledge source. + * + * @return the kind value. + */ + @Generated + @Override + public KnowledgeSourceKind getKind() { + return this.kind; + } + + /** + * Get the indexedOneLakeParameters property: The parameters for the OneLake knowledge source. + * + * @return the indexedOneLakeParameters value. + */ + @Generated + public IndexedOneLakeKnowledgeSourceParameters getIndexedOneLakeParameters() { + return this.indexedOneLakeParameters; + } + + /** + * Set the indexedOneLakeParameters property: The parameters for the OneLake knowledge source. + * + * @param indexedOneLakeParameters the indexedOneLakeParameters value to set. + * @return the IndexedOneLakeKnowledgeSource object itself. + */ + @Generated + public IndexedOneLakeKnowledgeSource + setIndexedOneLakeParameters(IndexedOneLakeKnowledgeSourceParameters indexedOneLakeParameters) { + this.indexedOneLakeParameters = indexedOneLakeParameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public IndexedOneLakeKnowledgeSource setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public IndexedOneLakeKnowledgeSource setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public IndexedOneLakeKnowledgeSource setETag(String eTag) { + super.setETag(eTag); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public IndexedOneLakeKnowledgeSource setEncryptionKey(SearchResourceEncryptionKey encryptionKey) { + super.setEncryptionKey(encryptionKey); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("description", getDescription()); + jsonWriter.writeStringField("@odata.etag", getETag()); + jsonWriter.writeJsonField("encryptionKey", getEncryptionKey()); + jsonWriter.writeJsonField("indexedOneLakeParameters", this.indexedOneLakeParameters); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexedOneLakeKnowledgeSource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexedOneLakeKnowledgeSource 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 IndexedOneLakeKnowledgeSource. + */ + @Generated + public static IndexedOneLakeKnowledgeSource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndexedOneLakeKnowledgeSource deserializedIndexedOneLakeKnowledgeSource + = new IndexedOneLakeKnowledgeSource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedIndexedOneLakeKnowledgeSource.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedIndexedOneLakeKnowledgeSource.setDescription(reader.getString()); + } else if ("@odata.etag".equals(fieldName)) { + deserializedIndexedOneLakeKnowledgeSource.setETag(reader.getString()); + } else if ("encryptionKey".equals(fieldName)) { + deserializedIndexedOneLakeKnowledgeSource + .setEncryptionKey(SearchResourceEncryptionKey.fromJson(reader)); + } else if ("indexedOneLakeParameters".equals(fieldName)) { + deserializedIndexedOneLakeKnowledgeSource.indexedOneLakeParameters + = IndexedOneLakeKnowledgeSourceParameters.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedIndexedOneLakeKnowledgeSource.kind = KnowledgeSourceKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedIndexedOneLakeKnowledgeSource; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedOneLakeKnowledgeSourceParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedOneLakeKnowledgeSourceParameters.java new file mode 100644 index 000000000000..8893c84ca96a --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedOneLakeKnowledgeSourceParameters.java @@ -0,0 +1,211 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.Map; + +/** + * Parameters for OneLake knowledge source. + */ +@Fluent +public final class IndexedOneLakeKnowledgeSourceParameters + implements JsonSerializable { + /* + * OneLake workspace ID. + */ + @Generated + private String fabricWorkspaceId; + + /* + * Specifies which OneLake lakehouse to access. + */ + @Generated + private String lakehouseId; + + /* + * Optional OneLakehouse folder or shortcut to filter OneLake content. + */ + @Generated + private String targetPath; + + /* + * Consolidates all general ingestion settings. + */ + @Generated + private KnowledgeSourceIngestionParameters ingestionParameters; + + /* + * Resources created by the knowledge source. + */ + @Generated + private Map createdResources; + + /** + * Creates an instance of IndexedOneLakeKnowledgeSourceParameters class. + */ + @Generated + public IndexedOneLakeKnowledgeSourceParameters() { + } + + /** + * Get the fabricWorkspaceId property: OneLake workspace ID. + * + * @return the fabricWorkspaceId value. + */ + @Generated + public String getFabricWorkspaceId() { + return this.fabricWorkspaceId; + } + + /** + * Set the fabricWorkspaceId property: OneLake workspace ID. + * + * @param fabricWorkspaceId the fabricWorkspaceId value to set. + * @return the IndexedOneLakeKnowledgeSourceParameters object itself. + */ + @Generated + public IndexedOneLakeKnowledgeSourceParameters setFabricWorkspaceId(String fabricWorkspaceId) { + this.fabricWorkspaceId = fabricWorkspaceId; + return this; + } + + /** + * Get the lakehouseId property: Specifies which OneLake lakehouse to access. + * + * @return the lakehouseId value. + */ + @Generated + public String getLakehouseId() { + return this.lakehouseId; + } + + /** + * Set the lakehouseId property: Specifies which OneLake lakehouse to access. + * + * @param lakehouseId the lakehouseId value to set. + * @return the IndexedOneLakeKnowledgeSourceParameters object itself. + */ + @Generated + public IndexedOneLakeKnowledgeSourceParameters setLakehouseId(String lakehouseId) { + this.lakehouseId = lakehouseId; + return this; + } + + /** + * Get the targetPath property: Optional OneLakehouse folder or shortcut to filter OneLake content. + * + * @return the targetPath value. + */ + @Generated + public String getTargetPath() { + return this.targetPath; + } + + /** + * Set the targetPath property: Optional OneLakehouse folder or shortcut to filter OneLake content. + * + * @param targetPath the targetPath value to set. + * @return the IndexedOneLakeKnowledgeSourceParameters object itself. + */ + @Generated + public IndexedOneLakeKnowledgeSourceParameters setTargetPath(String targetPath) { + this.targetPath = targetPath; + return this; + } + + /** + * Get the ingestionParameters property: Consolidates all general ingestion settings. + * + * @return the ingestionParameters value. + */ + @Generated + public KnowledgeSourceIngestionParameters getIngestionParameters() { + return this.ingestionParameters; + } + + /** + * Set the ingestionParameters property: Consolidates all general ingestion settings. + * + * @param ingestionParameters the ingestionParameters value to set. + * @return the IndexedOneLakeKnowledgeSourceParameters object itself. + */ + @Generated + public IndexedOneLakeKnowledgeSourceParameters + setIngestionParameters(KnowledgeSourceIngestionParameters ingestionParameters) { + this.ingestionParameters = ingestionParameters; + return this; + } + + /** + * Get the createdResources property: Resources created by the knowledge source. + * + * @return the createdResources value. + */ + @Generated + public Map getCreatedResources() { + return this.createdResources; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("fabricWorkspaceId", this.fabricWorkspaceId); + jsonWriter.writeStringField("lakehouseId", this.lakehouseId); + jsonWriter.writeStringField("targetPath", this.targetPath); + jsonWriter.writeJsonField("ingestionParameters", this.ingestionParameters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexedOneLakeKnowledgeSourceParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexedOneLakeKnowledgeSourceParameters 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 IndexedOneLakeKnowledgeSourceParameters. + */ + @Generated + public static IndexedOneLakeKnowledgeSourceParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndexedOneLakeKnowledgeSourceParameters deserializedIndexedOneLakeKnowledgeSourceParameters + = new IndexedOneLakeKnowledgeSourceParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("fabricWorkspaceId".equals(fieldName)) { + deserializedIndexedOneLakeKnowledgeSourceParameters.fabricWorkspaceId = reader.getString(); + } else if ("lakehouseId".equals(fieldName)) { + deserializedIndexedOneLakeKnowledgeSourceParameters.lakehouseId = reader.getString(); + } else if ("targetPath".equals(fieldName)) { + deserializedIndexedOneLakeKnowledgeSourceParameters.targetPath = reader.getString(); + } else if ("ingestionParameters".equals(fieldName)) { + deserializedIndexedOneLakeKnowledgeSourceParameters.ingestionParameters + = KnowledgeSourceIngestionParameters.fromJson(reader); + } else if ("createdResources".equals(fieldName)) { + Map createdResources = reader.readMap(reader1 -> reader1.getString()); + deserializedIndexedOneLakeKnowledgeSourceParameters.createdResources = createdResources; + } else { + reader.skipChildren(); + } + } + + return deserializedIndexedOneLakeKnowledgeSourceParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedOneLakeKnowledgeSourceParams.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedOneLakeKnowledgeSourceParams.java new file mode 100644 index 000000000000..3cc5fc3633bf --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedOneLakeKnowledgeSourceParams.java @@ -0,0 +1,153 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specifies runtime parameters for a indexed OneLake knowledge source. + */ +@Fluent +public final class IndexedOneLakeKnowledgeSourceParams extends KnowledgeSourceParams { + /* + * The type of the knowledge source. + */ + @Generated + private KnowledgeSourceKind kind = KnowledgeSourceKind.INDEXED_ONE_LAKE; + + /** + * Creates an instance of IndexedOneLakeKnowledgeSourceParams class. + */ + @Generated + public IndexedOneLakeKnowledgeSourceParams() { + } + + /** + * Get the kind property: The type of the knowledge source. + * + * @return the kind value. + */ + @Generated + @Override + public KnowledgeSourceKind getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public IndexedOneLakeKnowledgeSourceParams setKnowledgeSourceName(String knowledgeSourceName) { + super.setKnowledgeSourceName(knowledgeSourceName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public IndexedOneLakeKnowledgeSourceParams setIncludeReferences(Boolean includeReferences) { + super.setIncludeReferences(includeReferences); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public IndexedOneLakeKnowledgeSourceParams setIncludeReferenceSourceData(Boolean includeReferenceSourceData) { + super.setIncludeReferenceSourceData(includeReferenceSourceData); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public IndexedOneLakeKnowledgeSourceParams setAlwaysQuerySource(Boolean alwaysQuerySource) { + super.setAlwaysQuerySource(alwaysQuerySource); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public IndexedOneLakeKnowledgeSourceParams setRerankerThreshold(Float rerankerThreshold) { + super.setRerankerThreshold(rerankerThreshold); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("knowledgeSourceName", getKnowledgeSourceName()); + jsonWriter.writeBooleanField("includeReferences", isIncludeReferences()); + jsonWriter.writeBooleanField("includeReferenceSourceData", isIncludeReferenceSourceData()); + jsonWriter.writeBooleanField("alwaysQuerySource", isAlwaysQuerySource()); + jsonWriter.writeNumberField("rerankerThreshold", getRerankerThreshold()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexedOneLakeKnowledgeSourceParams from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexedOneLakeKnowledgeSourceParams 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 IndexedOneLakeKnowledgeSourceParams. + */ + @Generated + public static IndexedOneLakeKnowledgeSourceParams fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndexedOneLakeKnowledgeSourceParams deserializedIndexedOneLakeKnowledgeSourceParams + = new IndexedOneLakeKnowledgeSourceParams(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("knowledgeSourceName".equals(fieldName)) { + deserializedIndexedOneLakeKnowledgeSourceParams.setKnowledgeSourceName(reader.getString()); + } else if ("includeReferences".equals(fieldName)) { + deserializedIndexedOneLakeKnowledgeSourceParams + .setIncludeReferences(reader.getNullable(JsonReader::getBoolean)); + } else if ("includeReferenceSourceData".equals(fieldName)) { + deserializedIndexedOneLakeKnowledgeSourceParams + .setIncludeReferenceSourceData(reader.getNullable(JsonReader::getBoolean)); + } else if ("alwaysQuerySource".equals(fieldName)) { + deserializedIndexedOneLakeKnowledgeSourceParams + .setAlwaysQuerySource(reader.getNullable(JsonReader::getBoolean)); + } else if ("rerankerThreshold".equals(fieldName)) { + deserializedIndexedOneLakeKnowledgeSourceParams + .setRerankerThreshold(reader.getNullable(JsonReader::getFloat)); + } else if ("kind".equals(fieldName)) { + deserializedIndexedOneLakeKnowledgeSourceParams.kind + = KnowledgeSourceKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedIndexedOneLakeKnowledgeSourceParams; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedSharePointContainerName.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedSharePointContainerName.java new file mode 100644 index 000000000000..01d5c8369201 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedSharePointContainerName.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies which SharePoint libraries to access. + */ +public final class IndexedSharePointContainerName extends ExpandableStringEnum { + /** + * Index content from the site's default document library. + */ + @Generated + public static final IndexedSharePointContainerName DEFAULT_SITE_LIBRARY = fromString("defaultSiteLibrary"); + + /** + * Index content from every document library in the site. + */ + @Generated + public static final IndexedSharePointContainerName ALL_SITE_LIBRARIES = fromString("allSiteLibraries"); + + /** + * Index only content that matches the query specified in the knowledge source. + */ + @Generated + public static final IndexedSharePointContainerName USE_QUERY = fromString("useQuery"); + + /** + * Creates a new instance of IndexedSharePointContainerName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public IndexedSharePointContainerName() { + } + + /** + * Creates or finds a IndexedSharePointContainerName from its string representation. + * + * @param name a name to look for. + * @return the corresponding IndexedSharePointContainerName. + */ + @Generated + public static IndexedSharePointContainerName fromString(String name) { + return fromString(name, IndexedSharePointContainerName.class); + } + + /** + * Gets known IndexedSharePointContainerName values. + * + * @return known IndexedSharePointContainerName values. + */ + @Generated + public static Collection values() { + return values(IndexedSharePointContainerName.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedSharePointKnowledgeSource.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedSharePointKnowledgeSource.java new file mode 100644 index 000000000000..256ff1640be2 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedSharePointKnowledgeSource.java @@ -0,0 +1,170 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Configuration for SharePoint knowledge source. + */ +@Fluent +public final class IndexedSharePointKnowledgeSource extends KnowledgeSource { + /* + * The type of the knowledge source. + */ + @Generated + private KnowledgeSourceKind kind = KnowledgeSourceKind.INDEXED_SHARE_POINT; + + /* + * The parameters for the SharePoint knowledge source. + */ + @Generated + private IndexedSharePointKnowledgeSourceParameters indexedSharePointParameters; + + /** + * Creates an instance of IndexedSharePointKnowledgeSource class. + */ + @Generated + public IndexedSharePointKnowledgeSource() { + } + + /** + * Get the kind property: The type of the knowledge source. + * + * @return the kind value. + */ + @Generated + @Override + public KnowledgeSourceKind getKind() { + return this.kind; + } + + /** + * Get the indexedSharePointParameters property: The parameters for the SharePoint knowledge source. + * + * @return the indexedSharePointParameters value. + */ + @Generated + public IndexedSharePointKnowledgeSourceParameters getIndexedSharePointParameters() { + return this.indexedSharePointParameters; + } + + /** + * Set the indexedSharePointParameters property: The parameters for the SharePoint knowledge source. + * + * @param indexedSharePointParameters the indexedSharePointParameters value to set. + * @return the IndexedSharePointKnowledgeSource object itself. + */ + @Generated + public IndexedSharePointKnowledgeSource + setIndexedSharePointParameters(IndexedSharePointKnowledgeSourceParameters indexedSharePointParameters) { + this.indexedSharePointParameters = indexedSharePointParameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public IndexedSharePointKnowledgeSource setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public IndexedSharePointKnowledgeSource setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public IndexedSharePointKnowledgeSource setETag(String eTag) { + super.setETag(eTag); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public IndexedSharePointKnowledgeSource setEncryptionKey(SearchResourceEncryptionKey encryptionKey) { + super.setEncryptionKey(encryptionKey); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("description", getDescription()); + jsonWriter.writeStringField("@odata.etag", getETag()); + jsonWriter.writeJsonField("encryptionKey", getEncryptionKey()); + jsonWriter.writeJsonField("indexedSharePointParameters", this.indexedSharePointParameters); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexedSharePointKnowledgeSource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexedSharePointKnowledgeSource 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 IndexedSharePointKnowledgeSource. + */ + @Generated + public static IndexedSharePointKnowledgeSource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndexedSharePointKnowledgeSource deserializedIndexedSharePointKnowledgeSource + = new IndexedSharePointKnowledgeSource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedIndexedSharePointKnowledgeSource.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedIndexedSharePointKnowledgeSource.setDescription(reader.getString()); + } else if ("@odata.etag".equals(fieldName)) { + deserializedIndexedSharePointKnowledgeSource.setETag(reader.getString()); + } else if ("encryptionKey".equals(fieldName)) { + deserializedIndexedSharePointKnowledgeSource + .setEncryptionKey(SearchResourceEncryptionKey.fromJson(reader)); + } else if ("indexedSharePointParameters".equals(fieldName)) { + deserializedIndexedSharePointKnowledgeSource.indexedSharePointParameters + = IndexedSharePointKnowledgeSourceParameters.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedIndexedSharePointKnowledgeSource.kind + = KnowledgeSourceKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedIndexedSharePointKnowledgeSource; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedSharePointKnowledgeSourceParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedSharePointKnowledgeSourceParameters.java new file mode 100644 index 000000000000..3d45067d7412 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedSharePointKnowledgeSourceParameters.java @@ -0,0 +1,217 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.Map; + +/** + * Parameters for SharePoint knowledge source. + */ +@Fluent +public final class IndexedSharePointKnowledgeSourceParameters + implements JsonSerializable { + /* + * SharePoint connection string with format: SharePointOnlineEndpoint=[SharePoint site url];ApplicationId=[Azure AD + * App ID];ApplicationSecret=[Azure AD App client secret];TenantId=[SharePoint site tenant id] + */ + @Generated + private String connectionString; + + /* + * Specifies which SharePoint libraries to access. + */ + @Generated + private IndexedSharePointContainerName containerName; + + /* + * Optional query to filter SharePoint content. + */ + @Generated + private String query; + + /* + * Consolidates all general ingestion settings. + */ + @Generated + private KnowledgeSourceIngestionParameters ingestionParameters; + + /* + * Resources created by the knowledge source. + */ + @Generated + private Map createdResources; + + /** + * Creates an instance of IndexedSharePointKnowledgeSourceParameters class. + */ + @Generated + public IndexedSharePointKnowledgeSourceParameters() { + } + + /** + * Get the connectionString property: SharePoint connection string with format: SharePointOnlineEndpoint=[SharePoint + * site url];ApplicationId=[Azure AD App ID];ApplicationSecret=[Azure AD App client secret];TenantId=[SharePoint + * site tenant id]. + * + * @return the connectionString value. + */ + @Generated + public String getConnectionString() { + return this.connectionString; + } + + /** + * Set the connectionString property: SharePoint connection string with format: SharePointOnlineEndpoint=[SharePoint + * site url];ApplicationId=[Azure AD App ID];ApplicationSecret=[Azure AD App client secret];TenantId=[SharePoint + * site tenant id]. + * + * @param connectionString the connectionString value to set. + * @return the IndexedSharePointKnowledgeSourceParameters object itself. + */ + @Generated + public IndexedSharePointKnowledgeSourceParameters setConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the containerName property: Specifies which SharePoint libraries to access. + * + * @return the containerName value. + */ + @Generated + public IndexedSharePointContainerName getContainerName() { + return this.containerName; + } + + /** + * Set the containerName property: Specifies which SharePoint libraries to access. + * + * @param containerName the containerName value to set. + * @return the IndexedSharePointKnowledgeSourceParameters object itself. + */ + @Generated + public IndexedSharePointKnowledgeSourceParameters setContainerName(IndexedSharePointContainerName containerName) { + this.containerName = containerName; + return this; + } + + /** + * Get the query property: Optional query to filter SharePoint content. + * + * @return the query value. + */ + @Generated + public String getQuery() { + return this.query; + } + + /** + * Set the query property: Optional query to filter SharePoint content. + * + * @param query the query value to set. + * @return the IndexedSharePointKnowledgeSourceParameters object itself. + */ + @Generated + public IndexedSharePointKnowledgeSourceParameters setQuery(String query) { + this.query = query; + return this; + } + + /** + * Get the ingestionParameters property: Consolidates all general ingestion settings. + * + * @return the ingestionParameters value. + */ + @Generated + public KnowledgeSourceIngestionParameters getIngestionParameters() { + return this.ingestionParameters; + } + + /** + * Set the ingestionParameters property: Consolidates all general ingestion settings. + * + * @param ingestionParameters the ingestionParameters value to set. + * @return the IndexedSharePointKnowledgeSourceParameters object itself. + */ + @Generated + public IndexedSharePointKnowledgeSourceParameters + setIngestionParameters(KnowledgeSourceIngestionParameters ingestionParameters) { + this.ingestionParameters = ingestionParameters; + return this; + } + + /** + * Get the createdResources property: Resources created by the knowledge source. + * + * @return the createdResources value. + */ + @Generated + public Map getCreatedResources() { + return this.createdResources; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("connectionString", this.connectionString); + jsonWriter.writeStringField("containerName", this.containerName == null ? null : this.containerName.toString()); + jsonWriter.writeStringField("query", this.query); + jsonWriter.writeJsonField("ingestionParameters", this.ingestionParameters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexedSharePointKnowledgeSourceParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexedSharePointKnowledgeSourceParameters 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 IndexedSharePointKnowledgeSourceParameters. + */ + @Generated + public static IndexedSharePointKnowledgeSourceParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndexedSharePointKnowledgeSourceParameters deserializedIndexedSharePointKnowledgeSourceParameters + = new IndexedSharePointKnowledgeSourceParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connectionString".equals(fieldName)) { + deserializedIndexedSharePointKnowledgeSourceParameters.connectionString = reader.getString(); + } else if ("containerName".equals(fieldName)) { + deserializedIndexedSharePointKnowledgeSourceParameters.containerName + = IndexedSharePointContainerName.fromString(reader.getString()); + } else if ("query".equals(fieldName)) { + deserializedIndexedSharePointKnowledgeSourceParameters.query = reader.getString(); + } else if ("ingestionParameters".equals(fieldName)) { + deserializedIndexedSharePointKnowledgeSourceParameters.ingestionParameters + = KnowledgeSourceIngestionParameters.fromJson(reader); + } else if ("createdResources".equals(fieldName)) { + Map createdResources = reader.readMap(reader1 -> reader1.getString()); + deserializedIndexedSharePointKnowledgeSourceParameters.createdResources = createdResources; + } else { + reader.skipChildren(); + } + } + + return deserializedIndexedSharePointKnowledgeSourceParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedSharePointKnowledgeSourceParams.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedSharePointKnowledgeSourceParams.java new file mode 100644 index 000000000000..40af04a3c505 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexedSharePointKnowledgeSourceParams.java @@ -0,0 +1,153 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specifies runtime parameters for a indexed SharePoint knowledge source. + */ +@Fluent +public final class IndexedSharePointKnowledgeSourceParams extends KnowledgeSourceParams { + /* + * The type of the knowledge source. + */ + @Generated + private KnowledgeSourceKind kind = KnowledgeSourceKind.INDEXED_SHARE_POINT; + + /** + * Creates an instance of IndexedSharePointKnowledgeSourceParams class. + */ + @Generated + public IndexedSharePointKnowledgeSourceParams() { + } + + /** + * Get the kind property: The type of the knowledge source. + * + * @return the kind value. + */ + @Generated + @Override + public KnowledgeSourceKind getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public IndexedSharePointKnowledgeSourceParams setKnowledgeSourceName(String knowledgeSourceName) { + super.setKnowledgeSourceName(knowledgeSourceName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public IndexedSharePointKnowledgeSourceParams setIncludeReferences(Boolean includeReferences) { + super.setIncludeReferences(includeReferences); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public IndexedSharePointKnowledgeSourceParams setIncludeReferenceSourceData(Boolean includeReferenceSourceData) { + super.setIncludeReferenceSourceData(includeReferenceSourceData); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public IndexedSharePointKnowledgeSourceParams setAlwaysQuerySource(Boolean alwaysQuerySource) { + super.setAlwaysQuerySource(alwaysQuerySource); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public IndexedSharePointKnowledgeSourceParams setRerankerThreshold(Float rerankerThreshold) { + super.setRerankerThreshold(rerankerThreshold); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("knowledgeSourceName", getKnowledgeSourceName()); + jsonWriter.writeBooleanField("includeReferences", isIncludeReferences()); + jsonWriter.writeBooleanField("includeReferenceSourceData", isIncludeReferenceSourceData()); + jsonWriter.writeBooleanField("alwaysQuerySource", isAlwaysQuerySource()); + jsonWriter.writeNumberField("rerankerThreshold", getRerankerThreshold()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexedSharePointKnowledgeSourceParams from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexedSharePointKnowledgeSourceParams 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 IndexedSharePointKnowledgeSourceParams. + */ + @Generated + public static IndexedSharePointKnowledgeSourceParams fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndexedSharePointKnowledgeSourceParams deserializedIndexedSharePointKnowledgeSourceParams + = new IndexedSharePointKnowledgeSourceParams(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("knowledgeSourceName".equals(fieldName)) { + deserializedIndexedSharePointKnowledgeSourceParams.setKnowledgeSourceName(reader.getString()); + } else if ("includeReferences".equals(fieldName)) { + deserializedIndexedSharePointKnowledgeSourceParams + .setIncludeReferences(reader.getNullable(JsonReader::getBoolean)); + } else if ("includeReferenceSourceData".equals(fieldName)) { + deserializedIndexedSharePointKnowledgeSourceParams + .setIncludeReferenceSourceData(reader.getNullable(JsonReader::getBoolean)); + } else if ("alwaysQuerySource".equals(fieldName)) { + deserializedIndexedSharePointKnowledgeSourceParams + .setAlwaysQuerySource(reader.getNullable(JsonReader::getBoolean)); + } else if ("rerankerThreshold".equals(fieldName)) { + deserializedIndexedSharePointKnowledgeSourceParams + .setRerankerThreshold(reader.getNullable(JsonReader::getFloat)); + } else if ("kind".equals(fieldName)) { + deserializedIndexedSharePointKnowledgeSourceParams.kind + = KnowledgeSourceKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedIndexedSharePointKnowledgeSourceParams; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerCurrentState.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerCurrentState.java new file mode 100644 index 000000000000..b5a5339f9212 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerCurrentState.java @@ -0,0 +1,239 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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. + */ + @Generated + private IndexingMode mode; + + /* + * Change tracking state used when indexing starts on all documents in the datasource. + */ + @Generated + private String allDocsInitialTrackingState; + + /* + * Change tracking state value when indexing finishes on all documents in the datasource. + */ + @Generated + private String allDocsFinalTrackingState; + + /* + * Change tracking state used when indexing starts on select, reset documents in the datasource. + */ + @Generated + private String resetDocsInitialTrackingState; + + /* + * Change tracking state value when indexing finishes on select, reset documents in the datasource. + */ + @Generated + private String resetDocsFinalTrackingState; + + /* + * 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. + */ + @Generated + 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. + */ + @Generated + private List resetDatasourceDocumentIds; + + /* + * Change tracking state used when indexing starts on selective options from the datasource. + */ + @Generated + private String resyncInitialTrackingState; + + /* + * Change tracking state value when indexing finishes on selective options from the datasource. + */ + @Generated + private String resyncFinalTrackingState; + + /** + * Creates an instance of IndexerCurrentState class. + */ + @Generated + public IndexerCurrentState() { + } + + /** + * Get the mode property: The mode the indexer is running in. + * + * @return the mode value. + */ + @Generated + public IndexingMode getMode() { + return this.mode; + } + + /** + * Get the allDocsInitialTrackingState property: Change tracking state used when indexing starts on all documents in + * the datasource. + * + * @return the allDocsInitialTrackingState value. + */ + @Generated + public String getAllDocsInitialTrackingState() { + return this.allDocsInitialTrackingState; + } + + /** + * Get the allDocsFinalTrackingState property: Change tracking state value when indexing finishes on all documents + * in the datasource. + * + * @return the allDocsFinalTrackingState value. + */ + @Generated + public String getAllDocsFinalTrackingState() { + return this.allDocsFinalTrackingState; + } + + /** + * Get the resetDocsInitialTrackingState property: Change tracking state used when indexing starts on select, reset + * documents in the datasource. + * + * @return the resetDocsInitialTrackingState value. + */ + @Generated + public String getResetDocsInitialTrackingState() { + return this.resetDocsInitialTrackingState; + } + + /** + * Get the resetDocsFinalTrackingState property: Change tracking state value when indexing finishes on select, reset + * documents in the datasource. + * + * @return the resetDocsFinalTrackingState value. + */ + @Generated + public String getResetDocsFinalTrackingState() { + return this.resetDocsFinalTrackingState; + } + + /** + * 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. + */ + @Generated + 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. + */ + @Generated + public List getResetDatasourceDocumentIds() { + return this.resetDatasourceDocumentIds; + } + + /** + * Get the resyncInitialTrackingState property: Change tracking state used when indexing starts on selective options + * from the datasource. + * + * @return the resyncInitialTrackingState value. + */ + @Generated + public String getResyncInitialTrackingState() { + return this.resyncInitialTrackingState; + } + + /** + * Get the resyncFinalTrackingState property: Change tracking state value when indexing finishes on selective + * options from the datasource. + * + * @return the resyncFinalTrackingState value. + */ + @Generated + public String getResyncFinalTrackingState() { + return this.resyncFinalTrackingState; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + 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 ("allDocsInitialTrackingState".equals(fieldName)) { + deserializedIndexerCurrentState.allDocsInitialTrackingState = reader.getString(); + } else if ("allDocsFinalTrackingState".equals(fieldName)) { + deserializedIndexerCurrentState.allDocsFinalTrackingState = reader.getString(); + } else if ("resetDocsInitialTrackingState".equals(fieldName)) { + deserializedIndexerCurrentState.resetDocsInitialTrackingState = reader.getString(); + } else if ("resetDocsFinalTrackingState".equals(fieldName)) { + deserializedIndexerCurrentState.resetDocsFinalTrackingState = 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 if ("resyncInitialTrackingState".equals(fieldName)) { + deserializedIndexerCurrentState.resyncInitialTrackingState = reader.getString(); + } else if ("resyncFinalTrackingState".equals(fieldName)) { + deserializedIndexerCurrentState.resyncFinalTrackingState = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIndexerCurrentState; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerExecutionEnvironment.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerExecutionEnvironment.java new file mode 100644 index 000000000000..b74b0201b110 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerExecutionEnvironment.java @@ -0,0 +1,61 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the environment in which the indexer should execute. + */ +public final class IndexerExecutionEnvironment extends ExpandableStringEnum { + /** + * Indicates that the search service can determine where the indexer should execute. This is the default environment + * when nothing is specified and is the recommended value. + */ + @Generated + public static final IndexerExecutionEnvironment STANDARD = fromString("standard"); + + /** + * Indicates that the indexer should run with the environment provisioned specifically for the search service. This + * should only be specified as the execution environment if the indexer needs to access resources securely over + * shared private link resources. + */ + @Generated + public static final IndexerExecutionEnvironment PRIVATE = fromString("private"); + + /** + * Creates a new instance of IndexerExecutionEnvironment value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public IndexerExecutionEnvironment() { + } + + /** + * Creates or finds a IndexerExecutionEnvironment from its string representation. + * + * @param name a name to look for. + * @return the corresponding IndexerExecutionEnvironment. + */ + @Generated + public static IndexerExecutionEnvironment fromString(String name) { + return fromString(name, IndexerExecutionEnvironment.class); + } + + /** + * Gets known IndexerExecutionEnvironment values. + * + * @return known IndexerExecutionEnvironment values. + */ + @Generated + public static Collection values() { + return values(IndexerExecutionEnvironment.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerExecutionResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerExecutionResult.java new file mode 100644 index 000000000000..74f5d2d68cb5 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerExecutionResult.java @@ -0,0 +1,290 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +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.OffsetDateTime; +import java.util.List; + +/** + * Represents the result of an individual indexer execution. + */ +@Immutable +public final class IndexerExecutionResult implements JsonSerializable { + /* + * The outcome of this indexer execution. + */ + @Generated + private IndexerExecutionStatus status; + + /* + * The outcome of this indexer execution. + */ + @Generated + private IndexerExecutionStatusDetail statusDetail; + + /* + * The mode the indexer is running in. + */ + @Generated + private IndexingMode mode; + + /* + * The error message indicating the top-level error, if any. + */ + @Generated + private String errorMessage; + + /* + * The start time of this indexer execution. + */ + @Generated + private OffsetDateTime startTime; + + /* + * The end time of this indexer execution, if the execution has already completed. + */ + @Generated + private OffsetDateTime endTime; + + /* + * The item-level indexing errors. + */ + @Generated + private List errors; + + /* + * The item-level indexing warnings. + */ + @Generated + private List warnings; + + /* + * The number of items that were processed during this indexer execution. This includes both successfully processed + * items and items where indexing was attempted but failed. + */ + @Generated + private int itemCount; + + /* + * The number of items that failed to be indexed during this indexer execution. + */ + @Generated + private int failedItemCount; + + /* + * Change tracking state with which an indexer execution started. + */ + @Generated + private String initialTrackingState; + + /* + * Change tracking state with which an indexer execution finished. + */ + @Generated + private String finalTrackingState; + + /** + * Creates an instance of IndexerExecutionResult class. + */ + @Generated + public IndexerExecutionResult() { + } + + /** + * Get the status property: The outcome of this indexer execution. + * + * @return the status value. + */ + @Generated + public IndexerExecutionStatus getStatus() { + return this.status; + } + + /** + * Get the statusDetail property: The outcome of this indexer execution. + * + * @return the statusDetail value. + */ + @Generated + public IndexerExecutionStatusDetail getStatusDetail() { + return this.statusDetail; + } + + /** + * Get the mode property: The mode the indexer is running in. + * + * @return the mode value. + */ + @Generated + public IndexingMode getMode() { + return this.mode; + } + + /** + * Get the errorMessage property: The error message indicating the top-level error, if any. + * + * @return the errorMessage value. + */ + @Generated + public String getErrorMessage() { + return this.errorMessage; + } + + /** + * Get the startTime property: The start time of this indexer execution. + * + * @return the startTime value. + */ + @Generated + public OffsetDateTime getStartTime() { + return this.startTime; + } + + /** + * Get the endTime property: The end time of this indexer execution, if the execution has already completed. + * + * @return the endTime value. + */ + @Generated + public OffsetDateTime getEndTime() { + return this.endTime; + } + + /** + * Get the errors property: The item-level indexing errors. + * + * @return the errors value. + */ + @Generated + public List getErrors() { + return this.errors; + } + + /** + * Get the warnings property: The item-level indexing warnings. + * + * @return the warnings value. + */ + @Generated + public List getWarnings() { + return this.warnings; + } + + /** + * Get the itemCount property: The number of items that were processed during this indexer execution. This includes + * both successfully processed items and items where indexing was attempted but failed. + * + * @return the itemCount value. + */ + @Generated + public int getItemCount() { + return this.itemCount; + } + + /** + * Get the failedItemCount property: The number of items that failed to be indexed during this indexer execution. + * + * @return the failedItemCount value. + */ + @Generated + public int getFailedItemCount() { + return this.failedItemCount; + } + + /** + * Get the initialTrackingState property: Change tracking state with which an indexer execution started. + * + * @return the initialTrackingState value. + */ + @Generated + public String getInitialTrackingState() { + return this.initialTrackingState; + } + + /** + * Get the finalTrackingState property: Change tracking state with which an indexer execution finished. + * + * @return the finalTrackingState value. + */ + @Generated + public String getFinalTrackingState() { + return this.finalTrackingState; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexerExecutionResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexerExecutionResult 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 IndexerExecutionResult. + */ + @Generated + public static IndexerExecutionResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndexerExecutionResult deserializedIndexerExecutionResult = new IndexerExecutionResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedIndexerExecutionResult.status = IndexerExecutionStatus.fromString(reader.getString()); + } else if ("errors".equals(fieldName)) { + List errors = reader.readArray(reader1 -> SearchIndexerError.fromJson(reader1)); + deserializedIndexerExecutionResult.errors = errors; + } else if ("warnings".equals(fieldName)) { + List warnings + = reader.readArray(reader1 -> SearchIndexerWarning.fromJson(reader1)); + deserializedIndexerExecutionResult.warnings = warnings; + } else if ("itemsProcessed".equals(fieldName)) { + deserializedIndexerExecutionResult.itemCount = reader.getInt(); + } else if ("itemsFailed".equals(fieldName)) { + deserializedIndexerExecutionResult.failedItemCount = reader.getInt(); + } else if ("statusDetail".equals(fieldName)) { + deserializedIndexerExecutionResult.statusDetail + = IndexerExecutionStatusDetail.fromString(reader.getString()); + } else if ("mode".equals(fieldName)) { + deserializedIndexerExecutionResult.mode = IndexingMode.fromString(reader.getString()); + } else if ("errorMessage".equals(fieldName)) { + deserializedIndexerExecutionResult.errorMessage = reader.getString(); + } else if ("startTime".equals(fieldName)) { + deserializedIndexerExecutionResult.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedIndexerExecutionResult.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("initialTrackingState".equals(fieldName)) { + deserializedIndexerExecutionResult.initialTrackingState = reader.getString(); + } else if ("finalTrackingState".equals(fieldName)) { + deserializedIndexerExecutionResult.finalTrackingState = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIndexerExecutionResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerExecutionStatus.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerExecutionStatus.java new file mode 100644 index 000000000000..a86ba2e729d6 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerExecutionStatus.java @@ -0,0 +1,68 @@ +// 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.models; + +/** + * Represents the status of an individual indexer execution. + */ +public enum IndexerExecutionStatus { + /** + * An indexer invocation has failed, but the failure may be transient. Indexer invocations will continue per + * schedule. + */ + TRANSIENT_FAILURE("transientFailure"), + + /** + * Indexer execution completed successfully. + */ + SUCCESS("success"), + + /** + * Indexer execution is in progress. + */ + IN_PROGRESS("inProgress"), + + /** + * Indexer has been reset. + */ + RESET("reset"); + + /** + * The actual serialized value for a IndexerExecutionStatus instance. + */ + private final String value; + + IndexerExecutionStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IndexerExecutionStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed IndexerExecutionStatus object, or null if unable to parse. + */ + public static IndexerExecutionStatus fromString(String value) { + if (value == null) { + return null; + } + IndexerExecutionStatus[] items = IndexerExecutionStatus.values(); + for (IndexerExecutionStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerExecutionStatusDetail.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerExecutionStatusDetail.java new file mode 100644 index 000000000000..8d82b3c4963a --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerExecutionStatusDetail.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Details the status of an individual indexer execution. + */ +public final class IndexerExecutionStatusDetail extends ExpandableStringEnum { + /** + * Indicates that the reset that occurred was for a call to ResetDocs. + */ + @Generated + public static final IndexerExecutionStatusDetail RESET_DOCS = fromString("resetDocs"); + + /** + * Indicates to selectively resync based on option(s) from data source. + */ + @Generated + public static final IndexerExecutionStatusDetail RESYNC = fromString("resync"); + + /** + * Creates a new instance of IndexerExecutionStatusDetail value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public IndexerExecutionStatusDetail() { + } + + /** + * Creates or finds a IndexerExecutionStatusDetail from its string representation. + * + * @param name a name to look for. + * @return the corresponding IndexerExecutionStatusDetail. + */ + @Generated + public static IndexerExecutionStatusDetail fromString(String name) { + return fromString(name, IndexerExecutionStatusDetail.class); + } + + /** + * Gets known IndexerExecutionStatusDetail values. + * + * @return known IndexerExecutionStatusDetail values. + */ + @Generated + public static Collection values() { + return values(IndexerExecutionStatusDetail.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerPermissionOption.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerPermissionOption.java new file mode 100644 index 000000000000..f7ee8ec742a3 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerPermissionOption.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Options with various types of permission data to index. + */ +public final class IndexerPermissionOption extends ExpandableStringEnum { + /** + * Indexer to ingest ACL userIds from data source to index. + */ + @Generated + public static final IndexerPermissionOption USER_IDS = fromString("userIds"); + + /** + * Indexer to ingest ACL groupIds from data source to index. + */ + @Generated + public static final IndexerPermissionOption GROUP_IDS = fromString("groupIds"); + + /** + * Indexer to ingest Azure RBAC scope from data source to index. + */ + @Generated + public static final IndexerPermissionOption RBAC_SCOPE = fromString("rbacScope"); + + /** + * Creates a new instance of IndexerPermissionOption value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public IndexerPermissionOption() { + } + + /** + * Creates or finds a IndexerPermissionOption from its string representation. + * + * @param name a name to look for. + * @return the corresponding IndexerPermissionOption. + */ + @Generated + public static IndexerPermissionOption fromString(String name) { + return fromString(name, IndexerPermissionOption.class); + } + + /** + * Gets known IndexerPermissionOption values. + * + * @return known IndexerPermissionOption values. + */ + @Generated + public static Collection values() { + return values(IndexerPermissionOption.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerResyncBody.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerResyncBody.java new file mode 100644 index 000000000000..131a6ff008e0 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerResyncBody.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 IndexerResyncBody model. + */ +@Fluent +public final class IndexerResyncBody implements JsonSerializable { + /* + * Re-sync options that have been pre-defined from data source. + */ + @Generated + private List options; + + /** + * Creates an instance of IndexerResyncBody class. + */ + @Generated + public IndexerResyncBody() { + } + + /** + * Get the options property: Re-sync options that have been pre-defined from data source. + * + * @return the options value. + */ + @Generated + public List getOptions() { + return this.options; + } + + /** + * Set the options property: Re-sync options that have been pre-defined from data source. + * + * @param options the options value to set. + * @return the IndexerResyncBody object itself. + */ + @Generated + public IndexerResyncBody setOptions(List options) { + this.options = options; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("options", this.options, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexerResyncBody from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexerResyncBody 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 IndexerResyncBody. + */ + @Generated + public static IndexerResyncBody fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndexerResyncBody deserializedIndexerResyncBody = new IndexerResyncBody(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("options".equals(fieldName)) { + List options + = reader.readArray(reader1 -> IndexerResyncOption.fromString(reader1.getString())); + deserializedIndexerResyncBody.options = options; + } else { + reader.skipChildren(); + } + } + + return deserializedIndexerResyncBody; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerResyncOption.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerResyncOption.java new file mode 100644 index 000000000000..669843d9dd39 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerResyncOption.java @@ -0,0 +1,52 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Options with various types of permission data to index. + */ +public final class IndexerResyncOption extends ExpandableStringEnum { + /** + * Indexer to re-ingest pre-selected permissions data from data source to index. + */ + @Generated + public static final IndexerResyncOption PERMISSIONS = fromString("permissions"); + + /** + * Creates a new instance of IndexerResyncOption value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public IndexerResyncOption() { + } + + /** + * Creates or finds a IndexerResyncOption from its string representation. + * + * @param name a name to look for. + * @return the corresponding IndexerResyncOption. + */ + @Generated + public static IndexerResyncOption fromString(String name) { + return fromString(name, IndexerResyncOption.class); + } + + /** + * Gets known IndexerResyncOption values. + * + * @return known IndexerResyncOption values. + */ + @Generated + public static Collection values() { + return values(IndexerResyncOption.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerRuntime.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerRuntime.java new file mode 100644 index 000000000000..59c87e2309fc --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerRuntime.java @@ -0,0 +1,198 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Represents the indexer's cumulative runtime consumption in the service. + */ +@Fluent +public final class IndexerRuntime implements JsonSerializable { + /* + * Cumulative runtime of the indexer from the beginningTime to endingTime, in seconds. + */ + @Generated + private long usedSeconds; + + /* + * Cumulative runtime remaining for all indexers in the service from the beginningTime to endingTime, in seconds. + */ + @Generated + private Long remainingSeconds; + + /* + * Beginning UTC time of the 24-hour period considered for indexer runtime usage (inclusive). + */ + @Generated + private OffsetDateTime beginningTime; + + /* + * End UTC time of the 24-hour period considered for indexer runtime usage (inclusive). + */ + @Generated + private OffsetDateTime endingTime; + + /** + * Creates an instance of IndexerRuntime class. + */ + @Generated + public IndexerRuntime() { + } + + /** + * Get the usedSeconds property: Cumulative runtime of the indexer from the beginningTime to endingTime, in seconds. + * + * @return the usedSeconds value. + */ + @Generated + public long getUsedSeconds() { + return this.usedSeconds; + } + + /** + * Set the usedSeconds property: Cumulative runtime of the indexer from the beginningTime to endingTime, in seconds. + * + * @param usedSeconds the usedSeconds value to set. + * @return the IndexerRuntime object itself. + */ + @Generated + public IndexerRuntime setUsedSeconds(long usedSeconds) { + this.usedSeconds = usedSeconds; + return this; + } + + /** + * Get the remainingSeconds property: Cumulative runtime remaining for all indexers in the service from the + * beginningTime to endingTime, in seconds. + * + * @return the remainingSeconds value. + */ + @Generated + public Long getRemainingSeconds() { + return this.remainingSeconds; + } + + /** + * Set the remainingSeconds property: Cumulative runtime remaining for all indexers in the service from the + * beginningTime to endingTime, in seconds. + * + * @param remainingSeconds the remainingSeconds value to set. + * @return the IndexerRuntime object itself. + */ + @Generated + public IndexerRuntime setRemainingSeconds(Long remainingSeconds) { + this.remainingSeconds = remainingSeconds; + return this; + } + + /** + * Get the beginningTime property: Beginning UTC time of the 24-hour period considered for indexer runtime usage + * (inclusive). + * + * @return the beginningTime value. + */ + @Generated + public OffsetDateTime getBeginningTime() { + return this.beginningTime; + } + + /** + * Set the beginningTime property: Beginning UTC time of the 24-hour period considered for indexer runtime usage + * (inclusive). + * + * @param beginningTime the beginningTime value to set. + * @return the IndexerRuntime object itself. + */ + @Generated + public IndexerRuntime setBeginningTime(OffsetDateTime beginningTime) { + this.beginningTime = beginningTime; + return this; + } + + /** + * Get the endingTime property: End UTC time of the 24-hour period considered for indexer runtime usage (inclusive). + * + * @return the endingTime value. + */ + @Generated + public OffsetDateTime getEndingTime() { + return this.endingTime; + } + + /** + * Set the endingTime property: End UTC time of the 24-hour period considered for indexer runtime usage (inclusive). + * + * @param endingTime the endingTime value to set. + * @return the IndexerRuntime object itself. + */ + @Generated + public IndexerRuntime setEndingTime(OffsetDateTime endingTime) { + this.endingTime = endingTime; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeLongField("usedSeconds", this.usedSeconds); + jsonWriter.writeStringField("beginningTime", + this.beginningTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.beginningTime)); + jsonWriter.writeStringField("endingTime", + this.endingTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endingTime)); + jsonWriter.writeNumberField("remainingSeconds", this.remainingSeconds); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexerRuntime from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexerRuntime 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 IndexerRuntime. + */ + @Generated + public static IndexerRuntime fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndexerRuntime deserializedIndexerRuntime = new IndexerRuntime(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("usedSeconds".equals(fieldName)) { + deserializedIndexerRuntime.usedSeconds = reader.getLong(); + } else if ("beginningTime".equals(fieldName)) { + deserializedIndexerRuntime.beginningTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endingTime".equals(fieldName)) { + deserializedIndexerRuntime.endingTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("remainingSeconds".equals(fieldName)) { + deserializedIndexerRuntime.remainingSeconds = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedIndexerRuntime; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerStatus.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerStatus.java new file mode 100644 index 000000000000..3c64e39f2c8c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexerStatus.java @@ -0,0 +1,62 @@ +// 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.models; + +/** + * Represents the overall indexer status. + */ +public enum IndexerStatus { + /** + * Indicates that the indexer is in an unknown state. + */ + UNKNOWN("unknown"), + + /** + * Indicates that the indexer experienced an error that cannot be corrected without human intervention. + */ + ERROR("error"), + + /** + * Indicates that the indexer is running normally. + */ + RUNNING("running"); + + /** + * The actual serialized value for a IndexerStatus instance. + */ + private final String value; + + IndexerStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IndexerStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed IndexerStatus object, or null if unable to parse. + */ + public static IndexerStatus fromString(String value) { + if (value == null) { + return null; + } + IndexerStatus[] items = IndexerStatus.values(); + for (IndexerStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingMode.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingMode.java new file mode 100644 index 000000000000..f359fac2bb10 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingMode.java @@ -0,0 +1,65 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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. + */ + @Generated + 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. + */ + @Generated + public static final IndexingMode INDEXING_RESET_DOCS = fromString("indexingResetDocs"); + + /** + * The indexer is resyncing and indexing selective option(s) from the datasource. + */ + @Generated + public static final IndexingMode INDEXING_RESYNC = fromString("indexingResync"); + + /** + * Creates a new instance of IndexingMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public IndexingMode() { + } + + /** + * Creates or finds a IndexingMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding IndexingMode. + */ + @Generated + public static IndexingMode fromString(String name) { + return fromString(name, IndexingMode.class); + } + + /** + * Gets known IndexingMode values. + * + * @return known IndexingMode values. + */ + @Generated + public static Collection values() { + return values(IndexingMode.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingParameters.java new file mode 100644 index 000000000000..001ea89aa23a --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingParameters.java @@ -0,0 +1,198 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents parameters for indexer execution. + */ +@Fluent +public final class IndexingParameters implements JsonSerializable { + /* + * The number of items that are read from the data source and indexed as a single batch in order to improve + * performance. The default depends on the data source type. + */ + @Generated + private Integer batchSize; + + /* + * The maximum number of items that can fail indexing for indexer execution to still be considered successful. -1 + * means no limit. Default is 0. + */ + @Generated + private Integer maxFailedItems; + + /* + * The maximum number of items in a single batch that can fail indexing for the batch to still be considered + * successful. -1 means no limit. Default is 0. + */ + @Generated + private Integer maxFailedItemsPerBatch; + + /* + * A dictionary of indexer-specific configuration properties. Each name is the name of a specific property. Each + * value must be of a primitive type. + */ + @Generated + private IndexingParametersConfiguration configuration; + + /** + * Creates an instance of IndexingParameters class. + */ + @Generated + public IndexingParameters() { + } + + /** + * Get the batchSize property: The number of items that are read from the data source and indexed as a single batch + * in order to improve performance. The default depends on the data source type. + * + * @return the batchSize value. + */ + @Generated + public Integer getBatchSize() { + return this.batchSize; + } + + /** + * Set the batchSize property: The number of items that are read from the data source and indexed as a single batch + * in order to improve performance. The default depends on the data source type. + * + * @param batchSize the batchSize value to set. + * @return the IndexingParameters object itself. + */ + @Generated + public IndexingParameters setBatchSize(Integer batchSize) { + this.batchSize = batchSize; + return this; + } + + /** + * Get the maxFailedItems property: The maximum number of items that can fail indexing for indexer execution to + * still be considered successful. -1 means no limit. Default is 0. + * + * @return the maxFailedItems value. + */ + @Generated + public Integer getMaxFailedItems() { + return this.maxFailedItems; + } + + /** + * Set the maxFailedItems property: The maximum number of items that can fail indexing for indexer execution to + * still be considered successful. -1 means no limit. Default is 0. + * + * @param maxFailedItems the maxFailedItems value to set. + * @return the IndexingParameters object itself. + */ + @Generated + public IndexingParameters setMaxFailedItems(Integer maxFailedItems) { + this.maxFailedItems = maxFailedItems; + return this; + } + + /** + * Get the maxFailedItemsPerBatch property: The maximum number of items in a single batch that can fail indexing for + * the batch to still be considered successful. -1 means no limit. Default is 0. + * + * @return the maxFailedItemsPerBatch value. + */ + @Generated + public Integer getMaxFailedItemsPerBatch() { + return this.maxFailedItemsPerBatch; + } + + /** + * Set the maxFailedItemsPerBatch property: The maximum number of items in a single batch that can fail indexing for + * the batch to still be considered successful. -1 means no limit. Default is 0. + * + * @param maxFailedItemsPerBatch the maxFailedItemsPerBatch value to set. + * @return the IndexingParameters object itself. + */ + @Generated + public IndexingParameters setMaxFailedItemsPerBatch(Integer maxFailedItemsPerBatch) { + this.maxFailedItemsPerBatch = maxFailedItemsPerBatch; + return this; + } + + /** + * Get the configuration property: A dictionary of indexer-specific configuration properties. Each name is the name + * of a specific property. Each value must be of a primitive type. + * + * @return the configuration value. + */ + @Generated + public IndexingParametersConfiguration getConfiguration() { + return this.configuration; + } + + /** + * Set the configuration property: A dictionary of indexer-specific configuration properties. Each name is the name + * of a specific property. Each value must be of a primitive type. + * + * @param configuration the configuration value to set. + * @return the IndexingParameters object itself. + */ + @Generated + public IndexingParameters setConfiguration(IndexingParametersConfiguration configuration) { + this.configuration = configuration; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("batchSize", this.batchSize); + jsonWriter.writeNumberField("maxFailedItems", this.maxFailedItems); + jsonWriter.writeNumberField("maxFailedItemsPerBatch", this.maxFailedItemsPerBatch); + jsonWriter.writeJsonField("configuration", this.configuration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexingParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexingParameters 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 IndexingParameters. + */ + @Generated + public static IndexingParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndexingParameters deserializedIndexingParameters = new IndexingParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("batchSize".equals(fieldName)) { + deserializedIndexingParameters.batchSize = reader.getNullable(JsonReader::getInt); + } else if ("maxFailedItems".equals(fieldName)) { + deserializedIndexingParameters.maxFailedItems = reader.getNullable(JsonReader::getInt); + } else if ("maxFailedItemsPerBatch".equals(fieldName)) { + deserializedIndexingParameters.maxFailedItemsPerBatch = reader.getNullable(JsonReader::getInt); + } else if ("configuration".equals(fieldName)) { + deserializedIndexingParameters.configuration = IndexingParametersConfiguration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedIndexingParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingParametersConfiguration.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingParametersConfiguration.java new file mode 100644 index 000000000000..e538bd89ec07 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingParametersConfiguration.java @@ -0,0 +1,747 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.LinkedHashMap; +import java.util.Map; + +/** + * A dictionary of indexer-specific configuration properties. Each name is the name of a specific property. Each value + * must be of a primitive type. + */ +@Fluent +public final class IndexingParametersConfiguration implements JsonSerializable { + /* + * Represents the parsing mode for indexing from an Azure blob data source. + */ + @Generated + private BlobIndexerParsingMode parsingMode; + + /* + * Comma-delimited list of filename extensions to ignore when processing from Azure blob storage. For example, you + * could exclude ".png, .mp4" to skip over those files during indexing. + */ + @Generated + private String excludedFileNameExtensions; + + /* + * Comma-delimited list of filename extensions to select when processing from Azure blob storage. For example, you + * could focus indexing on specific application files ".docx, .pptx, .msg" to specifically include those file types. + */ + @Generated + private String indexedFileNameExtensions; + + /* + * For Azure blobs, set to false if you want to continue indexing when an unsupported content type is encountered, + * and you don't know all the content types (file extensions) in advance. + */ + @Generated + private Boolean failOnUnsupportedContentType; + + /* + * For Azure blobs, set to false if you want to continue indexing if a document fails indexing. + */ + @Generated + private Boolean failOnUnprocessableDocument; + + /* + * For Azure blobs, set this property to true to still index storage metadata for blob content that is too large to + * process. Oversized blobs are treated as errors by default. For limits on blob size, see + * https://learn.microsoft.com/azure/search/search-limits-quotas-capacity. + */ + @Generated + private Boolean indexStorageMetadataOnlyForOversizedDocuments; + + /* + * For CSV blobs, specifies a comma-delimited list of column headers, useful for mapping source fields to + * destination fields in an index. + */ + @Generated + private String delimitedTextHeaders; + + /* + * For CSV blobs, specifies the end-of-line single-character delimiter for CSV files where each line starts a new + * document (for example, "|"). + */ + @Generated + private String delimitedTextDelimiter; + + /* + * For CSV blobs, indicates that the first (non-blank) line of each blob contains headers. + */ + @Generated + private Boolean firstLineContainsHeaders; + + /* + * Specifies the submode that will determine whether a markdown file will be parsed into exactly one search document + * or multiple search documents. Default is `oneToMany`. + */ + @Generated + private MarkdownParsingSubmode markdownParsingSubmode; + + /* + * Specifies the max header depth that will be considered while grouping markdown content. Default is `h6`. + */ + @Generated + private MarkdownHeaderDepth markdownHeaderDepth; + + /* + * For JSON arrays, given a structured or semi-structured document, you can specify a path to the array using this + * property. + */ + @Generated + private String documentRoot; + + /* + * Specifies the data to extract from Azure blob storage and tells the indexer which data to extract from image + * content when "imageAction" is set to a value other than "none". This applies to embedded image content in a .PDF + * or other application, or image files such as .jpg and .png, in Azure blobs. + */ + @Generated + private BlobIndexerDataToExtract dataToExtract; + + /* + * Determines how to process embedded images and image files in Azure blob storage. Setting the "imageAction" + * configuration to any value other than "none" requires that a skillset also be attached to that indexer. + */ + @Generated + private BlobIndexerImageAction imageAction; + + /* + * If true, will create a path //document//file_data that is an object representing the original file data + * downloaded from your blob data source. This allows you to pass the original file data to a custom skill for + * processing within the enrichment pipeline, or to the Document Extraction skill. + */ + @Generated + private Boolean allowSkillsetToReadFileData; + + /* + * Determines algorithm for text extraction from PDF files in Azure blob storage. + */ + @Generated + private BlobIndexerPDFTextRotationAlgorithm pdfTextRotationAlgorithm; + + /* + * Specifies the environment in which the indexer should execute. + */ + @Generated + private IndexerExecutionEnvironment executionEnvironment; + + /* + * Increases the timeout beyond the 5-minute default for Azure SQL database data sources, specified in the format + * "hh:mm:ss". + */ + @Generated + private String queryTimeout; + + /* + * A dictionary of indexer-specific configuration properties. Each name is the name of a specific property. Each + * value must be of a primitive type. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of IndexingParametersConfiguration class. + */ + @Generated + public IndexingParametersConfiguration() { + } + + /** + * Get the parsingMode property: Represents the parsing mode for indexing from an Azure blob data source. + * + * @return the parsingMode value. + */ + @Generated + public BlobIndexerParsingMode getParsingMode() { + return this.parsingMode; + } + + /** + * Set the parsingMode property: Represents the parsing mode for indexing from an Azure blob data source. + * + * @param parsingMode the parsingMode value to set. + * @return the IndexingParametersConfiguration object itself. + */ + @Generated + public IndexingParametersConfiguration setParsingMode(BlobIndexerParsingMode parsingMode) { + this.parsingMode = parsingMode; + return this; + } + + /** + * Get the excludedFileNameExtensions property: Comma-delimited list of filename extensions to ignore when + * processing from Azure blob storage. For example, you could exclude ".png, .mp4" to skip over those files during + * indexing. + * + * @return the excludedFileNameExtensions value. + */ + @Generated + public String getExcludedFileNameExtensions() { + return this.excludedFileNameExtensions; + } + + /** + * Set the excludedFileNameExtensions property: Comma-delimited list of filename extensions to ignore when + * processing from Azure blob storage. For example, you could exclude ".png, .mp4" to skip over those files during + * indexing. + * + * @param excludedFileNameExtensions the excludedFileNameExtensions value to set. + * @return the IndexingParametersConfiguration object itself. + */ + @Generated + public IndexingParametersConfiguration setExcludedFileNameExtensions(String excludedFileNameExtensions) { + this.excludedFileNameExtensions = excludedFileNameExtensions; + return this; + } + + /** + * Get the indexedFileNameExtensions property: Comma-delimited list of filename extensions to select when processing + * from Azure blob storage. For example, you could focus indexing on specific application files ".docx, .pptx, .msg" + * to specifically include those file types. + * + * @return the indexedFileNameExtensions value. + */ + @Generated + public String getIndexedFileNameExtensions() { + return this.indexedFileNameExtensions; + } + + /** + * Set the indexedFileNameExtensions property: Comma-delimited list of filename extensions to select when processing + * from Azure blob storage. For example, you could focus indexing on specific application files ".docx, .pptx, .msg" + * to specifically include those file types. + * + * @param indexedFileNameExtensions the indexedFileNameExtensions value to set. + * @return the IndexingParametersConfiguration object itself. + */ + @Generated + public IndexingParametersConfiguration setIndexedFileNameExtensions(String indexedFileNameExtensions) { + this.indexedFileNameExtensions = indexedFileNameExtensions; + return this; + } + + /** + * Get the failOnUnsupportedContentType property: For Azure blobs, set to false if you want to continue indexing + * when an unsupported content type is encountered, and you don't know all the content types (file extensions) in + * advance. + * + * @return the failOnUnsupportedContentType value. + */ + @Generated + public Boolean isFailOnUnsupportedContentType() { + return this.failOnUnsupportedContentType; + } + + /** + * Set the failOnUnsupportedContentType property: For Azure blobs, set to false if you want to continue indexing + * when an unsupported content type is encountered, and you don't know all the content types (file extensions) in + * advance. + * + * @param failOnUnsupportedContentType the failOnUnsupportedContentType value to set. + * @return the IndexingParametersConfiguration object itself. + */ + @Generated + public IndexingParametersConfiguration setFailOnUnsupportedContentType(Boolean failOnUnsupportedContentType) { + this.failOnUnsupportedContentType = failOnUnsupportedContentType; + return this; + } + + /** + * Get the failOnUnprocessableDocument property: For Azure blobs, set to false if you want to continue indexing if a + * document fails indexing. + * + * @return the failOnUnprocessableDocument value. + */ + @Generated + public Boolean isFailOnUnprocessableDocument() { + return this.failOnUnprocessableDocument; + } + + /** + * Set the failOnUnprocessableDocument property: For Azure blobs, set to false if you want to continue indexing if a + * document fails indexing. + * + * @param failOnUnprocessableDocument the failOnUnprocessableDocument value to set. + * @return the IndexingParametersConfiguration object itself. + */ + @Generated + public IndexingParametersConfiguration setFailOnUnprocessableDocument(Boolean failOnUnprocessableDocument) { + this.failOnUnprocessableDocument = failOnUnprocessableDocument; + return this; + } + + /** + * Get the indexStorageMetadataOnlyForOversizedDocuments property: For Azure blobs, set this property to true to + * still index storage metadata for blob content that is too large to process. Oversized blobs are treated as errors + * by default. For limits on blob size, see https://learn.microsoft.com/azure/search/search-limits-quotas-capacity. + * + * @return the indexStorageMetadataOnlyForOversizedDocuments value. + */ + @Generated + public Boolean isIndexStorageMetadataOnlyForOversizedDocuments() { + return this.indexStorageMetadataOnlyForOversizedDocuments; + } + + /** + * Set the indexStorageMetadataOnlyForOversizedDocuments property: For Azure blobs, set this property to true to + * still index storage metadata for blob content that is too large to process. Oversized blobs are treated as errors + * by default. For limits on blob size, see https://learn.microsoft.com/azure/search/search-limits-quotas-capacity. + * + * @param indexStorageMetadataOnlyForOversizedDocuments the indexStorageMetadataOnlyForOversizedDocuments value to + * set. + * @return the IndexingParametersConfiguration object itself. + */ + @Generated + public IndexingParametersConfiguration + setIndexStorageMetadataOnlyForOversizedDocuments(Boolean indexStorageMetadataOnlyForOversizedDocuments) { + this.indexStorageMetadataOnlyForOversizedDocuments = indexStorageMetadataOnlyForOversizedDocuments; + return this; + } + + /** + * Get the delimitedTextHeaders property: For CSV blobs, specifies a comma-delimited list of column headers, useful + * for mapping source fields to destination fields in an index. + * + * @return the delimitedTextHeaders value. + */ + @Generated + public String getDelimitedTextHeaders() { + return this.delimitedTextHeaders; + } + + /** + * Set the delimitedTextHeaders property: For CSV blobs, specifies a comma-delimited list of column headers, useful + * for mapping source fields to destination fields in an index. + * + * @param delimitedTextHeaders the delimitedTextHeaders value to set. + * @return the IndexingParametersConfiguration object itself. + */ + @Generated + public IndexingParametersConfiguration setDelimitedTextHeaders(String delimitedTextHeaders) { + this.delimitedTextHeaders = delimitedTextHeaders; + return this; + } + + /** + * Get the delimitedTextDelimiter property: For CSV blobs, specifies the end-of-line single-character delimiter for + * CSV files where each line starts a new document (for example, "|"). + * + * @return the delimitedTextDelimiter value. + */ + @Generated + public String getDelimitedTextDelimiter() { + return this.delimitedTextDelimiter; + } + + /** + * Set the delimitedTextDelimiter property: For CSV blobs, specifies the end-of-line single-character delimiter for + * CSV files where each line starts a new document (for example, "|"). + * + * @param delimitedTextDelimiter the delimitedTextDelimiter value to set. + * @return the IndexingParametersConfiguration object itself. + */ + @Generated + public IndexingParametersConfiguration setDelimitedTextDelimiter(String delimitedTextDelimiter) { + this.delimitedTextDelimiter = delimitedTextDelimiter; + return this; + } + + /** + * Get the firstLineContainsHeaders property: For CSV blobs, indicates that the first (non-blank) line of each blob + * contains headers. + * + * @return the firstLineContainsHeaders value. + */ + @Generated + public Boolean isFirstLineContainsHeaders() { + return this.firstLineContainsHeaders; + } + + /** + * Set the firstLineContainsHeaders property: For CSV blobs, indicates that the first (non-blank) line of each blob + * contains headers. + * + * @param firstLineContainsHeaders the firstLineContainsHeaders value to set. + * @return the IndexingParametersConfiguration object itself. + */ + @Generated + public IndexingParametersConfiguration setFirstLineContainsHeaders(Boolean firstLineContainsHeaders) { + this.firstLineContainsHeaders = firstLineContainsHeaders; + return this; + } + + /** + * Get the markdownParsingSubmode property: Specifies the submode that will determine whether a markdown file will + * be parsed into exactly one search document or multiple search documents. Default is `oneToMany`. + * + * @return the markdownParsingSubmode value. + */ + @Generated + public MarkdownParsingSubmode getMarkdownParsingSubmode() { + return this.markdownParsingSubmode; + } + + /** + * Set the markdownParsingSubmode property: Specifies the submode that will determine whether a markdown file will + * be parsed into exactly one search document or multiple search documents. Default is `oneToMany`. + * + * @param markdownParsingSubmode the markdownParsingSubmode value to set. + * @return the IndexingParametersConfiguration object itself. + */ + @Generated + public IndexingParametersConfiguration setMarkdownParsingSubmode(MarkdownParsingSubmode markdownParsingSubmode) { + this.markdownParsingSubmode = markdownParsingSubmode; + return this; + } + + /** + * Get the markdownHeaderDepth property: Specifies the max header depth that will be considered while grouping + * markdown content. Default is `h6`. + * + * @return the markdownHeaderDepth value. + */ + @Generated + public MarkdownHeaderDepth getMarkdownHeaderDepth() { + return this.markdownHeaderDepth; + } + + /** + * Set the markdownHeaderDepth property: Specifies the max header depth that will be considered while grouping + * markdown content. Default is `h6`. + * + * @param markdownHeaderDepth the markdownHeaderDepth value to set. + * @return the IndexingParametersConfiguration object itself. + */ + @Generated + public IndexingParametersConfiguration setMarkdownHeaderDepth(MarkdownHeaderDepth markdownHeaderDepth) { + this.markdownHeaderDepth = markdownHeaderDepth; + return this; + } + + /** + * Get the documentRoot property: For JSON arrays, given a structured or semi-structured document, you can specify a + * path to the array using this property. + * + * @return the documentRoot value. + */ + @Generated + public String getDocumentRoot() { + return this.documentRoot; + } + + /** + * Set the documentRoot property: For JSON arrays, given a structured or semi-structured document, you can specify a + * path to the array using this property. + * + * @param documentRoot the documentRoot value to set. + * @return the IndexingParametersConfiguration object itself. + */ + @Generated + public IndexingParametersConfiguration setDocumentRoot(String documentRoot) { + this.documentRoot = documentRoot; + return this; + } + + /** + * Get the dataToExtract property: Specifies the data to extract from Azure blob storage and tells the indexer which + * data to extract from image content when "imageAction" is set to a value other than "none". This applies to + * embedded image content in a .PDF or other application, or image files such as .jpg and .png, in Azure blobs. + * + * @return the dataToExtract value. + */ + @Generated + public BlobIndexerDataToExtract getDataToExtract() { + return this.dataToExtract; + } + + /** + * Set the dataToExtract property: Specifies the data to extract from Azure blob storage and tells the indexer which + * data to extract from image content when "imageAction" is set to a value other than "none". This applies to + * embedded image content in a .PDF or other application, or image files such as .jpg and .png, in Azure blobs. + * + * @param dataToExtract the dataToExtract value to set. + * @return the IndexingParametersConfiguration object itself. + */ + @Generated + public IndexingParametersConfiguration setDataToExtract(BlobIndexerDataToExtract dataToExtract) { + this.dataToExtract = dataToExtract; + return this; + } + + /** + * Get the imageAction property: Determines how to process embedded images and image files in Azure blob storage. + * Setting the "imageAction" configuration to any value other than "none" requires that a skillset also be attached + * to that indexer. + * + * @return the imageAction value. + */ + @Generated + public BlobIndexerImageAction getImageAction() { + return this.imageAction; + } + + /** + * Set the imageAction property: Determines how to process embedded images and image files in Azure blob storage. + * Setting the "imageAction" configuration to any value other than "none" requires that a skillset also be attached + * to that indexer. + * + * @param imageAction the imageAction value to set. + * @return the IndexingParametersConfiguration object itself. + */ + @Generated + public IndexingParametersConfiguration setImageAction(BlobIndexerImageAction imageAction) { + this.imageAction = imageAction; + return this; + } + + /** + * Get the allowSkillsetToReadFileData property: If true, will create a path //document//file_data that is an object + * representing the original file data downloaded from your blob data source. This allows you to pass the original + * file data to a custom skill for processing within the enrichment pipeline, or to the Document Extraction skill. + * + * @return the allowSkillsetToReadFileData value. + */ + @Generated + public Boolean isAllowSkillsetToReadFileData() { + return this.allowSkillsetToReadFileData; + } + + /** + * Set the allowSkillsetToReadFileData property: If true, will create a path //document//file_data that is an object + * representing the original file data downloaded from your blob data source. This allows you to pass the original + * file data to a custom skill for processing within the enrichment pipeline, or to the Document Extraction skill. + * + * @param allowSkillsetToReadFileData the allowSkillsetToReadFileData value to set. + * @return the IndexingParametersConfiguration object itself. + */ + @Generated + public IndexingParametersConfiguration setAllowSkillsetToReadFileData(Boolean allowSkillsetToReadFileData) { + this.allowSkillsetToReadFileData = allowSkillsetToReadFileData; + return this; + } + + /** + * Get the pdfTextRotationAlgorithm property: Determines algorithm for text extraction from PDF files in Azure blob + * storage. + * + * @return the pdfTextRotationAlgorithm value. + */ + @Generated + public BlobIndexerPDFTextRotationAlgorithm getPdfTextRotationAlgorithm() { + return this.pdfTextRotationAlgorithm; + } + + /** + * Set the pdfTextRotationAlgorithm property: Determines algorithm for text extraction from PDF files in Azure blob + * storage. + * + * @param pdfTextRotationAlgorithm the pdfTextRotationAlgorithm value to set. + * @return the IndexingParametersConfiguration object itself. + */ + @Generated + public IndexingParametersConfiguration + setPdfTextRotationAlgorithm(BlobIndexerPDFTextRotationAlgorithm pdfTextRotationAlgorithm) { + this.pdfTextRotationAlgorithm = pdfTextRotationAlgorithm; + return this; + } + + /** + * Get the executionEnvironment property: Specifies the environment in which the indexer should execute. + * + * @return the executionEnvironment value. + */ + @Generated + public IndexerExecutionEnvironment getExecutionEnvironment() { + return this.executionEnvironment; + } + + /** + * Set the executionEnvironment property: Specifies the environment in which the indexer should execute. + * + * @param executionEnvironment the executionEnvironment value to set. + * @return the IndexingParametersConfiguration object itself. + */ + @Generated + public IndexingParametersConfiguration setExecutionEnvironment(IndexerExecutionEnvironment executionEnvironment) { + this.executionEnvironment = executionEnvironment; + return this; + } + + /** + * Get the queryTimeout property: Increases the timeout beyond the 5-minute default for Azure SQL database data + * sources, specified in the format "hh:mm:ss". + * + * @return the queryTimeout value. + */ + @Generated + public String getQueryTimeout() { + return this.queryTimeout; + } + + /** + * Set the queryTimeout property: Increases the timeout beyond the 5-minute default for Azure SQL database data + * sources, specified in the format "hh:mm:ss". + * + * @param queryTimeout the queryTimeout value to set. + * @return the IndexingParametersConfiguration object itself. + */ + @Generated + public IndexingParametersConfiguration setQueryTimeout(String queryTimeout) { + this.queryTimeout = queryTimeout; + return this; + } + + /** + * Get the additionalProperties property: A dictionary of indexer-specific configuration properties. Each name is + * the name of a specific property. Each value must be of a primitive type. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: A dictionary of indexer-specific configuration properties. Each name is + * the name of a specific property. Each value must be of a primitive type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the IndexingParametersConfiguration object itself. + */ + @Generated + public IndexingParametersConfiguration setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("parsingMode", this.parsingMode == null ? null : this.parsingMode.toString()); + jsonWriter.writeStringField("excludedFileNameExtensions", this.excludedFileNameExtensions); + jsonWriter.writeStringField("indexedFileNameExtensions", this.indexedFileNameExtensions); + jsonWriter.writeBooleanField("failOnUnsupportedContentType", this.failOnUnsupportedContentType); + jsonWriter.writeBooleanField("failOnUnprocessableDocument", this.failOnUnprocessableDocument); + jsonWriter.writeBooleanField("indexStorageMetadataOnlyForOversizedDocuments", + this.indexStorageMetadataOnlyForOversizedDocuments); + jsonWriter.writeStringField("delimitedTextHeaders", this.delimitedTextHeaders); + jsonWriter.writeStringField("delimitedTextDelimiter", this.delimitedTextDelimiter); + jsonWriter.writeBooleanField("firstLineContainsHeaders", this.firstLineContainsHeaders); + jsonWriter.writeStringField("markdownParsingSubmode", + this.markdownParsingSubmode == null ? null : this.markdownParsingSubmode.toString()); + jsonWriter.writeStringField("markdownHeaderDepth", + this.markdownHeaderDepth == null ? null : this.markdownHeaderDepth.toString()); + jsonWriter.writeStringField("documentRoot", this.documentRoot); + jsonWriter.writeStringField("dataToExtract", this.dataToExtract == null ? null : this.dataToExtract.toString()); + jsonWriter.writeStringField("imageAction", this.imageAction == null ? null : this.imageAction.toString()); + jsonWriter.writeBooleanField("allowSkillsetToReadFileData", this.allowSkillsetToReadFileData); + jsonWriter.writeStringField("pdfTextRotationAlgorithm", + this.pdfTextRotationAlgorithm == null ? null : this.pdfTextRotationAlgorithm.toString()); + jsonWriter.writeStringField("executionEnvironment", + this.executionEnvironment == null ? null : this.executionEnvironment.toString()); + jsonWriter.writeStringField("queryTimeout", this.queryTimeout); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexingParametersConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexingParametersConfiguration 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 IndexingParametersConfiguration. + */ + @Generated + public static IndexingParametersConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndexingParametersConfiguration deserializedIndexingParametersConfiguration + = new IndexingParametersConfiguration(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("parsingMode".equals(fieldName)) { + deserializedIndexingParametersConfiguration.parsingMode + = BlobIndexerParsingMode.fromString(reader.getString()); + } else if ("excludedFileNameExtensions".equals(fieldName)) { + deserializedIndexingParametersConfiguration.excludedFileNameExtensions = reader.getString(); + } else if ("indexedFileNameExtensions".equals(fieldName)) { + deserializedIndexingParametersConfiguration.indexedFileNameExtensions = reader.getString(); + } else if ("failOnUnsupportedContentType".equals(fieldName)) { + deserializedIndexingParametersConfiguration.failOnUnsupportedContentType + = reader.getNullable(JsonReader::getBoolean); + } else if ("failOnUnprocessableDocument".equals(fieldName)) { + deserializedIndexingParametersConfiguration.failOnUnprocessableDocument + = reader.getNullable(JsonReader::getBoolean); + } else if ("indexStorageMetadataOnlyForOversizedDocuments".equals(fieldName)) { + deserializedIndexingParametersConfiguration.indexStorageMetadataOnlyForOversizedDocuments + = reader.getNullable(JsonReader::getBoolean); + } else if ("delimitedTextHeaders".equals(fieldName)) { + deserializedIndexingParametersConfiguration.delimitedTextHeaders = reader.getString(); + } else if ("delimitedTextDelimiter".equals(fieldName)) { + deserializedIndexingParametersConfiguration.delimitedTextDelimiter = reader.getString(); + } else if ("firstLineContainsHeaders".equals(fieldName)) { + deserializedIndexingParametersConfiguration.firstLineContainsHeaders + = reader.getNullable(JsonReader::getBoolean); + } else if ("markdownParsingSubmode".equals(fieldName)) { + deserializedIndexingParametersConfiguration.markdownParsingSubmode + = MarkdownParsingSubmode.fromString(reader.getString()); + } else if ("markdownHeaderDepth".equals(fieldName)) { + deserializedIndexingParametersConfiguration.markdownHeaderDepth + = MarkdownHeaderDepth.fromString(reader.getString()); + } else if ("documentRoot".equals(fieldName)) { + deserializedIndexingParametersConfiguration.documentRoot = reader.getString(); + } else if ("dataToExtract".equals(fieldName)) { + deserializedIndexingParametersConfiguration.dataToExtract + = BlobIndexerDataToExtract.fromString(reader.getString()); + } else if ("imageAction".equals(fieldName)) { + deserializedIndexingParametersConfiguration.imageAction + = BlobIndexerImageAction.fromString(reader.getString()); + } else if ("allowSkillsetToReadFileData".equals(fieldName)) { + deserializedIndexingParametersConfiguration.allowSkillsetToReadFileData + = reader.getNullable(JsonReader::getBoolean); + } else if ("pdfTextRotationAlgorithm".equals(fieldName)) { + deserializedIndexingParametersConfiguration.pdfTextRotationAlgorithm + = BlobIndexerPDFTextRotationAlgorithm.fromString(reader.getString()); + } else if ("executionEnvironment".equals(fieldName)) { + deserializedIndexingParametersConfiguration.executionEnvironment + = IndexerExecutionEnvironment.fromString(reader.getString()); + } else if ("queryTimeout".equals(fieldName)) { + deserializedIndexingParametersConfiguration.queryTimeout = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedIndexingParametersConfiguration.additionalProperties = additionalProperties; + + return deserializedIndexingParametersConfiguration; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingResult.java new file mode 100644 index 000000000000..504921636c21 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingResult.java @@ -0,0 +1,143 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Status of an indexing operation for a single document. + */ +@Immutable +public final class IndexingResult implements JsonSerializable { + /* + * The key of a document that was in the indexing request. + */ + @Generated + private String key; + + /* + * The error message explaining why the indexing operation failed for the document identified by the key; null if + * indexing succeeded. + */ + @Generated + private String errorMessage; + + /* + * A value indicating whether the indexing operation succeeded for the document identified by the key. + */ + @Generated + private boolean succeeded; + + /* + * The status code of the indexing operation. Possible values include: 200 for a successful update or delete, 201 + * for successful document creation, 400 for a malformed input document, 404 for document not found, 409 for a + * version conflict, 422 when the index is temporarily unavailable, or 503 for when the service is too busy. + */ + @Generated + private int statusCode; + + /** + * Creates an instance of IndexingResult class. + */ + @Generated + public IndexingResult() { + } + + /** + * Get the key property: The key of a document that was in the indexing request. + * + * @return the key value. + */ + @Generated + public String getKey() { + return this.key; + } + + /** + * Get the errorMessage property: The error message explaining why the indexing operation failed for the document + * identified by the key; null if indexing succeeded. + * + * @return the errorMessage value. + */ + @Generated + public String getErrorMessage() { + return this.errorMessage; + } + + /** + * Get the succeeded property: A value indicating whether the indexing operation succeeded for the document + * identified by the key. + * + * @return the succeeded value. + */ + @Generated + public boolean isSucceeded() { + return this.succeeded; + } + + /** + * Get the statusCode property: The status code of the indexing operation. Possible values include: 200 for a + * successful update or delete, 201 for successful document creation, 400 for a malformed input document, 404 for + * document not found, 409 for a version conflict, 422 when the index is temporarily unavailable, or 503 for when + * the service is too busy. + * + * @return the statusCode value. + */ + @Generated + public int getStatusCode() { + return this.statusCode; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexingResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexingResult 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 IndexingResult. + */ + @Generated + public static IndexingResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndexingResult deserializedIndexingResult = new IndexingResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("key".equals(fieldName)) { + deserializedIndexingResult.key = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedIndexingResult.succeeded = reader.getBoolean(); + } else if ("statusCode".equals(fieldName)) { + deserializedIndexingResult.statusCode = reader.getInt(); + } else if ("errorMessage".equals(fieldName)) { + deserializedIndexingResult.errorMessage = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIndexingResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingSchedule.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingSchedule.java new file mode 100644 index 000000000000..5c651cd39841 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/IndexingSchedule.java @@ -0,0 +1,132 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Represents a schedule for indexer execution. + */ +@Fluent +public final class IndexingSchedule implements JsonSerializable { + /* + * The interval of time between indexer executions. + */ + @Generated + private Duration interval; + + /* + * The time when an indexer should start running. + */ + @Generated + private OffsetDateTime startTime; + + /** + * Creates an instance of IndexingSchedule class. + */ + @Generated + public IndexingSchedule() { + } + + /** + * Get the interval property: The interval of time between indexer executions. + * + * @return the interval value. + */ + @Generated + public Duration getInterval() { + return this.interval; + } + + /** + * Set the interval property: The interval of time between indexer executions. + * + * @param interval the interval value to set. + * @return the IndexingSchedule object itself. + */ + @Generated + public IndexingSchedule setInterval(Duration interval) { + this.interval = interval; + return this; + } + + /** + * Get the startTime property: The time when an indexer should start running. + * + * @return the startTime value. + */ + @Generated + public OffsetDateTime getStartTime() { + return this.startTime; + } + + /** + * Set the startTime property: The time when an indexer should start running. + * + * @param startTime the startTime value to set. + * @return the IndexingSchedule object itself. + */ + @Generated + public IndexingSchedule setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("interval", CoreUtils.durationToStringWithDays(this.interval)); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexingSchedule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexingSchedule 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 IndexingSchedule. + */ + @Generated + public static IndexingSchedule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndexingSchedule deserializedIndexingSchedule = new IndexingSchedule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("interval".equals(fieldName)) { + deserializedIndexingSchedule.interval + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("startTime".equals(fieldName)) { + deserializedIndexingSchedule.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedIndexingSchedule; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/InputFieldMappingEntry.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/InputFieldMappingEntry.java new file mode 100644 index 000000000000..9bfcb6891704 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/InputFieldMappingEntry.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Input field mapping for a skill. + */ +@Fluent +public final class InputFieldMappingEntry implements JsonSerializable { + /* + * The name of the input. + */ + @Generated + private String name; + + /* + * The source of the input. + */ + @Generated + private String source; + + /* + * The source context used for selecting recursive inputs. + */ + @Generated + private String sourceContext; + + /* + * The recursive inputs used when creating a complex type. + */ + @Generated + private List inputs; + + /** + * Creates an instance of InputFieldMappingEntry class. + */ + @Generated + public InputFieldMappingEntry() { + } + + /** + * Get the name property: The name of the input. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the input. + * + * @param name the name value to set. + * @return the InputFieldMappingEntry object itself. + */ + @Generated + public InputFieldMappingEntry setName(String name) { + this.name = name; + return this; + } + + /** + * Get the source property: The source of the input. + * + * @return the source value. + */ + @Generated + public String getSource() { + return this.source; + } + + /** + * Set the source property: The source of the input. + * + * @param source the source value to set. + * @return the InputFieldMappingEntry object itself. + */ + @Generated + public InputFieldMappingEntry setSource(String source) { + this.source = source; + return this; + } + + /** + * Get the sourceContext property: The source context used for selecting recursive inputs. + * + * @return the sourceContext value. + */ + @Generated + public String getSourceContext() { + return this.sourceContext; + } + + /** + * Set the sourceContext property: The source context used for selecting recursive inputs. + * + * @param sourceContext the sourceContext value to set. + * @return the InputFieldMappingEntry object itself. + */ + @Generated + public InputFieldMappingEntry setSourceContext(String sourceContext) { + this.sourceContext = sourceContext; + return this; + } + + /** + * Get the inputs property: The recursive inputs used when creating a complex type. + * + * @return the inputs value. + */ + @Generated + public List getInputs() { + return this.inputs; + } + + /** + * Set the inputs property: The recursive inputs used when creating a complex type. + * + * @param inputs the inputs value to set. + * @return the InputFieldMappingEntry object itself. + */ + @Generated + public InputFieldMappingEntry setInputs(List inputs) { + this.inputs = inputs; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("source", this.source); + jsonWriter.writeStringField("sourceContext", this.sourceContext); + jsonWriter.writeArrayField("inputs", this.inputs, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InputFieldMappingEntry from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InputFieldMappingEntry 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 InputFieldMappingEntry. + */ + @Generated + public static InputFieldMappingEntry fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InputFieldMappingEntry deserializedInputFieldMappingEntry = new InputFieldMappingEntry(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedInputFieldMappingEntry.name = reader.getString(); + } else if ("source".equals(fieldName)) { + deserializedInputFieldMappingEntry.source = reader.getString(); + } else if ("sourceContext".equals(fieldName)) { + deserializedInputFieldMappingEntry.sourceContext = reader.getString(); + } else if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedInputFieldMappingEntry.inputs = inputs; + } else { + reader.skipChildren(); + } + } + + return deserializedInputFieldMappingEntry; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeepTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeepTokenFilter.java new file mode 100644 index 000000000000..c7c833c4743c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeepTokenFilter.java @@ -0,0 +1,160 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A token filter that only keeps tokens with text contained in a specified list of words. This token filter is + * implemented using Apache Lucene. + */ +@Fluent +public final class KeepTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.KeepTokenFilter"; + + /* + * The list of words to keep. + */ + @Generated + private List keepWords; + + /* + * A value indicating whether to lower case all words first. Default is false. + */ + @Generated + private Boolean lowerCaseKeepWords; + + /** + * Creates an instance of KeepTokenFilter class. + */ + @Generated + public KeepTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the keepWords property: The list of words to keep. + * + * @return the keepWords value. + */ + @Generated + public List getKeepWords() { + return this.keepWords; + } + + /** + * Set the keepWords property: The list of words to keep. + * + * @param keepWords the keepWords value to set. + * @return the KeepTokenFilter object itself. + */ + @Generated + public KeepTokenFilter setKeepWords(List keepWords) { + this.keepWords = keepWords; + return this; + } + + /** + * Get the lowerCaseKeepWords property: A value indicating whether to lower case all words first. Default is false. + * + * @return the lowerCaseKeepWords value. + */ + @Generated + public Boolean isLowerCaseKeepWords() { + return this.lowerCaseKeepWords; + } + + /** + * Set the lowerCaseKeepWords property: A value indicating whether to lower case all words first. Default is false. + * + * @param lowerCaseKeepWords the lowerCaseKeepWords value to set. + * @return the KeepTokenFilter object itself. + */ + @Generated + public KeepTokenFilter setLowerCaseKeepWords(Boolean lowerCaseKeepWords) { + this.lowerCaseKeepWords = lowerCaseKeepWords; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KeepTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeArrayField("keepWords", this.keepWords, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeBooleanField("keepWordsCase", this.lowerCaseKeepWords); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KeepTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KeepTokenFilter 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 KeepTokenFilter. + */ + @Generated + public static KeepTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KeepTokenFilter deserializedKeepTokenFilter = new KeepTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedKeepTokenFilter.setName(reader.getString()); + } else if ("keepWords".equals(fieldName)) { + List keepWords = reader.readArray(reader1 -> reader1.getString()); + deserializedKeepTokenFilter.keepWords = keepWords; + } else if ("@odata.type".equals(fieldName)) { + deserializedKeepTokenFilter.odataType = reader.getString(); + } else if ("keepWordsCase".equals(fieldName)) { + deserializedKeepTokenFilter.lowerCaseKeepWords = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedKeepTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeyPhraseExtractionSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeyPhraseExtractionSkill.java new file mode 100644 index 000000000000..130eb2783270 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeyPhraseExtractionSkill.java @@ -0,0 +1,254 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A skill that uses text analytics for key phrase extraction. + */ +@Fluent +public final class KeyPhraseExtractionSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Text.KeyPhraseExtractionSkill"; + + /* + * A value indicating which language code to use. Default is `en`. + */ + @Generated + private KeyPhraseExtractionSkillLanguage defaultLanguageCode; + + /* + * A number indicating how many key phrases to return. If absent, all identified key phrases will be returned. + */ + @Generated + private Integer maxKeyPhraseCount; + + /* + * The version of the model to use when calling the Text Analytics service. It will default to the latest available + * when not specified. We recommend you do not specify this value unless absolutely necessary. + */ + @Generated + private String modelVersion; + + /** + * Creates an instance of KeyPhraseExtractionSkill class. + */ + @Generated + public KeyPhraseExtractionSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @return the defaultLanguageCode value. + */ + @Generated + public KeyPhraseExtractionSkillLanguage getDefaultLanguageCode() { + return this.defaultLanguageCode; + } + + /** + * Set the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @param defaultLanguageCode the defaultLanguageCode value to set. + * @return the KeyPhraseExtractionSkill object itself. + */ + @Generated + public KeyPhraseExtractionSkill setDefaultLanguageCode(KeyPhraseExtractionSkillLanguage defaultLanguageCode) { + this.defaultLanguageCode = defaultLanguageCode; + return this; + } + + /** + * Get the maxKeyPhraseCount property: A number indicating how many key phrases to return. If absent, all identified + * key phrases will be returned. + * + * @return the maxKeyPhraseCount value. + */ + @Generated + public Integer getMaxKeyPhraseCount() { + return this.maxKeyPhraseCount; + } + + /** + * Set the maxKeyPhraseCount property: A number indicating how many key phrases to return. If absent, all identified + * key phrases will be returned. + * + * @param maxKeyPhraseCount the maxKeyPhraseCount value to set. + * @return the KeyPhraseExtractionSkill object itself. + */ + @Generated + public KeyPhraseExtractionSkill setMaxKeyPhraseCount(Integer maxKeyPhraseCount) { + this.maxKeyPhraseCount = maxKeyPhraseCount; + return this; + } + + /** + * Get the modelVersion property: The version of the model to use when calling the Text Analytics service. It will + * default to the latest available when not specified. We recommend you do not specify this value unless absolutely + * necessary. + * + * @return the modelVersion value. + */ + @Generated + public String getModelVersion() { + return this.modelVersion; + } + + /** + * Set the modelVersion property: The version of the model to use when calling the Text Analytics service. It will + * default to the latest available when not specified. We recommend you do not specify this value unless absolutely + * necessary. + * + * @param modelVersion the modelVersion value to set. + * @return the KeyPhraseExtractionSkill object itself. + */ + @Generated + public KeyPhraseExtractionSkill setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KeyPhraseExtractionSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KeyPhraseExtractionSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KeyPhraseExtractionSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KeyPhraseExtractionSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KeyPhraseExtractionSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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("defaultLanguageCode", + this.defaultLanguageCode == null ? null : this.defaultLanguageCode.toString()); + jsonWriter.writeNumberField("maxKeyPhraseCount", this.maxKeyPhraseCount); + jsonWriter.writeStringField("modelVersion", this.modelVersion); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KeyPhraseExtractionSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KeyPhraseExtractionSkill 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 KeyPhraseExtractionSkill. + */ + @Generated + public static KeyPhraseExtractionSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KeyPhraseExtractionSkill deserializedKeyPhraseExtractionSkill = new KeyPhraseExtractionSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedKeyPhraseExtractionSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedKeyPhraseExtractionSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedKeyPhraseExtractionSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedKeyPhraseExtractionSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedKeyPhraseExtractionSkill.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedKeyPhraseExtractionSkill.odataType = reader.getString(); + } else if ("defaultLanguageCode".equals(fieldName)) { + deserializedKeyPhraseExtractionSkill.defaultLanguageCode + = KeyPhraseExtractionSkillLanguage.fromString(reader.getString()); + } else if ("maxKeyPhraseCount".equals(fieldName)) { + deserializedKeyPhraseExtractionSkill.maxKeyPhraseCount = reader.getNullable(JsonReader::getInt); + } else if ("modelVersion".equals(fieldName)) { + deserializedKeyPhraseExtractionSkill.modelVersion = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKeyPhraseExtractionSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeyPhraseExtractionSkillLanguage.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeyPhraseExtractionSkillLanguage.java new file mode 100644 index 000000000000..18c59ff58f29 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeyPhraseExtractionSkillLanguage.java @@ -0,0 +1,142 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The language codes supported for input text by KeyPhraseExtractionSkill. + */ +public final class KeyPhraseExtractionSkillLanguage extends ExpandableStringEnum { + /** + * Danish. + */ + @Generated + public static final KeyPhraseExtractionSkillLanguage DA = fromString("da"); + + /** + * Dutch. + */ + @Generated + public static final KeyPhraseExtractionSkillLanguage NL = fromString("nl"); + + /** + * English. + */ + @Generated + public static final KeyPhraseExtractionSkillLanguage EN = fromString("en"); + + /** + * Finnish. + */ + @Generated + public static final KeyPhraseExtractionSkillLanguage FI = fromString("fi"); + + /** + * French. + */ + @Generated + public static final KeyPhraseExtractionSkillLanguage FR = fromString("fr"); + + /** + * German. + */ + @Generated + public static final KeyPhraseExtractionSkillLanguage DE = fromString("de"); + + /** + * Italian. + */ + @Generated + public static final KeyPhraseExtractionSkillLanguage IT = fromString("it"); + + /** + * Japanese. + */ + @Generated + public static final KeyPhraseExtractionSkillLanguage JA = fromString("ja"); + + /** + * Korean. + */ + @Generated + public static final KeyPhraseExtractionSkillLanguage KO = fromString("ko"); + + /** + * Norwegian (Bokmaal). + */ + @Generated + public static final KeyPhraseExtractionSkillLanguage NO = fromString("no"); + + /** + * Polish. + */ + @Generated + public static final KeyPhraseExtractionSkillLanguage PL = fromString("pl"); + + /** + * Portuguese (Portugal). + */ + @Generated + public static final KeyPhraseExtractionSkillLanguage PT_PT = fromString("pt-PT"); + + /** + * Portuguese (Brazil). + */ + @Generated + public static final KeyPhraseExtractionSkillLanguage PT_BR = fromString("pt-BR"); + + /** + * Russian. + */ + @Generated + public static final KeyPhraseExtractionSkillLanguage RU = fromString("ru"); + + /** + * Spanish. + */ + @Generated + public static final KeyPhraseExtractionSkillLanguage ES = fromString("es"); + + /** + * Swedish. + */ + @Generated + public static final KeyPhraseExtractionSkillLanguage SV = fromString("sv"); + + /** + * Creates a new instance of KeyPhraseExtractionSkillLanguage value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public KeyPhraseExtractionSkillLanguage() { + } + + /** + * Creates or finds a KeyPhraseExtractionSkillLanguage from its string representation. + * + * @param name a name to look for. + * @return the corresponding KeyPhraseExtractionSkillLanguage. + */ + @Generated + public static KeyPhraseExtractionSkillLanguage fromString(String name) { + return fromString(name, KeyPhraseExtractionSkillLanguage.class); + } + + /** + * Gets known KeyPhraseExtractionSkillLanguage values. + * + * @return known KeyPhraseExtractionSkillLanguage values. + */ + @Generated + public static Collection values() { + return values(KeyPhraseExtractionSkillLanguage.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeywordMarkerTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeywordMarkerTokenFilter.java new file mode 100644 index 000000000000..f19184a8ab79 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeywordMarkerTokenFilter.java @@ -0,0 +1,162 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Marks terms as keywords. This token filter is implemented using Apache Lucene. + */ +@Fluent +public final class KeywordMarkerTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.KeywordMarkerTokenFilter"; + + /* + * A list of words to mark as keywords. + */ + @Generated + private List keywords; + + /* + * A value indicating whether to ignore case. If true, all words are converted to lower case first. Default is + * false. + */ + @Generated + private Boolean ignoreCase; + + /** + * Creates an instance of KeywordMarkerTokenFilter class. + */ + @Generated + public KeywordMarkerTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the keywords property: A list of words to mark as keywords. + * + * @return the keywords value. + */ + @Generated + public List getKeywords() { + return this.keywords; + } + + /** + * Set the keywords property: A list of words to mark as keywords. + * + * @param keywords the keywords value to set. + * @return the KeywordMarkerTokenFilter object itself. + */ + @Generated + public KeywordMarkerTokenFilter setKeywords(List keywords) { + this.keywords = keywords; + return this; + } + + /** + * Get the ignoreCase property: A value indicating whether to ignore case. If true, all words are converted to lower + * case first. Default is false. + * + * @return the ignoreCase value. + */ + @Generated + public Boolean isIgnoreCase() { + return this.ignoreCase; + } + + /** + * Set the ignoreCase property: A value indicating whether to ignore case. If true, all words are converted to lower + * case first. Default is false. + * + * @param ignoreCase the ignoreCase value to set. + * @return the KeywordMarkerTokenFilter object itself. + */ + @Generated + public KeywordMarkerTokenFilter setIgnoreCase(Boolean ignoreCase) { + this.ignoreCase = ignoreCase; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KeywordMarkerTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeArrayField("keywords", this.keywords, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeBooleanField("ignoreCase", this.ignoreCase); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KeywordMarkerTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KeywordMarkerTokenFilter 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 KeywordMarkerTokenFilter. + */ + @Generated + public static KeywordMarkerTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KeywordMarkerTokenFilter deserializedKeywordMarkerTokenFilter = new KeywordMarkerTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedKeywordMarkerTokenFilter.setName(reader.getString()); + } else if ("keywords".equals(fieldName)) { + List keywords = reader.readArray(reader1 -> reader1.getString()); + deserializedKeywordMarkerTokenFilter.keywords = keywords; + } else if ("@odata.type".equals(fieldName)) { + deserializedKeywordMarkerTokenFilter.odataType = reader.getString(); + } else if ("ignoreCase".equals(fieldName)) { + deserializedKeywordMarkerTokenFilter.ignoreCase = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedKeywordMarkerTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeywordTokenizer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeywordTokenizer.java new file mode 100644 index 000000000000..874339e1a523 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeywordTokenizer.java @@ -0,0 +1,126 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Emits the entire input as a single token. This tokenizer is implemented using Apache Lucene. + */ +@Fluent +public final class KeywordTokenizer extends LexicalTokenizer { + /* + * A URI fragment specifying the type of tokenizer. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.KeywordTokenizer"; + + /* + * The read buffer size in bytes. Default is 256. + */ + @Generated + private Integer bufferSize; + + /** + * Creates an instance of KeywordTokenizer class. + */ + @Generated + public KeywordTokenizer() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of tokenizer. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the bufferSize property: The read buffer size in bytes. Default is 256. + * + * @return the bufferSize value. + */ + @Generated + public Integer getBufferSize() { + return this.bufferSize; + } + + /** + * Set the bufferSize property: The read buffer size in bytes. Default is 256. + * + * @param bufferSize the bufferSize value to set. + * @return the KeywordTokenizer object itself. + */ + @Generated + public KeywordTokenizer setBufferSize(Integer bufferSize) { + this.bufferSize = bufferSize; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KeywordTokenizer setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("bufferSize", this.bufferSize); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KeywordTokenizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KeywordTokenizer 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 KeywordTokenizer. + */ + @Generated + public static KeywordTokenizer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KeywordTokenizer deserializedKeywordTokenizer = new KeywordTokenizer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedKeywordTokenizer.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedKeywordTokenizer.odataType = reader.getString(); + } else if ("bufferSize".equals(fieldName)) { + deserializedKeywordTokenizer.bufferSize = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedKeywordTokenizer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeywordTokenizerV2.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeywordTokenizerV2.java new file mode 100644 index 000000000000..d5b4762a48a2 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KeywordTokenizerV2.java @@ -0,0 +1,129 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Emits the entire input as a single token. This tokenizer is implemented using Apache Lucene. + */ +@Fluent +public final class KeywordTokenizerV2 extends LexicalTokenizer { + /* + * A URI fragment specifying the type of tokenizer. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.KeywordTokenizerV2"; + + /* + * The maximum token length. Default is 256. Tokens longer than the maximum length are split. The maximum token + * length that can be used is 300 characters. + */ + @Generated + private Integer maxTokenLength; + + /** + * Creates an instance of KeywordTokenizerV2 class. + */ + @Generated + public KeywordTokenizerV2() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of tokenizer. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the maxTokenLength property: The maximum token length. Default is 256. Tokens longer than the maximum length + * are split. The maximum token length that can be used is 300 characters. + * + * @return the maxTokenLength value. + */ + @Generated + public Integer getMaxTokenLength() { + return this.maxTokenLength; + } + + /** + * Set the maxTokenLength property: The maximum token length. Default is 256. Tokens longer than the maximum length + * are split. The maximum token length that can be used is 300 characters. + * + * @param maxTokenLength the maxTokenLength value to set. + * @return the KeywordTokenizerV2 object itself. + */ + @Generated + public KeywordTokenizerV2 setMaxTokenLength(Integer maxTokenLength) { + this.maxTokenLength = maxTokenLength; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KeywordTokenizerV2 setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("maxTokenLength", this.maxTokenLength); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KeywordTokenizerV2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KeywordTokenizerV2 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 KeywordTokenizerV2. + */ + @Generated + public static KeywordTokenizerV2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KeywordTokenizerV2 deserializedKeywordTokenizerV2 = new KeywordTokenizerV2(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedKeywordTokenizerV2.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedKeywordTokenizerV2.odataType = reader.getString(); + } else if ("maxTokenLength".equals(fieldName)) { + deserializedKeywordTokenizerV2.maxTokenLength = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedKeywordTokenizerV2; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBase.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBase.java new file mode 100644 index 000000000000..91bcf3d65335 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBase.java @@ -0,0 +1,401 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 KnowledgeBase model. + */ +@Fluent +public final class KnowledgeBase implements JsonSerializable { + /* + * The name of the knowledge knowledge base. + */ + @Generated + private String name; + + /* + * The knowledgeSources property. + */ + @Generated + private List knowledgeSources; + + /* + * Contains configuration options on how to connect to AI models. + */ + @Generated + private List models; + + /* + * The retrievalReasoningEffort property. + */ + @Generated + private KnowledgeRetrievalReasoningEffort retrievalReasoningEffort; + + /* + * The output configuration for this retrieval. + */ + @Generated + private KnowledgeRetrievalOutputMode outputMode; + + /* + * The ETag of the knowledge base. + */ + @Generated + private String eTag; + + /* + * 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 knowledge base definition when you want full assurance that no one, not even + * Microsoft, can decrypt them. Once you have encrypted your knowledge base definition, it will always remain + * encrypted. The search service will ignore attempts to set this property to null. You can change this property as + * needed if you want to rotate your encryption key; Your knowledge base definition will be unaffected. Encryption + * with customer-managed keys is not available for free search services, and is only available for paid services + * created on or after January 1, 2019. + */ + @Generated + private SearchResourceEncryptionKey encryptionKey; + + /* + * The description of the knowledge base. + */ + @Generated + private String description; + + /* + * Instructions considered by the knowledge knowledge base when developing query plan. + */ + @Generated + private String retrievalInstructions; + + /* + * Instructions considered by the knowledge knowledge base when generating answers. + */ + @Generated + private String answerInstructions; + + /** + * Creates an instance of KnowledgeBase class. + */ + @Generated + public KnowledgeBase() { + } + + /** + * Get the name property: The name of the knowledge knowledge base. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the knowledge knowledge base. + * + * @param name the name value to set. + * @return the KnowledgeBase object itself. + */ + @Generated + public KnowledgeBase setName(String name) { + this.name = name; + return this; + } + + /** + * Get the knowledgeSources property: The knowledgeSources property. + * + * @return the knowledgeSources value. + */ + @Generated + public List getKnowledgeSources() { + return this.knowledgeSources; + } + + /** + * Set the knowledgeSources property: The knowledgeSources property. + * + * @param knowledgeSources the knowledgeSources value to set. + * @return the KnowledgeBase object itself. + */ + @Generated + public KnowledgeBase setKnowledgeSources(List knowledgeSources) { + this.knowledgeSources = knowledgeSources; + return this; + } + + /** + * Get the models property: Contains configuration options on how to connect to AI models. + * + * @return the models value. + */ + @Generated + public List getModels() { + return this.models; + } + + /** + * Set the models property: Contains configuration options on how to connect to AI models. + * + * @param models the models value to set. + * @return the KnowledgeBase object itself. + */ + @Generated + public KnowledgeBase setModels(List models) { + this.models = models; + return this; + } + + /** + * Get the retrievalReasoningEffort property: The retrievalReasoningEffort property. + * + * @return the retrievalReasoningEffort value. + */ + @Generated + public KnowledgeRetrievalReasoningEffort getRetrievalReasoningEffort() { + return this.retrievalReasoningEffort; + } + + /** + * Set the retrievalReasoningEffort property: The retrievalReasoningEffort property. + * + * @param retrievalReasoningEffort the retrievalReasoningEffort value to set. + * @return the KnowledgeBase object itself. + */ + @Generated + public KnowledgeBase setRetrievalReasoningEffort(KnowledgeRetrievalReasoningEffort retrievalReasoningEffort) { + this.retrievalReasoningEffort = retrievalReasoningEffort; + return this; + } + + /** + * Get the outputMode property: The output configuration for this retrieval. + * + * @return the outputMode value. + */ + @Generated + public KnowledgeRetrievalOutputMode getOutputMode() { + return this.outputMode; + } + + /** + * Set the outputMode property: The output configuration for this retrieval. + * + * @param outputMode the outputMode value to set. + * @return the KnowledgeBase object itself. + */ + @Generated + public KnowledgeBase setOutputMode(KnowledgeRetrievalOutputMode outputMode) { + this.outputMode = outputMode; + return this; + } + + /** + * Get the eTag property: The ETag of the knowledge base. + * + * @return the eTag value. + */ + @Generated + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag of the knowledge base. + * + * @param eTag the eTag value to set. + * @return the KnowledgeBase object itself. + */ + @Generated + public KnowledgeBase setETag(String eTag) { + this.eTag = eTag; + 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 knowledge base definition when you want + * full assurance that no one, not even Microsoft, can decrypt them. Once you have encrypted your knowledge base + * definition, it will always remain encrypted. The search service will ignore attempts to set this property to + * null. You can change this property as needed if you want to rotate your encryption key; Your knowledge base + * definition will be unaffected. Encryption with customer-managed keys is not available for free search services, + * and is only available for paid services created on or after January 1, 2019. + * + * @return the encryptionKey value. + */ + @Generated + public SearchResourceEncryptionKey getEncryptionKey() { + return this.encryptionKey; + } + + /** + * Set 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 knowledge base definition when you want + * full assurance that no one, not even Microsoft, can decrypt them. Once you have encrypted your knowledge base + * definition, it will always remain encrypted. The search service will ignore attempts to set this property to + * null. You can change this property as needed if you want to rotate your encryption key; Your knowledge base + * definition will be unaffected. Encryption with customer-managed keys is not available for free search services, + * and is only available for paid services created on or after January 1, 2019. + * + * @param encryptionKey the encryptionKey value to set. + * @return the KnowledgeBase object itself. + */ + @Generated + public KnowledgeBase setEncryptionKey(SearchResourceEncryptionKey encryptionKey) { + this.encryptionKey = encryptionKey; + return this; + } + + /** + * Get the description property: The description of the knowledge base. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description of the knowledge base. + * + * @param description the description value to set. + * @return the KnowledgeBase object itself. + */ + @Generated + public KnowledgeBase setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the retrievalInstructions property: Instructions considered by the knowledge knowledge base when developing + * query plan. + * + * @return the retrievalInstructions value. + */ + @Generated + public String getRetrievalInstructions() { + return this.retrievalInstructions; + } + + /** + * Set the retrievalInstructions property: Instructions considered by the knowledge knowledge base when developing + * query plan. + * + * @param retrievalInstructions the retrievalInstructions value to set. + * @return the KnowledgeBase object itself. + */ + @Generated + public KnowledgeBase setRetrievalInstructions(String retrievalInstructions) { + this.retrievalInstructions = retrievalInstructions; + return this; + } + + /** + * Get the answerInstructions property: Instructions considered by the knowledge knowledge base when generating + * answers. + * + * @return the answerInstructions value. + */ + @Generated + public String getAnswerInstructions() { + return this.answerInstructions; + } + + /** + * Set the answerInstructions property: Instructions considered by the knowledge knowledge base when generating + * answers. + * + * @param answerInstructions the answerInstructions value to set. + * @return the KnowledgeBase object itself. + */ + @Generated + public KnowledgeBase setAnswerInstructions(String answerInstructions) { + this.answerInstructions = answerInstructions; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeArrayField("knowledgeSources", this.knowledgeSources, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("models", this.models, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("retrievalReasoningEffort", this.retrievalReasoningEffort); + jsonWriter.writeStringField("outputMode", this.outputMode == null ? null : this.outputMode.toString()); + jsonWriter.writeStringField("@odata.etag", this.eTag); + jsonWriter.writeJsonField("encryptionKey", this.encryptionKey); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("retrievalInstructions", this.retrievalInstructions); + jsonWriter.writeStringField("answerInstructions", this.answerInstructions); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBase from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBase 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 KnowledgeBase. + */ + @Generated + public static KnowledgeBase fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBase deserializedKnowledgeBase = new KnowledgeBase(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedKnowledgeBase.name = reader.getString(); + } else if ("knowledgeSources".equals(fieldName)) { + List knowledgeSources + = reader.readArray(reader1 -> KnowledgeSourceReference.fromJson(reader1)); + deserializedKnowledgeBase.knowledgeSources = knowledgeSources; + } else if ("models".equals(fieldName)) { + List models = reader.readArray(reader1 -> KnowledgeBaseModel.fromJson(reader1)); + deserializedKnowledgeBase.models = models; + } else if ("retrievalReasoningEffort".equals(fieldName)) { + deserializedKnowledgeBase.retrievalReasoningEffort + = KnowledgeRetrievalReasoningEffort.fromJson(reader); + } else if ("outputMode".equals(fieldName)) { + deserializedKnowledgeBase.outputMode = KnowledgeRetrievalOutputMode.fromString(reader.getString()); + } else if ("@odata.etag".equals(fieldName)) { + deserializedKnowledgeBase.eTag = reader.getString(); + } else if ("encryptionKey".equals(fieldName)) { + deserializedKnowledgeBase.encryptionKey = SearchResourceEncryptionKey.fromJson(reader); + } else if ("description".equals(fieldName)) { + deserializedKnowledgeBase.description = reader.getString(); + } else if ("retrievalInstructions".equals(fieldName)) { + deserializedKnowledgeBase.retrievalInstructions = reader.getString(); + } else if ("answerInstructions".equals(fieldName)) { + deserializedKnowledgeBase.answerInstructions = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBase; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseActivityRecord.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseActivityRecord.java new file mode 100644 index 000000000000..b8f812919f37 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseActivityRecord.java @@ -0,0 +1,222 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 activity records. + */ +@Fluent +public class KnowledgeBaseActivityRecord implements JsonSerializable { + /* + * The type of the activity record. + */ + @Generated + private String type = "KnowledgeBaseActivityRecord"; + + /* + * The ID of the activity record. + */ + @Generated + private int id; + + /* + * The elapsed time in milliseconds for the retrieval activity. + */ + @Generated + private Integer elapsedMs; + + /* + * The error detail explaining why the operation failed. This property is only included when the activity does not + * succeed. + */ + @Generated + private KnowledgeBaseErrorDetail error; + + /** + * Creates an instance of KnowledgeBaseActivityRecord class. + */ + @Generated + public KnowledgeBaseActivityRecord() { + } + + /** + * Get the type property: The type of the activity record. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * Get the id property: The ID of the activity record. + * + * @return the id value. + */ + @Generated + public int getId() { + return this.id; + } + + /** + * Set the id property: The ID of the activity record. + * + * @param id the id value to set. + * @return the KnowledgeBaseActivityRecord object itself. + */ + @Generated + public KnowledgeBaseActivityRecord setId(int id) { + this.id = id; + return this; + } + + /** + * Get the elapsedMs property: The elapsed time in milliseconds for the retrieval activity. + * + * @return the elapsedMs value. + */ + @Generated + public Integer getElapsedMs() { + return this.elapsedMs; + } + + /** + * Set the elapsedMs property: The elapsed time in milliseconds for the retrieval activity. + * + * @param elapsedMs the elapsedMs value to set. + * @return the KnowledgeBaseActivityRecord object itself. + */ + @Generated + public KnowledgeBaseActivityRecord setElapsedMs(Integer elapsedMs) { + this.elapsedMs = elapsedMs; + return this; + } + + /** + * Get the error property: The error detail explaining why the operation failed. This property is only included when + * the activity does not succeed. + * + * @return the error value. + */ + @Generated + public KnowledgeBaseErrorDetail getError() { + return this.error; + } + + /** + * Set the error property: The error detail explaining why the operation failed. This property is only included when + * the activity does not succeed. + * + * @param error the error value to set. + * @return the KnowledgeBaseActivityRecord object itself. + */ + @Generated + public KnowledgeBaseActivityRecord setError(KnowledgeBaseErrorDetail error) { + this.error = error; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("id", this.id); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeNumberField("elapsedMs", this.elapsedMs); + jsonWriter.writeJsonField("error", this.error); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseActivityRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseActivityRecord 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 KnowledgeBaseActivityRecord. + */ + @Generated + public static KnowledgeBaseActivityRecord 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 ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("KnowledgeBaseRetrievalActivityRecord".equals(discriminatorValue)) { + return KnowledgeBaseRetrievalActivityRecord.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("searchIndex".equals(discriminatorValue)) { + return KnowledgeBaseSearchIndexActivityRecord.fromJson(readerToUse.reset()); + } else if ("azureBlob".equals(discriminatorValue)) { + return KnowledgeBaseAzureBlobActivityRecord.fromJson(readerToUse.reset()); + } else if ("indexedSharePoint".equals(discriminatorValue)) { + return KnowledgeBaseIndexedSharePointActivityRecord.fromJson(readerToUse.reset()); + } else if ("indexedOneLake".equals(discriminatorValue)) { + return KnowledgeBaseIndexedOneLakeActivityRecord.fromJson(readerToUse.reset()); + } else if ("web".equals(discriminatorValue)) { + return KnowledgeBaseWebActivityRecord.fromJson(readerToUse.reset()); + } else if ("remoteSharePoint".equals(discriminatorValue)) { + return KnowledgeBaseRemoteSharePointActivityRecord.fromJson(readerToUse.reset()); + } else if ("modelQueryPlanning".equals(discriminatorValue)) { + return KnowledgeBaseModelQueryPlanningActivityRecord.fromJson(readerToUse.reset()); + } else if ("modelAnswerSynthesis".equals(discriminatorValue)) { + return KnowledgeBaseModelAnswerSynthesisActivityRecord.fromJson(readerToUse.reset()); + } else if ("agenticReasoning".equals(discriminatorValue)) { + return KnowledgeBaseAgenticReasoningActivityRecord.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static KnowledgeBaseActivityRecord fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseActivityRecord deserializedKnowledgeBaseActivityRecord = new KnowledgeBaseActivityRecord(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedKnowledgeBaseActivityRecord.id = reader.getInt(); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseActivityRecord.type = reader.getString(); + } else if ("elapsedMs".equals(fieldName)) { + deserializedKnowledgeBaseActivityRecord.elapsedMs = reader.getNullable(JsonReader::getInt); + } else if ("error".equals(fieldName)) { + deserializedKnowledgeBaseActivityRecord.error = KnowledgeBaseErrorDetail.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseActivityRecord; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAgenticReasoningActivityRecord.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAgenticReasoningActivityRecord.java new file mode 100644 index 000000000000..d9605effe4be --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAgenticReasoningActivityRecord.java @@ -0,0 +1,189 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents an agentic reasoning activity record. + */ +@Fluent +public final class KnowledgeBaseAgenticReasoningActivityRecord extends KnowledgeBaseActivityRecord { + /* + * The type of the activity record. + */ + @Generated + private String type = "agenticReasoning"; + + /* + * The number of input tokens for agentic reasoning. + */ + @Generated + private Integer reasoningTokens; + + /* + * The retrievalReasoningEffort property. + */ + @Generated + private KnowledgeRetrievalReasoningEffort retrievalReasoningEffort; + + /** + * Creates an instance of KnowledgeBaseAgenticReasoningActivityRecord class. + */ + @Generated + public KnowledgeBaseAgenticReasoningActivityRecord() { + } + + /** + * Get the type property: The type of the activity record. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the reasoningTokens property: The number of input tokens for agentic reasoning. + * + * @return the reasoningTokens value. + */ + @Generated + public Integer getReasoningTokens() { + return this.reasoningTokens; + } + + /** + * Set the reasoningTokens property: The number of input tokens for agentic reasoning. + * + * @param reasoningTokens the reasoningTokens value to set. + * @return the KnowledgeBaseAgenticReasoningActivityRecord object itself. + */ + @Generated + public KnowledgeBaseAgenticReasoningActivityRecord setReasoningTokens(Integer reasoningTokens) { + this.reasoningTokens = reasoningTokens; + return this; + } + + /** + * Get the retrievalReasoningEffort property: The retrievalReasoningEffort property. + * + * @return the retrievalReasoningEffort value. + */ + @Generated + public KnowledgeRetrievalReasoningEffort getRetrievalReasoningEffort() { + return this.retrievalReasoningEffort; + } + + /** + * Set the retrievalReasoningEffort property: The retrievalReasoningEffort property. + * + * @param retrievalReasoningEffort the retrievalReasoningEffort value to set. + * @return the KnowledgeBaseAgenticReasoningActivityRecord object itself. + */ + @Generated + public KnowledgeBaseAgenticReasoningActivityRecord + setRetrievalReasoningEffort(KnowledgeRetrievalReasoningEffort retrievalReasoningEffort) { + this.retrievalReasoningEffort = retrievalReasoningEffort; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseAgenticReasoningActivityRecord setId(int id) { + super.setId(id); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseAgenticReasoningActivityRecord setElapsedMs(Integer elapsedMs) { + super.setElapsedMs(elapsedMs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseAgenticReasoningActivityRecord setError(KnowledgeBaseErrorDetail error) { + super.setError(error); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("id", getId()); + jsonWriter.writeNumberField("elapsedMs", getElapsedMs()); + jsonWriter.writeJsonField("error", getError()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeNumberField("reasoningTokens", this.reasoningTokens); + jsonWriter.writeJsonField("retrievalReasoningEffort", this.retrievalReasoningEffort); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseAgenticReasoningActivityRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseAgenticReasoningActivityRecord 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 KnowledgeBaseAgenticReasoningActivityRecord. + */ + @Generated + public static KnowledgeBaseAgenticReasoningActivityRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseAgenticReasoningActivityRecord deserializedKnowledgeBaseAgenticReasoningActivityRecord + = new KnowledgeBaseAgenticReasoningActivityRecord(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedKnowledgeBaseAgenticReasoningActivityRecord.setId(reader.getInt()); + } else if ("elapsedMs".equals(fieldName)) { + deserializedKnowledgeBaseAgenticReasoningActivityRecord + .setElapsedMs(reader.getNullable(JsonReader::getInt)); + } else if ("error".equals(fieldName)) { + deserializedKnowledgeBaseAgenticReasoningActivityRecord + .setError(KnowledgeBaseErrorDetail.fromJson(reader)); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseAgenticReasoningActivityRecord.type = reader.getString(); + } else if ("reasoningTokens".equals(fieldName)) { + deserializedKnowledgeBaseAgenticReasoningActivityRecord.reasoningTokens + = reader.getNullable(JsonReader::getInt); + } else if ("retrievalReasoningEffort".equals(fieldName)) { + deserializedKnowledgeBaseAgenticReasoningActivityRecord.retrievalReasoningEffort + = KnowledgeRetrievalReasoningEffort.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseAgenticReasoningActivityRecord; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAzureBlobActivityArguments.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAzureBlobActivityArguments.java new file mode 100644 index 000000000000..338de4154116 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAzureBlobActivityArguments.java @@ -0,0 +1,95 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents the arguments the azure blob retrieval activity was run with. + */ +@Fluent +public final class KnowledgeBaseAzureBlobActivityArguments + implements JsonSerializable { + /* + * The search string used to query blob contents. + */ + @Generated + private String search; + + /** + * Creates an instance of KnowledgeBaseAzureBlobActivityArguments class. + */ + @Generated + public KnowledgeBaseAzureBlobActivityArguments() { + } + + /** + * Get the search property: The search string used to query blob contents. + * + * @return the search value. + */ + @Generated + public String getSearch() { + return this.search; + } + + /** + * Set the search property: The search string used to query blob contents. + * + * @param search the search value to set. + * @return the KnowledgeBaseAzureBlobActivityArguments object itself. + */ + @Generated + public KnowledgeBaseAzureBlobActivityArguments setSearch(String search) { + this.search = search; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("search", this.search); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseAzureBlobActivityArguments from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseAzureBlobActivityArguments 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 KnowledgeBaseAzureBlobActivityArguments. + */ + @Generated + public static KnowledgeBaseAzureBlobActivityArguments fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseAzureBlobActivityArguments deserializedKnowledgeBaseAzureBlobActivityArguments + = new KnowledgeBaseAzureBlobActivityArguments(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("search".equals(fieldName)) { + deserializedKnowledgeBaseAzureBlobActivityArguments.search = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseAzureBlobActivityArguments; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAzureBlobActivityRecord.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAzureBlobActivityRecord.java new file mode 100644 index 000000000000..20118febcb2a --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAzureBlobActivityRecord.java @@ -0,0 +1,201 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Represents a azure blob retrieval activity record. + */ +@Fluent +public final class KnowledgeBaseAzureBlobActivityRecord extends KnowledgeBaseRetrievalActivityRecord { + /* + * The type of the activity record. + */ + @Generated + private String type = "azureBlob"; + + /* + * The azure blob arguments for the retrieval activity. + */ + @Generated + private KnowledgeBaseAzureBlobActivityArguments azureBlobArguments; + + /** + * Creates an instance of KnowledgeBaseAzureBlobActivityRecord class. + */ + @Generated + public KnowledgeBaseAzureBlobActivityRecord() { + } + + /** + * Get the type property: The type of the activity record. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the azureBlobArguments property: The azure blob arguments for the retrieval activity. + * + * @return the azureBlobArguments value. + */ + @Generated + public KnowledgeBaseAzureBlobActivityArguments getAzureBlobArguments() { + return this.azureBlobArguments; + } + + /** + * Set the azureBlobArguments property: The azure blob arguments for the retrieval activity. + * + * @param azureBlobArguments the azureBlobArguments value to set. + * @return the KnowledgeBaseAzureBlobActivityRecord object itself. + */ + @Generated + public KnowledgeBaseAzureBlobActivityRecord + setAzureBlobArguments(KnowledgeBaseAzureBlobActivityArguments azureBlobArguments) { + this.azureBlobArguments = azureBlobArguments; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseAzureBlobActivityRecord setKnowledgeSourceName(String knowledgeSourceName) { + super.setKnowledgeSourceName(knowledgeSourceName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseAzureBlobActivityRecord setQueryTime(OffsetDateTime queryTime) { + super.setQueryTime(queryTime); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseAzureBlobActivityRecord setCount(Integer count) { + super.setCount(count); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseAzureBlobActivityRecord setId(int id) { + super.setId(id); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseAzureBlobActivityRecord setElapsedMs(Integer elapsedMs) { + super.setElapsedMs(elapsedMs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseAzureBlobActivityRecord setError(KnowledgeBaseErrorDetail error) { + super.setError(error); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("id", getId()); + jsonWriter.writeNumberField("elapsedMs", getElapsedMs()); + jsonWriter.writeJsonField("error", getError()); + jsonWriter.writeStringField("knowledgeSourceName", getKnowledgeSourceName()); + jsonWriter.writeStringField("queryTime", + getQueryTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getQueryTime())); + jsonWriter.writeNumberField("count", getCount()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("azureBlobArguments", this.azureBlobArguments); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseAzureBlobActivityRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseAzureBlobActivityRecord 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 KnowledgeBaseAzureBlobActivityRecord. + */ + @Generated + public static KnowledgeBaseAzureBlobActivityRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseAzureBlobActivityRecord deserializedKnowledgeBaseAzureBlobActivityRecord + = new KnowledgeBaseAzureBlobActivityRecord(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedKnowledgeBaseAzureBlobActivityRecord.setId(reader.getInt()); + } else if ("elapsedMs".equals(fieldName)) { + deserializedKnowledgeBaseAzureBlobActivityRecord + .setElapsedMs(reader.getNullable(JsonReader::getInt)); + } else if ("error".equals(fieldName)) { + deserializedKnowledgeBaseAzureBlobActivityRecord + .setError(KnowledgeBaseErrorDetail.fromJson(reader)); + } else if ("knowledgeSourceName".equals(fieldName)) { + deserializedKnowledgeBaseAzureBlobActivityRecord.setKnowledgeSourceName(reader.getString()); + } else if ("queryTime".equals(fieldName)) { + deserializedKnowledgeBaseAzureBlobActivityRecord.setQueryTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("count".equals(fieldName)) { + deserializedKnowledgeBaseAzureBlobActivityRecord.setCount(reader.getNullable(JsonReader::getInt)); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseAzureBlobActivityRecord.type = reader.getString(); + } else if ("azureBlobArguments".equals(fieldName)) { + deserializedKnowledgeBaseAzureBlobActivityRecord.azureBlobArguments + = KnowledgeBaseAzureBlobActivityArguments.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseAzureBlobActivityRecord; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAzureBlobReference.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAzureBlobReference.java new file mode 100644 index 000000000000..dd2d6a574a67 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAzureBlobReference.java @@ -0,0 +1,169 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Represents an Azure Blob Storage document reference. + */ +@Fluent +public final class KnowledgeBaseAzureBlobReference extends KnowledgeBaseReference { + /* + * The type of the reference. + */ + @Generated + private String type = "azureBlob"; + + /* + * The blob URL for the reference. + */ + @Generated + private String blobUrl; + + /** + * Creates an instance of KnowledgeBaseAzureBlobReference class. + */ + @Generated + public KnowledgeBaseAzureBlobReference() { + } + + /** + * Get the type property: The type of the reference. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the blobUrl property: The blob URL for the reference. + * + * @return the blobUrl value. + */ + @Generated + public String getBlobUrl() { + return this.blobUrl; + } + + /** + * Set the blobUrl property: The blob URL for the reference. + * + * @param blobUrl the blobUrl value to set. + * @return the KnowledgeBaseAzureBlobReference object itself. + */ + @Generated + public KnowledgeBaseAzureBlobReference setBlobUrl(String blobUrl) { + this.blobUrl = blobUrl; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseAzureBlobReference setId(String id) { + super.setId(id); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseAzureBlobReference setActivitySource(int activitySource) { + super.setActivitySource(activitySource); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseAzureBlobReference setSourceData(Map sourceData) { + super.setSourceData(sourceData); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseAzureBlobReference setRerankerScore(Float rerankerScore) { + super.setRerankerScore(rerankerScore); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeIntField("activitySource", getActivitySource()); + jsonWriter.writeMapField("sourceData", getSourceData(), (writer, element) -> writer.writeUntyped(element)); + jsonWriter.writeNumberField("rerankerScore", getRerankerScore()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("blobUrl", this.blobUrl); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseAzureBlobReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseAzureBlobReference 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 KnowledgeBaseAzureBlobReference. + */ + @Generated + public static KnowledgeBaseAzureBlobReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseAzureBlobReference deserializedKnowledgeBaseAzureBlobReference + = new KnowledgeBaseAzureBlobReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedKnowledgeBaseAzureBlobReference.setId(reader.getString()); + } else if ("activitySource".equals(fieldName)) { + deserializedKnowledgeBaseAzureBlobReference.setActivitySource(reader.getInt()); + } else if ("sourceData".equals(fieldName)) { + Map sourceData = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedKnowledgeBaseAzureBlobReference.setSourceData(sourceData); + } else if ("rerankerScore".equals(fieldName)) { + deserializedKnowledgeBaseAzureBlobReference + .setRerankerScore(reader.getNullable(JsonReader::getFloat)); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseAzureBlobReference.type = reader.getString(); + } else if ("blobUrl".equals(fieldName)) { + deserializedKnowledgeBaseAzureBlobReference.blobUrl = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseAzureBlobReference; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAzureOpenAIModel.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAzureOpenAIModel.java new file mode 100644 index 000000000000..c0f9a33ec92e --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseAzureOpenAIModel.java @@ -0,0 +1,116 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specifies the Azure OpenAI resource used to do query planning. + */ +@Fluent +public final class KnowledgeBaseAzureOpenAIModel extends KnowledgeBaseModel { + /* + * The type of AI model. + */ + @Generated + private KnowledgeBaseModelKind kind = KnowledgeBaseModelKind.AZURE_OPEN_AI; + + /* + * Contains the parameters specific to Azure OpenAI model endpoint. + */ + @Generated + private AzureOpenAIParameters azureOpenAIParameters; + + /** + * Creates an instance of KnowledgeBaseAzureOpenAIModel class. + */ + @Generated + public KnowledgeBaseAzureOpenAIModel() { + } + + /** + * Get the kind property: The type of AI model. + * + * @return the kind value. + */ + @Generated + @Override + public KnowledgeBaseModelKind getKind() { + return this.kind; + } + + /** + * Get the azureOpenAIParameters property: Contains the parameters specific to Azure OpenAI model endpoint. + * + * @return the azureOpenAIParameters value. + */ + @Generated + public AzureOpenAIParameters getAzureOpenAIParameters() { + return this.azureOpenAIParameters; + } + + /** + * Set the azureOpenAIParameters property: Contains the parameters specific to Azure OpenAI model endpoint. + * + * @param azureOpenAIParameters the azureOpenAIParameters value to set. + * @return the KnowledgeBaseAzureOpenAIModel object itself. + */ + @Generated + public KnowledgeBaseAzureOpenAIModel setAzureOpenAIParameters(AzureOpenAIParameters azureOpenAIParameters) { + this.azureOpenAIParameters = azureOpenAIParameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("azureOpenAIParameters", this.azureOpenAIParameters); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseAzureOpenAIModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseAzureOpenAIModel 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 KnowledgeBaseAzureOpenAIModel. + */ + @Generated + public static KnowledgeBaseAzureOpenAIModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseAzureOpenAIModel deserializedKnowledgeBaseAzureOpenAIModel + = new KnowledgeBaseAzureOpenAIModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("azureOpenAIParameters".equals(fieldName)) { + deserializedKnowledgeBaseAzureOpenAIModel.azureOpenAIParameters + = AzureOpenAIParameters.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedKnowledgeBaseAzureOpenAIModel.kind + = KnowledgeBaseModelKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseAzureOpenAIModel; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseErrorAdditionalInfo.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseErrorAdditionalInfo.java new file mode 100644 index 000000000000..14f81b827202 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseErrorAdditionalInfo.java @@ -0,0 +1,99 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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 resource management error additional info. + */ +@Immutable +public final class KnowledgeBaseErrorAdditionalInfo implements JsonSerializable { + /* + * The additional info type. + */ + @Generated + private String type; + + /* + * The additional info. + */ + @Generated + private Object info; + + /** + * Creates an instance of KnowledgeBaseErrorAdditionalInfo class. + */ + @Generated + public KnowledgeBaseErrorAdditionalInfo() { + } + + /** + * Get the type property: The additional info type. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * Get the info property: The additional info. + * + * @return the info value. + */ + @Generated + public Object getInfo() { + return this.info; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseErrorAdditionalInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseErrorAdditionalInfo 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 KnowledgeBaseErrorAdditionalInfo. + */ + @Generated + public static KnowledgeBaseErrorAdditionalInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseErrorAdditionalInfo deserializedKnowledgeBaseErrorAdditionalInfo + = new KnowledgeBaseErrorAdditionalInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedKnowledgeBaseErrorAdditionalInfo.type = reader.getString(); + } else if ("info".equals(fieldName)) { + deserializedKnowledgeBaseErrorAdditionalInfo.info = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseErrorAdditionalInfo; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseErrorDetail.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseErrorDetail.java new file mode 100644 index 000000000000..885073ac2187 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseErrorDetail.java @@ -0,0 +1,157 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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 error details. + */ +@Immutable +public final class KnowledgeBaseErrorDetail implements JsonSerializable { + /* + * The error code. + */ + @Generated + private String code; + + /* + * The error message. + */ + @Generated + private String message; + + /* + * The error target. + */ + @Generated + private String target; + + /* + * The error details. + */ + @Generated + private List details; + + /* + * The error additional info. + */ + @Generated + private List additionalInfo; + + /** + * Creates an instance of KnowledgeBaseErrorDetail class. + */ + @Generated + public KnowledgeBaseErrorDetail() { + } + + /** + * Get the code property: The error code. + * + * @return the code value. + */ + @Generated + public String getCode() { + return this.code; + } + + /** + * Get the message property: The error message. + * + * @return the message value. + */ + @Generated + public String getMessage() { + return this.message; + } + + /** + * Get the target property: The error target. + * + * @return the target value. + */ + @Generated + public String getTarget() { + return this.target; + } + + /** + * Get the details property: The error details. + * + * @return the details value. + */ + @Generated + public List getDetails() { + return this.details; + } + + /** + * Get the additionalInfo property: The error additional info. + * + * @return the additionalInfo value. + */ + @Generated + public List getAdditionalInfo() { + return this.additionalInfo; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseErrorDetail from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseErrorDetail 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 KnowledgeBaseErrorDetail. + */ + @Generated + public static KnowledgeBaseErrorDetail fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseErrorDetail deserializedKnowledgeBaseErrorDetail = new KnowledgeBaseErrorDetail(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedKnowledgeBaseErrorDetail.code = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedKnowledgeBaseErrorDetail.message = reader.getString(); + } else if ("target".equals(fieldName)) { + deserializedKnowledgeBaseErrorDetail.target = reader.getString(); + } else if ("details".equals(fieldName)) { + List details + = reader.readArray(reader1 -> KnowledgeBaseErrorDetail.fromJson(reader1)); + deserializedKnowledgeBaseErrorDetail.details = details; + } else if ("additionalInfo".equals(fieldName)) { + List additionalInfo + = reader.readArray(reader1 -> KnowledgeBaseErrorAdditionalInfo.fromJson(reader1)); + deserializedKnowledgeBaseErrorDetail.additionalInfo = additionalInfo; + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseErrorDetail; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedOneLakeActivityArguments.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedOneLakeActivityArguments.java new file mode 100644 index 000000000000..025bf55b9d60 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedOneLakeActivityArguments.java @@ -0,0 +1,95 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents the arguments the indexed OneLake retrieval activity was run with. + */ +@Fluent +public final class KnowledgeBaseIndexedOneLakeActivityArguments + implements JsonSerializable { + /* + * The search string used to query indexed OneLake contents. + */ + @Generated + private String search; + + /** + * Creates an instance of KnowledgeBaseIndexedOneLakeActivityArguments class. + */ + @Generated + public KnowledgeBaseIndexedOneLakeActivityArguments() { + } + + /** + * Get the search property: The search string used to query indexed OneLake contents. + * + * @return the search value. + */ + @Generated + public String getSearch() { + return this.search; + } + + /** + * Set the search property: The search string used to query indexed OneLake contents. + * + * @param search the search value to set. + * @return the KnowledgeBaseIndexedOneLakeActivityArguments object itself. + */ + @Generated + public KnowledgeBaseIndexedOneLakeActivityArguments setSearch(String search) { + this.search = search; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("search", this.search); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseIndexedOneLakeActivityArguments from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseIndexedOneLakeActivityArguments 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 KnowledgeBaseIndexedOneLakeActivityArguments. + */ + @Generated + public static KnowledgeBaseIndexedOneLakeActivityArguments fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseIndexedOneLakeActivityArguments deserializedKnowledgeBaseIndexedOneLakeActivityArguments + = new KnowledgeBaseIndexedOneLakeActivityArguments(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("search".equals(fieldName)) { + deserializedKnowledgeBaseIndexedOneLakeActivityArguments.search = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseIndexedOneLakeActivityArguments; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedOneLakeActivityRecord.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedOneLakeActivityRecord.java new file mode 100644 index 000000000000..e6a37c67c054 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedOneLakeActivityRecord.java @@ -0,0 +1,202 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Represents a indexed OneLake retrieval activity record. + */ +@Fluent +public final class KnowledgeBaseIndexedOneLakeActivityRecord extends KnowledgeBaseRetrievalActivityRecord { + /* + * The type of the activity record. + */ + @Generated + private String type = "indexedOneLake"; + + /* + * The indexed OneLake arguments for the retrieval activity. + */ + @Generated + private KnowledgeBaseIndexedOneLakeActivityArguments indexedOneLakeArguments; + + /** + * Creates an instance of KnowledgeBaseIndexedOneLakeActivityRecord class. + */ + @Generated + public KnowledgeBaseIndexedOneLakeActivityRecord() { + } + + /** + * Get the type property: The type of the activity record. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the indexedOneLakeArguments property: The indexed OneLake arguments for the retrieval activity. + * + * @return the indexedOneLakeArguments value. + */ + @Generated + public KnowledgeBaseIndexedOneLakeActivityArguments getIndexedOneLakeArguments() { + return this.indexedOneLakeArguments; + } + + /** + * Set the indexedOneLakeArguments property: The indexed OneLake arguments for the retrieval activity. + * + * @param indexedOneLakeArguments the indexedOneLakeArguments value to set. + * @return the KnowledgeBaseIndexedOneLakeActivityRecord object itself. + */ + @Generated + public KnowledgeBaseIndexedOneLakeActivityRecord + setIndexedOneLakeArguments(KnowledgeBaseIndexedOneLakeActivityArguments indexedOneLakeArguments) { + this.indexedOneLakeArguments = indexedOneLakeArguments; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedOneLakeActivityRecord setKnowledgeSourceName(String knowledgeSourceName) { + super.setKnowledgeSourceName(knowledgeSourceName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedOneLakeActivityRecord setQueryTime(OffsetDateTime queryTime) { + super.setQueryTime(queryTime); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedOneLakeActivityRecord setCount(Integer count) { + super.setCount(count); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedOneLakeActivityRecord setId(int id) { + super.setId(id); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedOneLakeActivityRecord setElapsedMs(Integer elapsedMs) { + super.setElapsedMs(elapsedMs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedOneLakeActivityRecord setError(KnowledgeBaseErrorDetail error) { + super.setError(error); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("id", getId()); + jsonWriter.writeNumberField("elapsedMs", getElapsedMs()); + jsonWriter.writeJsonField("error", getError()); + jsonWriter.writeStringField("knowledgeSourceName", getKnowledgeSourceName()); + jsonWriter.writeStringField("queryTime", + getQueryTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getQueryTime())); + jsonWriter.writeNumberField("count", getCount()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("indexedOneLakeArguments", this.indexedOneLakeArguments); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseIndexedOneLakeActivityRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseIndexedOneLakeActivityRecord 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 KnowledgeBaseIndexedOneLakeActivityRecord. + */ + @Generated + public static KnowledgeBaseIndexedOneLakeActivityRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseIndexedOneLakeActivityRecord deserializedKnowledgeBaseIndexedOneLakeActivityRecord + = new KnowledgeBaseIndexedOneLakeActivityRecord(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedKnowledgeBaseIndexedOneLakeActivityRecord.setId(reader.getInt()); + } else if ("elapsedMs".equals(fieldName)) { + deserializedKnowledgeBaseIndexedOneLakeActivityRecord + .setElapsedMs(reader.getNullable(JsonReader::getInt)); + } else if ("error".equals(fieldName)) { + deserializedKnowledgeBaseIndexedOneLakeActivityRecord + .setError(KnowledgeBaseErrorDetail.fromJson(reader)); + } else if ("knowledgeSourceName".equals(fieldName)) { + deserializedKnowledgeBaseIndexedOneLakeActivityRecord.setKnowledgeSourceName(reader.getString()); + } else if ("queryTime".equals(fieldName)) { + deserializedKnowledgeBaseIndexedOneLakeActivityRecord.setQueryTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("count".equals(fieldName)) { + deserializedKnowledgeBaseIndexedOneLakeActivityRecord + .setCount(reader.getNullable(JsonReader::getInt)); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseIndexedOneLakeActivityRecord.type = reader.getString(); + } else if ("indexedOneLakeArguments".equals(fieldName)) { + deserializedKnowledgeBaseIndexedOneLakeActivityRecord.indexedOneLakeArguments + = KnowledgeBaseIndexedOneLakeActivityArguments.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseIndexedOneLakeActivityRecord; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedOneLakeReference.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedOneLakeReference.java new file mode 100644 index 000000000000..e6e598360990 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedOneLakeReference.java @@ -0,0 +1,169 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Represents an Azure Blob Storage document reference. + */ +@Fluent +public final class KnowledgeBaseIndexedOneLakeReference extends KnowledgeBaseReference { + /* + * The type of the reference. + */ + @Generated + private String type = "indexedOneLake"; + + /* + * The document URL for the reference. + */ + @Generated + private String docUrl; + + /** + * Creates an instance of KnowledgeBaseIndexedOneLakeReference class. + */ + @Generated + public KnowledgeBaseIndexedOneLakeReference() { + } + + /** + * Get the type property: The type of the reference. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the docUrl property: The document URL for the reference. + * + * @return the docUrl value. + */ + @Generated + public String getDocUrl() { + return this.docUrl; + } + + /** + * Set the docUrl property: The document URL for the reference. + * + * @param docUrl the docUrl value to set. + * @return the KnowledgeBaseIndexedOneLakeReference object itself. + */ + @Generated + public KnowledgeBaseIndexedOneLakeReference setDocUrl(String docUrl) { + this.docUrl = docUrl; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedOneLakeReference setId(String id) { + super.setId(id); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedOneLakeReference setActivitySource(int activitySource) { + super.setActivitySource(activitySource); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedOneLakeReference setSourceData(Map sourceData) { + super.setSourceData(sourceData); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedOneLakeReference setRerankerScore(Float rerankerScore) { + super.setRerankerScore(rerankerScore); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeIntField("activitySource", getActivitySource()); + jsonWriter.writeMapField("sourceData", getSourceData(), (writer, element) -> writer.writeUntyped(element)); + jsonWriter.writeNumberField("rerankerScore", getRerankerScore()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("docUrl", this.docUrl); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseIndexedOneLakeReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseIndexedOneLakeReference 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 KnowledgeBaseIndexedOneLakeReference. + */ + @Generated + public static KnowledgeBaseIndexedOneLakeReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseIndexedOneLakeReference deserializedKnowledgeBaseIndexedOneLakeReference + = new KnowledgeBaseIndexedOneLakeReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedKnowledgeBaseIndexedOneLakeReference.setId(reader.getString()); + } else if ("activitySource".equals(fieldName)) { + deserializedKnowledgeBaseIndexedOneLakeReference.setActivitySource(reader.getInt()); + } else if ("sourceData".equals(fieldName)) { + Map sourceData = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedKnowledgeBaseIndexedOneLakeReference.setSourceData(sourceData); + } else if ("rerankerScore".equals(fieldName)) { + deserializedKnowledgeBaseIndexedOneLakeReference + .setRerankerScore(reader.getNullable(JsonReader::getFloat)); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseIndexedOneLakeReference.type = reader.getString(); + } else if ("docUrl".equals(fieldName)) { + deserializedKnowledgeBaseIndexedOneLakeReference.docUrl = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseIndexedOneLakeReference; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedSharePointActivityArguments.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedSharePointActivityArguments.java new file mode 100644 index 000000000000..9c394fe68b33 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedSharePointActivityArguments.java @@ -0,0 +1,95 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents the arguments the indexed SharePoint retrieval activity was run with. + */ +@Fluent +public final class KnowledgeBaseIndexedSharePointActivityArguments + implements JsonSerializable { + /* + * The search string used to query indexed SharePoint contents. + */ + @Generated + private String search; + + /** + * Creates an instance of KnowledgeBaseIndexedSharePointActivityArguments class. + */ + @Generated + public KnowledgeBaseIndexedSharePointActivityArguments() { + } + + /** + * Get the search property: The search string used to query indexed SharePoint contents. + * + * @return the search value. + */ + @Generated + public String getSearch() { + return this.search; + } + + /** + * Set the search property: The search string used to query indexed SharePoint contents. + * + * @param search the search value to set. + * @return the KnowledgeBaseIndexedSharePointActivityArguments object itself. + */ + @Generated + public KnowledgeBaseIndexedSharePointActivityArguments setSearch(String search) { + this.search = search; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("search", this.search); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseIndexedSharePointActivityArguments from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseIndexedSharePointActivityArguments 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 KnowledgeBaseIndexedSharePointActivityArguments. + */ + @Generated + public static KnowledgeBaseIndexedSharePointActivityArguments fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseIndexedSharePointActivityArguments deserializedKnowledgeBaseIndexedSharePointActivityArguments + = new KnowledgeBaseIndexedSharePointActivityArguments(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("search".equals(fieldName)) { + deserializedKnowledgeBaseIndexedSharePointActivityArguments.search = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseIndexedSharePointActivityArguments; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedSharePointActivityRecord.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedSharePointActivityRecord.java new file mode 100644 index 000000000000..1c82e5e790df --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedSharePointActivityRecord.java @@ -0,0 +1,202 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Represents a indexed SharePoint retrieval activity record. + */ +@Fluent +public final class KnowledgeBaseIndexedSharePointActivityRecord extends KnowledgeBaseRetrievalActivityRecord { + /* + * The type of the activity record. + */ + @Generated + private String type = "indexedSharePoint"; + + /* + * The indexed SharePoint arguments for the retrieval activity. + */ + @Generated + private KnowledgeBaseIndexedSharePointActivityArguments indexedSharePointArguments; + + /** + * Creates an instance of KnowledgeBaseIndexedSharePointActivityRecord class. + */ + @Generated + public KnowledgeBaseIndexedSharePointActivityRecord() { + } + + /** + * Get the type property: The type of the activity record. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the indexedSharePointArguments property: The indexed SharePoint arguments for the retrieval activity. + * + * @return the indexedSharePointArguments value. + */ + @Generated + public KnowledgeBaseIndexedSharePointActivityArguments getIndexedSharePointArguments() { + return this.indexedSharePointArguments; + } + + /** + * Set the indexedSharePointArguments property: The indexed SharePoint arguments for the retrieval activity. + * + * @param indexedSharePointArguments the indexedSharePointArguments value to set. + * @return the KnowledgeBaseIndexedSharePointActivityRecord object itself. + */ + @Generated + public KnowledgeBaseIndexedSharePointActivityRecord + setIndexedSharePointArguments(KnowledgeBaseIndexedSharePointActivityArguments indexedSharePointArguments) { + this.indexedSharePointArguments = indexedSharePointArguments; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedSharePointActivityRecord setKnowledgeSourceName(String knowledgeSourceName) { + super.setKnowledgeSourceName(knowledgeSourceName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedSharePointActivityRecord setQueryTime(OffsetDateTime queryTime) { + super.setQueryTime(queryTime); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedSharePointActivityRecord setCount(Integer count) { + super.setCount(count); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedSharePointActivityRecord setId(int id) { + super.setId(id); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedSharePointActivityRecord setElapsedMs(Integer elapsedMs) { + super.setElapsedMs(elapsedMs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedSharePointActivityRecord setError(KnowledgeBaseErrorDetail error) { + super.setError(error); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("id", getId()); + jsonWriter.writeNumberField("elapsedMs", getElapsedMs()); + jsonWriter.writeJsonField("error", getError()); + jsonWriter.writeStringField("knowledgeSourceName", getKnowledgeSourceName()); + jsonWriter.writeStringField("queryTime", + getQueryTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getQueryTime())); + jsonWriter.writeNumberField("count", getCount()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("indexedSharePointArguments", this.indexedSharePointArguments); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseIndexedSharePointActivityRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseIndexedSharePointActivityRecord 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 KnowledgeBaseIndexedSharePointActivityRecord. + */ + @Generated + public static KnowledgeBaseIndexedSharePointActivityRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseIndexedSharePointActivityRecord deserializedKnowledgeBaseIndexedSharePointActivityRecord + = new KnowledgeBaseIndexedSharePointActivityRecord(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedKnowledgeBaseIndexedSharePointActivityRecord.setId(reader.getInt()); + } else if ("elapsedMs".equals(fieldName)) { + deserializedKnowledgeBaseIndexedSharePointActivityRecord + .setElapsedMs(reader.getNullable(JsonReader::getInt)); + } else if ("error".equals(fieldName)) { + deserializedKnowledgeBaseIndexedSharePointActivityRecord + .setError(KnowledgeBaseErrorDetail.fromJson(reader)); + } else if ("knowledgeSourceName".equals(fieldName)) { + deserializedKnowledgeBaseIndexedSharePointActivityRecord.setKnowledgeSourceName(reader.getString()); + } else if ("queryTime".equals(fieldName)) { + deserializedKnowledgeBaseIndexedSharePointActivityRecord.setQueryTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("count".equals(fieldName)) { + deserializedKnowledgeBaseIndexedSharePointActivityRecord + .setCount(reader.getNullable(JsonReader::getInt)); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseIndexedSharePointActivityRecord.type = reader.getString(); + } else if ("indexedSharePointArguments".equals(fieldName)) { + deserializedKnowledgeBaseIndexedSharePointActivityRecord.indexedSharePointArguments + = KnowledgeBaseIndexedSharePointActivityArguments.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseIndexedSharePointActivityRecord; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedSharePointReference.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedSharePointReference.java new file mode 100644 index 000000000000..88172abaaf51 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseIndexedSharePointReference.java @@ -0,0 +1,169 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Represents an Azure Blob Storage document reference. + */ +@Fluent +public final class KnowledgeBaseIndexedSharePointReference extends KnowledgeBaseReference { + /* + * The type of the reference. + */ + @Generated + private String type = "indexedSharePoint"; + + /* + * The document URL for the reference. + */ + @Generated + private String docUrl; + + /** + * Creates an instance of KnowledgeBaseIndexedSharePointReference class. + */ + @Generated + public KnowledgeBaseIndexedSharePointReference() { + } + + /** + * Get the type property: The type of the reference. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the docUrl property: The document URL for the reference. + * + * @return the docUrl value. + */ + @Generated + public String getDocUrl() { + return this.docUrl; + } + + /** + * Set the docUrl property: The document URL for the reference. + * + * @param docUrl the docUrl value to set. + * @return the KnowledgeBaseIndexedSharePointReference object itself. + */ + @Generated + public KnowledgeBaseIndexedSharePointReference setDocUrl(String docUrl) { + this.docUrl = docUrl; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedSharePointReference setId(String id) { + super.setId(id); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedSharePointReference setActivitySource(int activitySource) { + super.setActivitySource(activitySource); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedSharePointReference setSourceData(Map sourceData) { + super.setSourceData(sourceData); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseIndexedSharePointReference setRerankerScore(Float rerankerScore) { + super.setRerankerScore(rerankerScore); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeIntField("activitySource", getActivitySource()); + jsonWriter.writeMapField("sourceData", getSourceData(), (writer, element) -> writer.writeUntyped(element)); + jsonWriter.writeNumberField("rerankerScore", getRerankerScore()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("docUrl", this.docUrl); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseIndexedSharePointReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseIndexedSharePointReference 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 KnowledgeBaseIndexedSharePointReference. + */ + @Generated + public static KnowledgeBaseIndexedSharePointReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseIndexedSharePointReference deserializedKnowledgeBaseIndexedSharePointReference + = new KnowledgeBaseIndexedSharePointReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedKnowledgeBaseIndexedSharePointReference.setId(reader.getString()); + } else if ("activitySource".equals(fieldName)) { + deserializedKnowledgeBaseIndexedSharePointReference.setActivitySource(reader.getInt()); + } else if ("sourceData".equals(fieldName)) { + Map sourceData = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedKnowledgeBaseIndexedSharePointReference.setSourceData(sourceData); + } else if ("rerankerScore".equals(fieldName)) { + deserializedKnowledgeBaseIndexedSharePointReference + .setRerankerScore(reader.getNullable(JsonReader::getFloat)); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseIndexedSharePointReference.type = reader.getString(); + } else if ("docUrl".equals(fieldName)) { + deserializedKnowledgeBaseIndexedSharePointReference.docUrl = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseIndexedSharePointReference; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessage.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessage.java new file mode 100644 index 000000000000..37e68ee819a7 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessage.java @@ -0,0 +1,128 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 natural language message style object. + */ +@Fluent +public final class KnowledgeBaseMessage implements JsonSerializable { + /* + * The role of the tool response. + */ + @Generated + private String role; + + /* + * The content property. + */ + @Generated + private List content; + + /** + * Creates an instance of KnowledgeBaseMessage class. + */ + @Generated + public KnowledgeBaseMessage() { + } + + /** + * Get the role property: The role of the tool response. + * + * @return the role value. + */ + @Generated + public String getRole() { + return this.role; + } + + /** + * Set the role property: The role of the tool response. + * + * @param role the role value to set. + * @return the KnowledgeBaseMessage object itself. + */ + @Generated + public KnowledgeBaseMessage setRole(String role) { + this.role = role; + return this; + } + + /** + * Get the content property: The content property. + * + * @return the content value. + */ + @Generated + public List getContent() { + return this.content; + } + + /** + * Set the content property: The content property. + * + * @param content the content value to set. + * @return the KnowledgeBaseMessage object itself. + */ + @Generated + public KnowledgeBaseMessage setContent(List content) { + this.content = content; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("content", this.content, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("role", this.role); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseMessage from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseMessage 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 KnowledgeBaseMessage. + */ + @Generated + public static KnowledgeBaseMessage fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseMessage deserializedKnowledgeBaseMessage = new KnowledgeBaseMessage(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("content".equals(fieldName)) { + List content + = reader.readArray(reader1 -> KnowledgeBaseMessageContent.fromJson(reader1)); + deserializedKnowledgeBaseMessage.content = content; + } else if ("role".equals(fieldName)) { + deserializedKnowledgeBaseMessage.role = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseMessage; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageContent.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageContent.java new file mode 100644 index 000000000000..576ddf147908 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageContent.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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Specifies the type of the message content. + */ +@Immutable +public class KnowledgeBaseMessageContent implements JsonSerializable { + /* + * The type of the message + */ + @Generated + private KnowledgeBaseMessageContentType type + = KnowledgeBaseMessageContentType.fromString("KnowledgeBaseMessageContent"); + + /** + * Creates an instance of KnowledgeBaseMessageContent class. + */ + @Generated + public KnowledgeBaseMessageContent() { + } + + /** + * Get the type property: The type of the message. + * + * @return the type value. + */ + @Generated + public KnowledgeBaseMessageContentType getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseMessageContent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseMessageContent 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 KnowledgeBaseMessageContent. + */ + @Generated + public static KnowledgeBaseMessageContent 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 ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("text".equals(discriminatorValue)) { + return KnowledgeBaseMessageTextContent.fromJson(readerToUse.reset()); + } else if ("image".equals(discriminatorValue)) { + return KnowledgeBaseMessageImageContent.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static KnowledgeBaseMessageContent fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseMessageContent deserializedKnowledgeBaseMessageContent = new KnowledgeBaseMessageContent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedKnowledgeBaseMessageContent.type + = KnowledgeBaseMessageContentType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseMessageContent; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageContentType.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageContentType.java new file mode 100644 index 000000000000..9ad920e41633 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageContentType.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of message content. + */ +public final class KnowledgeBaseMessageContentType extends ExpandableStringEnum { + /** + * Text message content kind. + */ + @Generated + public static final KnowledgeBaseMessageContentType TEXT = fromString("text"); + + /** + * Image message content kind. + */ + @Generated + public static final KnowledgeBaseMessageContentType IMAGE = fromString("image"); + + /** + * Creates a new instance of KnowledgeBaseMessageContentType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public KnowledgeBaseMessageContentType() { + } + + /** + * Creates or finds a KnowledgeBaseMessageContentType from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnowledgeBaseMessageContentType. + */ + @Generated + public static KnowledgeBaseMessageContentType fromString(String name) { + return fromString(name, KnowledgeBaseMessageContentType.class); + } + + /** + * Gets known KnowledgeBaseMessageContentType values. + * + * @return known KnowledgeBaseMessageContentType values. + */ + @Generated + public static Collection values() { + return values(KnowledgeBaseMessageContentType.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageImageContent.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageImageContent.java new file mode 100644 index 000000000000..90a92f8b71ea --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageImageContent.java @@ -0,0 +1,116 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Text message type. + */ +@Fluent +public final class KnowledgeBaseMessageImageContent extends KnowledgeBaseMessageContent { + /* + * The type of the message + */ + @Generated + private KnowledgeBaseMessageContentType type = KnowledgeBaseMessageContentType.IMAGE; + + /* + * The image property. + */ + @Generated + private KnowledgeBaseMessageImageContentImage image; + + /** + * Creates an instance of KnowledgeBaseMessageImageContent class. + */ + @Generated + public KnowledgeBaseMessageImageContent() { + } + + /** + * Get the type property: The type of the message. + * + * @return the type value. + */ + @Generated + @Override + public KnowledgeBaseMessageContentType getType() { + return this.type; + } + + /** + * Get the image property: The image property. + * + * @return the image value. + */ + @Generated + public KnowledgeBaseMessageImageContentImage getImage() { + return this.image; + } + + /** + * Set the image property: The image property. + * + * @param image the image value to set. + * @return the KnowledgeBaseMessageImageContent object itself. + */ + @Generated + public KnowledgeBaseMessageImageContent setImage(KnowledgeBaseMessageImageContentImage image) { + this.image = image; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("image", this.image); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseMessageImageContent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseMessageImageContent 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 KnowledgeBaseMessageImageContent. + */ + @Generated + public static KnowledgeBaseMessageImageContent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseMessageImageContent deserializedKnowledgeBaseMessageImageContent + = new KnowledgeBaseMessageImageContent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("image".equals(fieldName)) { + deserializedKnowledgeBaseMessageImageContent.image + = KnowledgeBaseMessageImageContentImage.fromJson(reader); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseMessageImageContent.type + = KnowledgeBaseMessageContentType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseMessageImageContent; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageImageContentImage.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageImageContentImage.java new file mode 100644 index 000000000000..c38e13779776 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageImageContentImage.java @@ -0,0 +1,96 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 KnowledgeBaseMessageImageContentImage model. + */ +@Fluent +public final class KnowledgeBaseMessageImageContentImage + implements JsonSerializable { + /* + * The url of the image. + */ + @Generated + private String url; + + /** + * Creates an instance of KnowledgeBaseMessageImageContentImage class. + */ + @Generated + public KnowledgeBaseMessageImageContentImage() { + } + + /** + * Get the url property: The url of the image. + * + * @return the url value. + */ + @Generated + public String getUrl() { + return this.url; + } + + /** + * Set the url property: The url of the image. + * + * @param url the url value to set. + * @return the KnowledgeBaseMessageImageContentImage object itself. + */ + @Generated + public KnowledgeBaseMessageImageContentImage setUrl(String url) { + this.url = url; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("url", this.url); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseMessageImageContentImage from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseMessageImageContentImage 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 KnowledgeBaseMessageImageContentImage. + */ + @Generated + public static KnowledgeBaseMessageImageContentImage fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseMessageImageContentImage deserializedKnowledgeBaseMessageImageContentImage + = new KnowledgeBaseMessageImageContentImage(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("url".equals(fieldName)) { + deserializedKnowledgeBaseMessageImageContentImage.url = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseMessageImageContentImage; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageTextContent.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageTextContent.java new file mode 100644 index 000000000000..ce138d3fe0d8 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseMessageTextContent.java @@ -0,0 +1,115 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Text message type. + */ +@Fluent +public final class KnowledgeBaseMessageTextContent extends KnowledgeBaseMessageContent { + /* + * The type of the message + */ + @Generated + private KnowledgeBaseMessageContentType type = KnowledgeBaseMessageContentType.TEXT; + + /* + * The text property. + */ + @Generated + private String text; + + /** + * Creates an instance of KnowledgeBaseMessageTextContent class. + */ + @Generated + public KnowledgeBaseMessageTextContent() { + } + + /** + * Get the type property: The type of the message. + * + * @return the type value. + */ + @Generated + @Override + public KnowledgeBaseMessageContentType getType() { + return this.type; + } + + /** + * Get the text property: The text property. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Set the text property: The text property. + * + * @param text the text value to set. + * @return the KnowledgeBaseMessageTextContent object itself. + */ + @Generated + public KnowledgeBaseMessageTextContent setText(String text) { + this.text = text; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("text", this.text); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseMessageTextContent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseMessageTextContent 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 KnowledgeBaseMessageTextContent. + */ + @Generated + public static KnowledgeBaseMessageTextContent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseMessageTextContent deserializedKnowledgeBaseMessageTextContent + = new KnowledgeBaseMessageTextContent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("text".equals(fieldName)) { + deserializedKnowledgeBaseMessageTextContent.text = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseMessageTextContent.type + = KnowledgeBaseMessageContentType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseMessageTextContent; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseModel.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseModel.java new file mode 100644 index 000000000000..42e9021e290d --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseModel.java @@ -0,0 +1,107 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Specifies the connection parameters for the model to use for query planning. + */ +@Immutable +public class KnowledgeBaseModel implements JsonSerializable { + /* + * The type of AI model. + */ + @Generated + private KnowledgeBaseModelKind kind = KnowledgeBaseModelKind.fromString("KnowledgeBaseModel"); + + /** + * Creates an instance of KnowledgeBaseModel class. + */ + @Generated + public KnowledgeBaseModel() { + } + + /** + * Get the kind property: The type of AI model. + * + * @return the kind value. + */ + @Generated + public KnowledgeBaseModelKind getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @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 KnowledgeBaseModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseModel 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 KnowledgeBaseModel. + */ + @Generated + public static KnowledgeBaseModel 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 ("azureOpenAI".equals(discriminatorValue)) { + return KnowledgeBaseAzureOpenAIModel.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static KnowledgeBaseModel fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseModel deserializedKnowledgeBaseModel = new KnowledgeBaseModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedKnowledgeBaseModel.kind = KnowledgeBaseModelKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseModel; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseModelAnswerSynthesisActivityRecord.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseModelAnswerSynthesisActivityRecord.java new file mode 100644 index 000000000000..8a94c097431c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseModelAnswerSynthesisActivityRecord.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents an LLM answer synthesis activity record. + */ +@Fluent +public final class KnowledgeBaseModelAnswerSynthesisActivityRecord extends KnowledgeBaseActivityRecord { + /* + * The type of the activity record. + */ + @Generated + private String type = "modelAnswerSynthesis"; + + /* + * The number of input tokens for the LLM answer synthesis activity. + */ + @Generated + private Integer inputTokens; + + /* + * The number of output tokens for the LLM answer synthesis activity. + */ + @Generated + private Integer outputTokens; + + /** + * Creates an instance of KnowledgeBaseModelAnswerSynthesisActivityRecord class. + */ + @Generated + public KnowledgeBaseModelAnswerSynthesisActivityRecord() { + } + + /** + * Get the type property: The type of the activity record. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the inputTokens property: The number of input tokens for the LLM answer synthesis activity. + * + * @return the inputTokens value. + */ + @Generated + public Integer getInputTokens() { + return this.inputTokens; + } + + /** + * Set the inputTokens property: The number of input tokens for the LLM answer synthesis activity. + * + * @param inputTokens the inputTokens value to set. + * @return the KnowledgeBaseModelAnswerSynthesisActivityRecord object itself. + */ + @Generated + public KnowledgeBaseModelAnswerSynthesisActivityRecord setInputTokens(Integer inputTokens) { + this.inputTokens = inputTokens; + return this; + } + + /** + * Get the outputTokens property: The number of output tokens for the LLM answer synthesis activity. + * + * @return the outputTokens value. + */ + @Generated + public Integer getOutputTokens() { + return this.outputTokens; + } + + /** + * Set the outputTokens property: The number of output tokens for the LLM answer synthesis activity. + * + * @param outputTokens the outputTokens value to set. + * @return the KnowledgeBaseModelAnswerSynthesisActivityRecord object itself. + */ + @Generated + public KnowledgeBaseModelAnswerSynthesisActivityRecord setOutputTokens(Integer outputTokens) { + this.outputTokens = outputTokens; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseModelAnswerSynthesisActivityRecord setId(int id) { + super.setId(id); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseModelAnswerSynthesisActivityRecord setElapsedMs(Integer elapsedMs) { + super.setElapsedMs(elapsedMs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseModelAnswerSynthesisActivityRecord setError(KnowledgeBaseErrorDetail error) { + super.setError(error); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("id", getId()); + jsonWriter.writeNumberField("elapsedMs", getElapsedMs()); + jsonWriter.writeJsonField("error", getError()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeNumberField("inputTokens", this.inputTokens); + jsonWriter.writeNumberField("outputTokens", this.outputTokens); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseModelAnswerSynthesisActivityRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseModelAnswerSynthesisActivityRecord 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 KnowledgeBaseModelAnswerSynthesisActivityRecord. + */ + @Generated + public static KnowledgeBaseModelAnswerSynthesisActivityRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseModelAnswerSynthesisActivityRecord deserializedKnowledgeBaseModelAnswerSynthesisActivityRecord + = new KnowledgeBaseModelAnswerSynthesisActivityRecord(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedKnowledgeBaseModelAnswerSynthesisActivityRecord.setId(reader.getInt()); + } else if ("elapsedMs".equals(fieldName)) { + deserializedKnowledgeBaseModelAnswerSynthesisActivityRecord + .setElapsedMs(reader.getNullable(JsonReader::getInt)); + } else if ("error".equals(fieldName)) { + deserializedKnowledgeBaseModelAnswerSynthesisActivityRecord + .setError(KnowledgeBaseErrorDetail.fromJson(reader)); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseModelAnswerSynthesisActivityRecord.type = reader.getString(); + } else if ("inputTokens".equals(fieldName)) { + deserializedKnowledgeBaseModelAnswerSynthesisActivityRecord.inputTokens + = reader.getNullable(JsonReader::getInt); + } else if ("outputTokens".equals(fieldName)) { + deserializedKnowledgeBaseModelAnswerSynthesisActivityRecord.outputTokens + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseModelAnswerSynthesisActivityRecord; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseModelKind.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseModelKind.java new file mode 100644 index 000000000000..649e69563461 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseModelKind.java @@ -0,0 +1,52 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The AI model to be used for query planning. + */ +public final class KnowledgeBaseModelKind extends ExpandableStringEnum { + /** + * Use Azure Open AI models for query planning. + */ + @Generated + public static final KnowledgeBaseModelKind AZURE_OPEN_AI = fromString("azureOpenAI"); + + /** + * Creates a new instance of KnowledgeBaseModelKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public KnowledgeBaseModelKind() { + } + + /** + * Creates or finds a KnowledgeBaseModelKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnowledgeBaseModelKind. + */ + @Generated + public static KnowledgeBaseModelKind fromString(String name) { + return fromString(name, KnowledgeBaseModelKind.class); + } + + /** + * Gets known KnowledgeBaseModelKind values. + * + * @return known KnowledgeBaseModelKind values. + */ + @Generated + public static Collection values() { + return values(KnowledgeBaseModelKind.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseModelQueryPlanningActivityRecord.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseModelQueryPlanningActivityRecord.java new file mode 100644 index 000000000000..ce5457f109e9 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseModelQueryPlanningActivityRecord.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents an LLM query planning activity record. + */ +@Fluent +public final class KnowledgeBaseModelQueryPlanningActivityRecord extends KnowledgeBaseActivityRecord { + /* + * The type of the activity record. + */ + @Generated + private String type = "modelQueryPlanning"; + + /* + * The number of input tokens for the LLM query planning activity. + */ + @Generated + private Integer inputTokens; + + /* + * The number of output tokens for the LLM query planning activity. + */ + @Generated + private Integer outputTokens; + + /** + * Creates an instance of KnowledgeBaseModelQueryPlanningActivityRecord class. + */ + @Generated + public KnowledgeBaseModelQueryPlanningActivityRecord() { + } + + /** + * Get the type property: The type of the activity record. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the inputTokens property: The number of input tokens for the LLM query planning activity. + * + * @return the inputTokens value. + */ + @Generated + public Integer getInputTokens() { + return this.inputTokens; + } + + /** + * Set the inputTokens property: The number of input tokens for the LLM query planning activity. + * + * @param inputTokens the inputTokens value to set. + * @return the KnowledgeBaseModelQueryPlanningActivityRecord object itself. + */ + @Generated + public KnowledgeBaseModelQueryPlanningActivityRecord setInputTokens(Integer inputTokens) { + this.inputTokens = inputTokens; + return this; + } + + /** + * Get the outputTokens property: The number of output tokens for the LLM query planning activity. + * + * @return the outputTokens value. + */ + @Generated + public Integer getOutputTokens() { + return this.outputTokens; + } + + /** + * Set the outputTokens property: The number of output tokens for the LLM query planning activity. + * + * @param outputTokens the outputTokens value to set. + * @return the KnowledgeBaseModelQueryPlanningActivityRecord object itself. + */ + @Generated + public KnowledgeBaseModelQueryPlanningActivityRecord setOutputTokens(Integer outputTokens) { + this.outputTokens = outputTokens; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseModelQueryPlanningActivityRecord setId(int id) { + super.setId(id); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseModelQueryPlanningActivityRecord setElapsedMs(Integer elapsedMs) { + super.setElapsedMs(elapsedMs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseModelQueryPlanningActivityRecord setError(KnowledgeBaseErrorDetail error) { + super.setError(error); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("id", getId()); + jsonWriter.writeNumberField("elapsedMs", getElapsedMs()); + jsonWriter.writeJsonField("error", getError()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeNumberField("inputTokens", this.inputTokens); + jsonWriter.writeNumberField("outputTokens", this.outputTokens); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseModelQueryPlanningActivityRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseModelQueryPlanningActivityRecord 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 KnowledgeBaseModelQueryPlanningActivityRecord. + */ + @Generated + public static KnowledgeBaseModelQueryPlanningActivityRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseModelQueryPlanningActivityRecord deserializedKnowledgeBaseModelQueryPlanningActivityRecord + = new KnowledgeBaseModelQueryPlanningActivityRecord(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedKnowledgeBaseModelQueryPlanningActivityRecord.setId(reader.getInt()); + } else if ("elapsedMs".equals(fieldName)) { + deserializedKnowledgeBaseModelQueryPlanningActivityRecord + .setElapsedMs(reader.getNullable(JsonReader::getInt)); + } else if ("error".equals(fieldName)) { + deserializedKnowledgeBaseModelQueryPlanningActivityRecord + .setError(KnowledgeBaseErrorDetail.fromJson(reader)); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseModelQueryPlanningActivityRecord.type = reader.getString(); + } else if ("inputTokens".equals(fieldName)) { + deserializedKnowledgeBaseModelQueryPlanningActivityRecord.inputTokens + = reader.getNullable(JsonReader::getInt); + } else if ("outputTokens".equals(fieldName)) { + deserializedKnowledgeBaseModelQueryPlanningActivityRecord.outputTokens + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseModelQueryPlanningActivityRecord; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseReference.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseReference.java new file mode 100644 index 000000000000..1e9c5e7ce72f --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseReference.java @@ -0,0 +1,244 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.Map; + +/** + * Base type for references. + */ +@Fluent +public class KnowledgeBaseReference implements JsonSerializable { + /* + * The type of the reference. + */ + @Generated + private String type = "KnowledgeBaseReference"; + + /* + * The ID of the reference. + */ + @Generated + private String id; + + /* + * The source activity ID for the reference. + */ + @Generated + private int activitySource; + + /* + * Dictionary of + */ + @Generated + private Map sourceData; + + /* + * The reranker score for the document reference. + */ + @Generated + private Float rerankerScore; + + /** + * Creates an instance of KnowledgeBaseReference class. + */ + @Generated + public KnowledgeBaseReference() { + } + + /** + * Get the type property: The type of the reference. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * Get the id property: The ID of the reference. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Set the id property: The ID of the reference. + * + * @param id the id value to set. + * @return the KnowledgeBaseReference object itself. + */ + @Generated + public KnowledgeBaseReference setId(String id) { + this.id = id; + return this; + } + + /** + * Get the activitySource property: The source activity ID for the reference. + * + * @return the activitySource value. + */ + @Generated + public int getActivitySource() { + return this.activitySource; + } + + /** + * Set the activitySource property: The source activity ID for the reference. + * + * @param activitySource the activitySource value to set. + * @return the KnowledgeBaseReference object itself. + */ + @Generated + public KnowledgeBaseReference setActivitySource(int activitySource) { + this.activitySource = activitySource; + return this; + } + + /** + * Get the sourceData property: Dictionary of <any>. + * + * @return the sourceData value. + */ + @Generated + public Map getSourceData() { + return this.sourceData; + } + + /** + * Set the sourceData property: Dictionary of <any>. + * + * @param sourceData the sourceData value to set. + * @return the KnowledgeBaseReference object itself. + */ + @Generated + public KnowledgeBaseReference setSourceData(Map sourceData) { + this.sourceData = sourceData; + return this; + } + + /** + * Get the rerankerScore property: The reranker score for the document reference. + * + * @return the rerankerScore value. + */ + @Generated + public Float getRerankerScore() { + return this.rerankerScore; + } + + /** + * Set the rerankerScore property: The reranker score for the document reference. + * + * @param rerankerScore the rerankerScore value to set. + * @return the KnowledgeBaseReference object itself. + */ + @Generated + public KnowledgeBaseReference setRerankerScore(Float rerankerScore) { + this.rerankerScore = rerankerScore; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeIntField("activitySource", this.activitySource); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeMapField("sourceData", this.sourceData, (writer, element) -> writer.writeUntyped(element)); + jsonWriter.writeNumberField("rerankerScore", this.rerankerScore); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseReference 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 KnowledgeBaseReference. + */ + @Generated + public static KnowledgeBaseReference 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 ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("searchIndex".equals(discriminatorValue)) { + return KnowledgeBaseSearchIndexReference.fromJson(readerToUse.reset()); + } else if ("azureBlob".equals(discriminatorValue)) { + return KnowledgeBaseAzureBlobReference.fromJson(readerToUse.reset()); + } else if ("indexedSharePoint".equals(discriminatorValue)) { + return KnowledgeBaseIndexedSharePointReference.fromJson(readerToUse.reset()); + } else if ("indexedOneLake".equals(discriminatorValue)) { + return KnowledgeBaseIndexedOneLakeReference.fromJson(readerToUse.reset()); + } else if ("web".equals(discriminatorValue)) { + return KnowledgeBaseWebReference.fromJson(readerToUse.reset()); + } else if ("remoteSharePoint".equals(discriminatorValue)) { + return KnowledgeBaseRemoteSharePointReference.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static KnowledgeBaseReference fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseReference deserializedKnowledgeBaseReference = new KnowledgeBaseReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedKnowledgeBaseReference.id = reader.getString(); + } else if ("activitySource".equals(fieldName)) { + deserializedKnowledgeBaseReference.activitySource = reader.getInt(); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseReference.type = reader.getString(); + } else if ("sourceData".equals(fieldName)) { + Map sourceData = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedKnowledgeBaseReference.sourceData = sourceData; + } else if ("rerankerScore".equals(fieldName)) { + deserializedKnowledgeBaseReference.rerankerScore = reader.getNullable(JsonReader::getFloat); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseReference; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRemoteSharePointActivityArguments.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRemoteSharePointActivityArguments.java new file mode 100644 index 000000000000..fd018ce8108c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRemoteSharePointActivityArguments.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents the arguments the remote SharePoint retrieval activity was run with. + */ +@Fluent +public final class KnowledgeBaseRemoteSharePointActivityArguments + implements JsonSerializable { + /* + * The search string used to query the remote SharePoint knowledge source. + */ + @Generated + private String search; + + /* + * The filter expression add-on for the retrieval activity. + */ + @Generated + private String filterExpressionAddOn; + + /** + * Creates an instance of KnowledgeBaseRemoteSharePointActivityArguments class. + */ + @Generated + public KnowledgeBaseRemoteSharePointActivityArguments() { + } + + /** + * Get the search property: The search string used to query the remote SharePoint knowledge source. + * + * @return the search value. + */ + @Generated + public String getSearch() { + return this.search; + } + + /** + * Set the search property: The search string used to query the remote SharePoint knowledge source. + * + * @param search the search value to set. + * @return the KnowledgeBaseRemoteSharePointActivityArguments object itself. + */ + @Generated + public KnowledgeBaseRemoteSharePointActivityArguments setSearch(String search) { + this.search = search; + return this; + } + + /** + * Get the filterExpressionAddOn property: The filter expression add-on for the retrieval activity. + * + * @return the filterExpressionAddOn value. + */ + @Generated + public String getFilterExpressionAddOn() { + return this.filterExpressionAddOn; + } + + /** + * Set the filterExpressionAddOn property: The filter expression add-on for the retrieval activity. + * + * @param filterExpressionAddOn the filterExpressionAddOn value to set. + * @return the KnowledgeBaseRemoteSharePointActivityArguments object itself. + */ + @Generated + public KnowledgeBaseRemoteSharePointActivityArguments setFilterExpressionAddOn(String filterExpressionAddOn) { + this.filterExpressionAddOn = filterExpressionAddOn; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("search", this.search); + jsonWriter.writeStringField("filterExpressionAddOn", this.filterExpressionAddOn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseRemoteSharePointActivityArguments from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseRemoteSharePointActivityArguments 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 KnowledgeBaseRemoteSharePointActivityArguments. + */ + @Generated + public static KnowledgeBaseRemoteSharePointActivityArguments fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseRemoteSharePointActivityArguments deserializedKnowledgeBaseRemoteSharePointActivityArguments + = new KnowledgeBaseRemoteSharePointActivityArguments(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("search".equals(fieldName)) { + deserializedKnowledgeBaseRemoteSharePointActivityArguments.search = reader.getString(); + } else if ("filterExpressionAddOn".equals(fieldName)) { + deserializedKnowledgeBaseRemoteSharePointActivityArguments.filterExpressionAddOn + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseRemoteSharePointActivityArguments; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRemoteSharePointActivityRecord.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRemoteSharePointActivityRecord.java new file mode 100644 index 000000000000..4d7c240609c0 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRemoteSharePointActivityRecord.java @@ -0,0 +1,202 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Represents a remote SharePoint retrieval activity record. + */ +@Fluent +public final class KnowledgeBaseRemoteSharePointActivityRecord extends KnowledgeBaseRetrievalActivityRecord { + /* + * The type of the activity record. + */ + @Generated + private String type = "remoteSharePoint"; + + /* + * The remote SharePoint arguments for the retrieval activity. + */ + @Generated + private KnowledgeBaseRemoteSharePointActivityArguments remoteSharePointArguments; + + /** + * Creates an instance of KnowledgeBaseRemoteSharePointActivityRecord class. + */ + @Generated + public KnowledgeBaseRemoteSharePointActivityRecord() { + } + + /** + * Get the type property: The type of the activity record. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the remoteSharePointArguments property: The remote SharePoint arguments for the retrieval activity. + * + * @return the remoteSharePointArguments value. + */ + @Generated + public KnowledgeBaseRemoteSharePointActivityArguments getRemoteSharePointArguments() { + return this.remoteSharePointArguments; + } + + /** + * Set the remoteSharePointArguments property: The remote SharePoint arguments for the retrieval activity. + * + * @param remoteSharePointArguments the remoteSharePointArguments value to set. + * @return the KnowledgeBaseRemoteSharePointActivityRecord object itself. + */ + @Generated + public KnowledgeBaseRemoteSharePointActivityRecord + setRemoteSharePointArguments(KnowledgeBaseRemoteSharePointActivityArguments remoteSharePointArguments) { + this.remoteSharePointArguments = remoteSharePointArguments; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseRemoteSharePointActivityRecord setKnowledgeSourceName(String knowledgeSourceName) { + super.setKnowledgeSourceName(knowledgeSourceName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseRemoteSharePointActivityRecord setQueryTime(OffsetDateTime queryTime) { + super.setQueryTime(queryTime); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseRemoteSharePointActivityRecord setCount(Integer count) { + super.setCount(count); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseRemoteSharePointActivityRecord setId(int id) { + super.setId(id); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseRemoteSharePointActivityRecord setElapsedMs(Integer elapsedMs) { + super.setElapsedMs(elapsedMs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseRemoteSharePointActivityRecord setError(KnowledgeBaseErrorDetail error) { + super.setError(error); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("id", getId()); + jsonWriter.writeNumberField("elapsedMs", getElapsedMs()); + jsonWriter.writeJsonField("error", getError()); + jsonWriter.writeStringField("knowledgeSourceName", getKnowledgeSourceName()); + jsonWriter.writeStringField("queryTime", + getQueryTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getQueryTime())); + jsonWriter.writeNumberField("count", getCount()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("remoteSharePointArguments", this.remoteSharePointArguments); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseRemoteSharePointActivityRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseRemoteSharePointActivityRecord 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 KnowledgeBaseRemoteSharePointActivityRecord. + */ + @Generated + public static KnowledgeBaseRemoteSharePointActivityRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseRemoteSharePointActivityRecord deserializedKnowledgeBaseRemoteSharePointActivityRecord + = new KnowledgeBaseRemoteSharePointActivityRecord(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedKnowledgeBaseRemoteSharePointActivityRecord.setId(reader.getInt()); + } else if ("elapsedMs".equals(fieldName)) { + deserializedKnowledgeBaseRemoteSharePointActivityRecord + .setElapsedMs(reader.getNullable(JsonReader::getInt)); + } else if ("error".equals(fieldName)) { + deserializedKnowledgeBaseRemoteSharePointActivityRecord + .setError(KnowledgeBaseErrorDetail.fromJson(reader)); + } else if ("knowledgeSourceName".equals(fieldName)) { + deserializedKnowledgeBaseRemoteSharePointActivityRecord.setKnowledgeSourceName(reader.getString()); + } else if ("queryTime".equals(fieldName)) { + deserializedKnowledgeBaseRemoteSharePointActivityRecord.setQueryTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("count".equals(fieldName)) { + deserializedKnowledgeBaseRemoteSharePointActivityRecord + .setCount(reader.getNullable(JsonReader::getInt)); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseRemoteSharePointActivityRecord.type = reader.getString(); + } else if ("remoteSharePointArguments".equals(fieldName)) { + deserializedKnowledgeBaseRemoteSharePointActivityRecord.remoteSharePointArguments + = KnowledgeBaseRemoteSharePointActivityArguments.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseRemoteSharePointActivityRecord; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRemoteSharePointReference.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRemoteSharePointReference.java new file mode 100644 index 000000000000..6c94a25a15bb --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRemoteSharePointReference.java @@ -0,0 +1,204 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Represents a remote SharePoint document reference. + */ +@Fluent +public final class KnowledgeBaseRemoteSharePointReference extends KnowledgeBaseReference { + /* + * The type of the reference. + */ + @Generated + private String type = "remoteSharePoint"; + + /* + * The url the reference data originated from. + */ + @Generated + private String webUrl; + + /* + * Information about the sensitivity label applied to a SharePoint document. + */ + @Generated + private SharePointSensitivityLabelInfo searchSensitivityLabelInfo; + + /** + * Creates an instance of KnowledgeBaseRemoteSharePointReference class. + */ + @Generated + public KnowledgeBaseRemoteSharePointReference() { + } + + /** + * Get the type property: The type of the reference. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the webUrl property: The url the reference data originated from. + * + * @return the webUrl value. + */ + @Generated + public String getWebUrl() { + return this.webUrl; + } + + /** + * Set the webUrl property: The url the reference data originated from. + * + * @param webUrl the webUrl value to set. + * @return the KnowledgeBaseRemoteSharePointReference object itself. + */ + @Generated + public KnowledgeBaseRemoteSharePointReference setWebUrl(String webUrl) { + this.webUrl = webUrl; + return this; + } + + /** + * Get the searchSensitivityLabelInfo property: Information about the sensitivity label applied to a SharePoint + * document. + * + * @return the searchSensitivityLabelInfo value. + */ + @Generated + public SharePointSensitivityLabelInfo getSearchSensitivityLabelInfo() { + return this.searchSensitivityLabelInfo; + } + + /** + * Set the searchSensitivityLabelInfo property: Information about the sensitivity label applied to a SharePoint + * document. + * + * @param searchSensitivityLabelInfo the searchSensitivityLabelInfo value to set. + * @return the KnowledgeBaseRemoteSharePointReference object itself. + */ + @Generated + public KnowledgeBaseRemoteSharePointReference + setSearchSensitivityLabelInfo(SharePointSensitivityLabelInfo searchSensitivityLabelInfo) { + this.searchSensitivityLabelInfo = searchSensitivityLabelInfo; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseRemoteSharePointReference setId(String id) { + super.setId(id); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseRemoteSharePointReference setActivitySource(int activitySource) { + super.setActivitySource(activitySource); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseRemoteSharePointReference setSourceData(Map sourceData) { + super.setSourceData(sourceData); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseRemoteSharePointReference setRerankerScore(Float rerankerScore) { + super.setRerankerScore(rerankerScore); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeIntField("activitySource", getActivitySource()); + jsonWriter.writeMapField("sourceData", getSourceData(), (writer, element) -> writer.writeUntyped(element)); + jsonWriter.writeNumberField("rerankerScore", getRerankerScore()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("webUrl", this.webUrl); + jsonWriter.writeJsonField("searchSensitivityLabelInfo", this.searchSensitivityLabelInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseRemoteSharePointReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseRemoteSharePointReference 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 KnowledgeBaseRemoteSharePointReference. + */ + @Generated + public static KnowledgeBaseRemoteSharePointReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseRemoteSharePointReference deserializedKnowledgeBaseRemoteSharePointReference + = new KnowledgeBaseRemoteSharePointReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedKnowledgeBaseRemoteSharePointReference.setId(reader.getString()); + } else if ("activitySource".equals(fieldName)) { + deserializedKnowledgeBaseRemoteSharePointReference.setActivitySource(reader.getInt()); + } else if ("sourceData".equals(fieldName)) { + Map sourceData = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedKnowledgeBaseRemoteSharePointReference.setSourceData(sourceData); + } else if ("rerankerScore".equals(fieldName)) { + deserializedKnowledgeBaseRemoteSharePointReference + .setRerankerScore(reader.getNullable(JsonReader::getFloat)); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseRemoteSharePointReference.type = reader.getString(); + } else if ("webUrl".equals(fieldName)) { + deserializedKnowledgeBaseRemoteSharePointReference.webUrl = reader.getString(); + } else if ("searchSensitivityLabelInfo".equals(fieldName)) { + deserializedKnowledgeBaseRemoteSharePointReference.searchSensitivityLabelInfo + = SharePointSensitivityLabelInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseRemoteSharePointReference; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRetrievalActivityRecord.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRetrievalActivityRecord.java new file mode 100644 index 000000000000..44410870106d --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRetrievalActivityRecord.java @@ -0,0 +1,260 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Represents a retrieval activity record. + */ +@Fluent +public class KnowledgeBaseRetrievalActivityRecord extends KnowledgeBaseActivityRecord { + /* + * The type of the activity record. + */ + @Generated + private String type = "KnowledgeBaseRetrievalActivityRecord"; + + /* + * The knowledge source for the retrieval activity. + */ + @Generated + private String knowledgeSourceName; + + /* + * The query time for this retrieval activity. + */ + @Generated + private OffsetDateTime queryTime; + + /* + * The count of documents retrieved that were sufficiently relevant to pass the reranker threshold. + */ + @Generated + private Integer count; + + /** + * Creates an instance of KnowledgeBaseRetrievalActivityRecord class. + */ + @Generated + public KnowledgeBaseRetrievalActivityRecord() { + } + + /** + * Get the type property: The type of the activity record. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the knowledgeSourceName property: The knowledge source for the retrieval activity. + * + * @return the knowledgeSourceName value. + */ + @Generated + public String getKnowledgeSourceName() { + return this.knowledgeSourceName; + } + + /** + * Set the knowledgeSourceName property: The knowledge source for the retrieval activity. + * + * @param knowledgeSourceName the knowledgeSourceName value to set. + * @return the KnowledgeBaseRetrievalActivityRecord object itself. + */ + @Generated + public KnowledgeBaseRetrievalActivityRecord setKnowledgeSourceName(String knowledgeSourceName) { + this.knowledgeSourceName = knowledgeSourceName; + return this; + } + + /** + * Get the queryTime property: The query time for this retrieval activity. + * + * @return the queryTime value. + */ + @Generated + public OffsetDateTime getQueryTime() { + return this.queryTime; + } + + /** + * Set the queryTime property: The query time for this retrieval activity. + * + * @param queryTime the queryTime value to set. + * @return the KnowledgeBaseRetrievalActivityRecord object itself. + */ + @Generated + public KnowledgeBaseRetrievalActivityRecord setQueryTime(OffsetDateTime queryTime) { + this.queryTime = queryTime; + return this; + } + + /** + * Get the count property: The count of documents retrieved that were sufficiently relevant to pass the reranker + * threshold. + * + * @return the count value. + */ + @Generated + public Integer getCount() { + return this.count; + } + + /** + * Set the count property: The count of documents retrieved that were sufficiently relevant to pass the reranker + * threshold. + * + * @param count the count value to set. + * @return the KnowledgeBaseRetrievalActivityRecord object itself. + */ + @Generated + public KnowledgeBaseRetrievalActivityRecord setCount(Integer count) { + this.count = count; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseRetrievalActivityRecord setId(int id) { + super.setId(id); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseRetrievalActivityRecord setElapsedMs(Integer elapsedMs) { + super.setElapsedMs(elapsedMs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseRetrievalActivityRecord setError(KnowledgeBaseErrorDetail error) { + super.setError(error); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("id", getId()); + jsonWriter.writeNumberField("elapsedMs", getElapsedMs()); + jsonWriter.writeJsonField("error", getError()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("knowledgeSourceName", this.knowledgeSourceName); + jsonWriter.writeStringField("queryTime", + this.queryTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.queryTime)); + jsonWriter.writeNumberField("count", this.count); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseRetrievalActivityRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseRetrievalActivityRecord 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 KnowledgeBaseRetrievalActivityRecord. + */ + @Generated + public static KnowledgeBaseRetrievalActivityRecord 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 ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("searchIndex".equals(discriminatorValue)) { + return KnowledgeBaseSearchIndexActivityRecord.fromJson(readerToUse.reset()); + } else if ("azureBlob".equals(discriminatorValue)) { + return KnowledgeBaseAzureBlobActivityRecord.fromJson(readerToUse.reset()); + } else if ("indexedSharePoint".equals(discriminatorValue)) { + return KnowledgeBaseIndexedSharePointActivityRecord.fromJson(readerToUse.reset()); + } else if ("indexedOneLake".equals(discriminatorValue)) { + return KnowledgeBaseIndexedOneLakeActivityRecord.fromJson(readerToUse.reset()); + } else if ("web".equals(discriminatorValue)) { + return KnowledgeBaseWebActivityRecord.fromJson(readerToUse.reset()); + } else if ("remoteSharePoint".equals(discriminatorValue)) { + return KnowledgeBaseRemoteSharePointActivityRecord.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static KnowledgeBaseRetrievalActivityRecord fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseRetrievalActivityRecord deserializedKnowledgeBaseRetrievalActivityRecord + = new KnowledgeBaseRetrievalActivityRecord(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedKnowledgeBaseRetrievalActivityRecord.setId(reader.getInt()); + } else if ("elapsedMs".equals(fieldName)) { + deserializedKnowledgeBaseRetrievalActivityRecord + .setElapsedMs(reader.getNullable(JsonReader::getInt)); + } else if ("error".equals(fieldName)) { + deserializedKnowledgeBaseRetrievalActivityRecord + .setError(KnowledgeBaseErrorDetail.fromJson(reader)); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseRetrievalActivityRecord.type = reader.getString(); + } else if ("knowledgeSourceName".equals(fieldName)) { + deserializedKnowledgeBaseRetrievalActivityRecord.knowledgeSourceName = reader.getString(); + } else if ("queryTime".equals(fieldName)) { + deserializedKnowledgeBaseRetrievalActivityRecord.queryTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("count".equals(fieldName)) { + deserializedKnowledgeBaseRetrievalActivityRecord.count = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseRetrievalActivityRecord; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRetrievalRequest.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRetrievalRequest.java new file mode 100644 index 000000000000..bdcae662abb1 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRetrievalRequest.java @@ -0,0 +1,324 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 input contract for the retrieval request. + */ +@Fluent +public final class KnowledgeBaseRetrievalRequest implements JsonSerializable { + /* + * A list of chat message style input. + */ + @Generated + private List messages; + + /* + * A list of intended queries to execute without model query planning. + */ + @Generated + private List intents; + + /* + * The maximum runtime in seconds. + */ + @Generated + private Integer maxRuntimeInSeconds; + + /* + * Limits the maximum size of the content in the output. + */ + @Generated + private Integer maxOutputSize; + + /* + * The retrievalReasoningEffort property. + */ + @Generated + private KnowledgeRetrievalReasoningEffort retrievalReasoningEffort; + + /* + * Indicates retrieval results should include activity information. + */ + @Generated + private Boolean includeActivity; + + /* + * The output configuration for this retrieval. + */ + @Generated + private KnowledgeRetrievalOutputMode outputMode; + + /* + * A list of runtime parameters for the knowledge sources. + */ + @Generated + private List knowledgeSourceParams; + + /** + * Creates an instance of KnowledgeBaseRetrievalRequest class. + */ + @Generated + public KnowledgeBaseRetrievalRequest() { + } + + /** + * Get the messages property: A list of chat message style input. + * + * @return the messages value. + */ + @Generated + public List getMessages() { + return this.messages; + } + + /** + * Set the messages property: A list of chat message style input. + * + * @param messages the messages value to set. + * @return the KnowledgeBaseRetrievalRequest object itself. + */ + @Generated + public KnowledgeBaseRetrievalRequest setMessages(List messages) { + this.messages = messages; + return this; + } + + /** + * Get the intents property: A list of intended queries to execute without model query planning. + * + * @return the intents value. + */ + @Generated + public List getIntents() { + return this.intents; + } + + /** + * Set the intents property: A list of intended queries to execute without model query planning. + * + * @param intents the intents value to set. + * @return the KnowledgeBaseRetrievalRequest object itself. + */ + @Generated + public KnowledgeBaseRetrievalRequest setIntents(List intents) { + this.intents = intents; + return this; + } + + /** + * Get the maxRuntimeInSeconds property: The maximum runtime in seconds. + * + * @return the maxRuntimeInSeconds value. + */ + @Generated + public Integer getMaxRuntimeInSeconds() { + return this.maxRuntimeInSeconds; + } + + /** + * Set the maxRuntimeInSeconds property: The maximum runtime in seconds. + * + * @param maxRuntimeInSeconds the maxRuntimeInSeconds value to set. + * @return the KnowledgeBaseRetrievalRequest object itself. + */ + @Generated + public KnowledgeBaseRetrievalRequest setMaxRuntimeInSeconds(Integer maxRuntimeInSeconds) { + this.maxRuntimeInSeconds = maxRuntimeInSeconds; + return this; + } + + /** + * Get the maxOutputSize property: Limits the maximum size of the content in the output. + * + * @return the maxOutputSize value. + */ + @Generated + public Integer getMaxOutputSize() { + return this.maxOutputSize; + } + + /** + * Set the maxOutputSize property: Limits the maximum size of the content in the output. + * + * @param maxOutputSize the maxOutputSize value to set. + * @return the KnowledgeBaseRetrievalRequest object itself. + */ + @Generated + public KnowledgeBaseRetrievalRequest setMaxOutputSize(Integer maxOutputSize) { + this.maxOutputSize = maxOutputSize; + return this; + } + + /** + * Get the retrievalReasoningEffort property: The retrievalReasoningEffort property. + * + * @return the retrievalReasoningEffort value. + */ + @Generated + public KnowledgeRetrievalReasoningEffort getRetrievalReasoningEffort() { + return this.retrievalReasoningEffort; + } + + /** + * Set the retrievalReasoningEffort property: The retrievalReasoningEffort property. + * + * @param retrievalReasoningEffort the retrievalReasoningEffort value to set. + * @return the KnowledgeBaseRetrievalRequest object itself. + */ + @Generated + public KnowledgeBaseRetrievalRequest + setRetrievalReasoningEffort(KnowledgeRetrievalReasoningEffort retrievalReasoningEffort) { + this.retrievalReasoningEffort = retrievalReasoningEffort; + return this; + } + + /** + * Get the includeActivity property: Indicates retrieval results should include activity information. + * + * @return the includeActivity value. + */ + @Generated + public Boolean isIncludeActivity() { + return this.includeActivity; + } + + /** + * Set the includeActivity property: Indicates retrieval results should include activity information. + * + * @param includeActivity the includeActivity value to set. + * @return the KnowledgeBaseRetrievalRequest object itself. + */ + @Generated + public KnowledgeBaseRetrievalRequest setIncludeActivity(Boolean includeActivity) { + this.includeActivity = includeActivity; + return this; + } + + /** + * Get the outputMode property: The output configuration for this retrieval. + * + * @return the outputMode value. + */ + @Generated + public KnowledgeRetrievalOutputMode getOutputMode() { + return this.outputMode; + } + + /** + * Set the outputMode property: The output configuration for this retrieval. + * + * @param outputMode the outputMode value to set. + * @return the KnowledgeBaseRetrievalRequest object itself. + */ + @Generated + public KnowledgeBaseRetrievalRequest setOutputMode(KnowledgeRetrievalOutputMode outputMode) { + this.outputMode = outputMode; + return this; + } + + /** + * Get the knowledgeSourceParams property: A list of runtime parameters for the knowledge sources. + * + * @return the knowledgeSourceParams value. + */ + @Generated + public List getKnowledgeSourceParams() { + return this.knowledgeSourceParams; + } + + /** + * Set the knowledgeSourceParams property: A list of runtime parameters for the knowledge sources. + * + * @param knowledgeSourceParams the knowledgeSourceParams value to set. + * @return the KnowledgeBaseRetrievalRequest object itself. + */ + @Generated + public KnowledgeBaseRetrievalRequest setKnowledgeSourceParams(List knowledgeSourceParams) { + this.knowledgeSourceParams = knowledgeSourceParams; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("messages", this.messages, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("intents", this.intents, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeNumberField("maxRuntimeInSeconds", this.maxRuntimeInSeconds); + jsonWriter.writeNumberField("maxOutputSize", this.maxOutputSize); + jsonWriter.writeJsonField("retrievalReasoningEffort", this.retrievalReasoningEffort); + jsonWriter.writeBooleanField("includeActivity", this.includeActivity); + jsonWriter.writeStringField("outputMode", this.outputMode == null ? null : this.outputMode.toString()); + jsonWriter.writeArrayField("knowledgeSourceParams", this.knowledgeSourceParams, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseRetrievalRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseRetrievalRequest 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 KnowledgeBaseRetrievalRequest. + */ + @Generated + public static KnowledgeBaseRetrievalRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseRetrievalRequest deserializedKnowledgeBaseRetrievalRequest + = new KnowledgeBaseRetrievalRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("messages".equals(fieldName)) { + List messages + = reader.readArray(reader1 -> KnowledgeBaseMessage.fromJson(reader1)); + deserializedKnowledgeBaseRetrievalRequest.messages = messages; + } else if ("intents".equals(fieldName)) { + List intents + = reader.readArray(reader1 -> KnowledgeRetrievalIntent.fromJson(reader1)); + deserializedKnowledgeBaseRetrievalRequest.intents = intents; + } else if ("maxRuntimeInSeconds".equals(fieldName)) { + deserializedKnowledgeBaseRetrievalRequest.maxRuntimeInSeconds + = reader.getNullable(JsonReader::getInt); + } else if ("maxOutputSize".equals(fieldName)) { + deserializedKnowledgeBaseRetrievalRequest.maxOutputSize = reader.getNullable(JsonReader::getInt); + } else if ("retrievalReasoningEffort".equals(fieldName)) { + deserializedKnowledgeBaseRetrievalRequest.retrievalReasoningEffort + = KnowledgeRetrievalReasoningEffort.fromJson(reader); + } else if ("includeActivity".equals(fieldName)) { + deserializedKnowledgeBaseRetrievalRequest.includeActivity + = reader.getNullable(JsonReader::getBoolean); + } else if ("outputMode".equals(fieldName)) { + deserializedKnowledgeBaseRetrievalRequest.outputMode + = KnowledgeRetrievalOutputMode.fromString(reader.getString()); + } else if ("knowledgeSourceParams".equals(fieldName)) { + List knowledgeSourceParams + = reader.readArray(reader1 -> KnowledgeSourceParams.fromJson(reader1)); + deserializedKnowledgeBaseRetrievalRequest.knowledgeSourceParams = knowledgeSourceParams; + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseRetrievalRequest; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRetrievalResponse.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRetrievalResponse.java new file mode 100644 index 000000000000..0d72dae87bdf --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseRetrievalResponse.java @@ -0,0 +1,163 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 output contract for the retrieval response. + */ +@Fluent +public final class KnowledgeBaseRetrievalResponse implements JsonSerializable { + /* + * The response property. + */ + @Generated + private List response; + + /* + * The activity records for tracking progress and billing implications. + */ + @Generated + private List activity; + + /* + * The references for the retrieval data used in the response. + */ + @Generated + private List references; + + /** + * Creates an instance of KnowledgeBaseRetrievalResponse class. + */ + @Generated + public KnowledgeBaseRetrievalResponse() { + } + + /** + * Get the response property: The response property. + * + * @return the response value. + */ + @Generated + public List getResponse() { + return this.response; + } + + /** + * Set the response property: The response property. + * + * @param response the response value to set. + * @return the KnowledgeBaseRetrievalResponse object itself. + */ + @Generated + public KnowledgeBaseRetrievalResponse setResponse(List response) { + this.response = response; + return this; + } + + /** + * Get the activity property: The activity records for tracking progress and billing implications. + * + * @return the activity value. + */ + @Generated + public List getActivity() { + return this.activity; + } + + /** + * Set the activity property: The activity records for tracking progress and billing implications. + * + * @param activity the activity value to set. + * @return the KnowledgeBaseRetrievalResponse object itself. + */ + @Generated + public KnowledgeBaseRetrievalResponse setActivity(List activity) { + this.activity = activity; + return this; + } + + /** + * Get the references property: The references for the retrieval data used in the response. + * + * @return the references value. + */ + @Generated + public List getReferences() { + return this.references; + } + + /** + * Set the references property: The references for the retrieval data used in the response. + * + * @param references the references value to set. + * @return the KnowledgeBaseRetrievalResponse object itself. + */ + @Generated + public KnowledgeBaseRetrievalResponse setReferences(List references) { + this.references = references; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("response", this.response, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("activity", this.activity, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("references", this.references, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseRetrievalResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseRetrievalResponse 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 KnowledgeBaseRetrievalResponse. + */ + @Generated + public static KnowledgeBaseRetrievalResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseRetrievalResponse deserializedKnowledgeBaseRetrievalResponse + = new KnowledgeBaseRetrievalResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("response".equals(fieldName)) { + List response + = reader.readArray(reader1 -> KnowledgeBaseMessage.fromJson(reader1)); + deserializedKnowledgeBaseRetrievalResponse.response = response; + } else if ("activity".equals(fieldName)) { + List activity + = reader.readArray(reader1 -> KnowledgeBaseActivityRecord.fromJson(reader1)); + deserializedKnowledgeBaseRetrievalResponse.activity = activity; + } else if ("references".equals(fieldName)) { + List references + = reader.readArray(reader1 -> KnowledgeBaseReference.fromJson(reader1)); + deserializedKnowledgeBaseRetrievalResponse.references = references; + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseRetrievalResponse; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseSearchIndexActivityArguments.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseSearchIndexActivityArguments.java new file mode 100644 index 000000000000..fd86e835f6e7 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseSearchIndexActivityArguments.java @@ -0,0 +1,126 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents the arguments the search index retrieval activity was run with. + */ +@Fluent +public final class KnowledgeBaseSearchIndexActivityArguments + implements JsonSerializable { + /* + * The search string used to query the search index. + */ + @Generated + private String search; + + /* + * The filter string. + */ + @Generated + private String filter; + + /** + * Creates an instance of KnowledgeBaseSearchIndexActivityArguments class. + */ + @Generated + public KnowledgeBaseSearchIndexActivityArguments() { + } + + /** + * Get the search property: The search string used to query the search index. + * + * @return the search value. + */ + @Generated + public String getSearch() { + return this.search; + } + + /** + * Set the search property: The search string used to query the search index. + * + * @param search the search value to set. + * @return the KnowledgeBaseSearchIndexActivityArguments object itself. + */ + @Generated + public KnowledgeBaseSearchIndexActivityArguments setSearch(String search) { + this.search = search; + return this; + } + + /** + * Get the filter property: The filter string. + * + * @return the filter value. + */ + @Generated + public String getFilter() { + return this.filter; + } + + /** + * Set the filter property: The filter string. + * + * @param filter the filter value to set. + * @return the KnowledgeBaseSearchIndexActivityArguments object itself. + */ + @Generated + public KnowledgeBaseSearchIndexActivityArguments setFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("search", this.search); + jsonWriter.writeStringField("filter", this.filter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseSearchIndexActivityArguments from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseSearchIndexActivityArguments 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 KnowledgeBaseSearchIndexActivityArguments. + */ + @Generated + public static KnowledgeBaseSearchIndexActivityArguments fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseSearchIndexActivityArguments deserializedKnowledgeBaseSearchIndexActivityArguments + = new KnowledgeBaseSearchIndexActivityArguments(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("search".equals(fieldName)) { + deserializedKnowledgeBaseSearchIndexActivityArguments.search = reader.getString(); + } else if ("filter".equals(fieldName)) { + deserializedKnowledgeBaseSearchIndexActivityArguments.filter = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseSearchIndexActivityArguments; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseSearchIndexActivityRecord.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseSearchIndexActivityRecord.java new file mode 100644 index 000000000000..173532b632f2 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseSearchIndexActivityRecord.java @@ -0,0 +1,201 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Represents a search index retrieval activity record. + */ +@Fluent +public final class KnowledgeBaseSearchIndexActivityRecord extends KnowledgeBaseRetrievalActivityRecord { + /* + * The type of the activity record. + */ + @Generated + private String type = "searchIndex"; + + /* + * The search index arguments for the retrieval activity. + */ + @Generated + private KnowledgeBaseSearchIndexActivityArguments searchIndexArguments; + + /** + * Creates an instance of KnowledgeBaseSearchIndexActivityRecord class. + */ + @Generated + public KnowledgeBaseSearchIndexActivityRecord() { + } + + /** + * Get the type property: The type of the activity record. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the searchIndexArguments property: The search index arguments for the retrieval activity. + * + * @return the searchIndexArguments value. + */ + @Generated + public KnowledgeBaseSearchIndexActivityArguments getSearchIndexArguments() { + return this.searchIndexArguments; + } + + /** + * Set the searchIndexArguments property: The search index arguments for the retrieval activity. + * + * @param searchIndexArguments the searchIndexArguments value to set. + * @return the KnowledgeBaseSearchIndexActivityRecord object itself. + */ + @Generated + public KnowledgeBaseSearchIndexActivityRecord + setSearchIndexArguments(KnowledgeBaseSearchIndexActivityArguments searchIndexArguments) { + this.searchIndexArguments = searchIndexArguments; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseSearchIndexActivityRecord setKnowledgeSourceName(String knowledgeSourceName) { + super.setKnowledgeSourceName(knowledgeSourceName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseSearchIndexActivityRecord setQueryTime(OffsetDateTime queryTime) { + super.setQueryTime(queryTime); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseSearchIndexActivityRecord setCount(Integer count) { + super.setCount(count); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseSearchIndexActivityRecord setId(int id) { + super.setId(id); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseSearchIndexActivityRecord setElapsedMs(Integer elapsedMs) { + super.setElapsedMs(elapsedMs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseSearchIndexActivityRecord setError(KnowledgeBaseErrorDetail error) { + super.setError(error); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("id", getId()); + jsonWriter.writeNumberField("elapsedMs", getElapsedMs()); + jsonWriter.writeJsonField("error", getError()); + jsonWriter.writeStringField("knowledgeSourceName", getKnowledgeSourceName()); + jsonWriter.writeStringField("queryTime", + getQueryTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getQueryTime())); + jsonWriter.writeNumberField("count", getCount()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("searchIndexArguments", this.searchIndexArguments); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseSearchIndexActivityRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseSearchIndexActivityRecord 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 KnowledgeBaseSearchIndexActivityRecord. + */ + @Generated + public static KnowledgeBaseSearchIndexActivityRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseSearchIndexActivityRecord deserializedKnowledgeBaseSearchIndexActivityRecord + = new KnowledgeBaseSearchIndexActivityRecord(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedKnowledgeBaseSearchIndexActivityRecord.setId(reader.getInt()); + } else if ("elapsedMs".equals(fieldName)) { + deserializedKnowledgeBaseSearchIndexActivityRecord + .setElapsedMs(reader.getNullable(JsonReader::getInt)); + } else if ("error".equals(fieldName)) { + deserializedKnowledgeBaseSearchIndexActivityRecord + .setError(KnowledgeBaseErrorDetail.fromJson(reader)); + } else if ("knowledgeSourceName".equals(fieldName)) { + deserializedKnowledgeBaseSearchIndexActivityRecord.setKnowledgeSourceName(reader.getString()); + } else if ("queryTime".equals(fieldName)) { + deserializedKnowledgeBaseSearchIndexActivityRecord.setQueryTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("count".equals(fieldName)) { + deserializedKnowledgeBaseSearchIndexActivityRecord.setCount(reader.getNullable(JsonReader::getInt)); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseSearchIndexActivityRecord.type = reader.getString(); + } else if ("searchIndexArguments".equals(fieldName)) { + deserializedKnowledgeBaseSearchIndexActivityRecord.searchIndexArguments + = KnowledgeBaseSearchIndexActivityArguments.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseSearchIndexActivityRecord; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseSearchIndexReference.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseSearchIndexReference.java new file mode 100644 index 000000000000..4b44429d555c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseSearchIndexReference.java @@ -0,0 +1,169 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Represents an Azure Search document reference. + */ +@Fluent +public final class KnowledgeBaseSearchIndexReference extends KnowledgeBaseReference { + /* + * The type of the reference. + */ + @Generated + private String type = "searchIndex"; + + /* + * The document key for the reference. + */ + @Generated + private String docKey; + + /** + * Creates an instance of KnowledgeBaseSearchIndexReference class. + */ + @Generated + public KnowledgeBaseSearchIndexReference() { + } + + /** + * Get the type property: The type of the reference. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the docKey property: The document key for the reference. + * + * @return the docKey value. + */ + @Generated + public String getDocKey() { + return this.docKey; + } + + /** + * Set the docKey property: The document key for the reference. + * + * @param docKey the docKey value to set. + * @return the KnowledgeBaseSearchIndexReference object itself. + */ + @Generated + public KnowledgeBaseSearchIndexReference setDocKey(String docKey) { + this.docKey = docKey; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseSearchIndexReference setId(String id) { + super.setId(id); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseSearchIndexReference setActivitySource(int activitySource) { + super.setActivitySource(activitySource); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseSearchIndexReference setSourceData(Map sourceData) { + super.setSourceData(sourceData); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseSearchIndexReference setRerankerScore(Float rerankerScore) { + super.setRerankerScore(rerankerScore); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeIntField("activitySource", getActivitySource()); + jsonWriter.writeMapField("sourceData", getSourceData(), (writer, element) -> writer.writeUntyped(element)); + jsonWriter.writeNumberField("rerankerScore", getRerankerScore()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("docKey", this.docKey); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseSearchIndexReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseSearchIndexReference 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 KnowledgeBaseSearchIndexReference. + */ + @Generated + public static KnowledgeBaseSearchIndexReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseSearchIndexReference deserializedKnowledgeBaseSearchIndexReference + = new KnowledgeBaseSearchIndexReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedKnowledgeBaseSearchIndexReference.setId(reader.getString()); + } else if ("activitySource".equals(fieldName)) { + deserializedKnowledgeBaseSearchIndexReference.setActivitySource(reader.getInt()); + } else if ("sourceData".equals(fieldName)) { + Map sourceData = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedKnowledgeBaseSearchIndexReference.setSourceData(sourceData); + } else if ("rerankerScore".equals(fieldName)) { + deserializedKnowledgeBaseSearchIndexReference + .setRerankerScore(reader.getNullable(JsonReader::getFloat)); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseSearchIndexReference.type = reader.getString(); + } else if ("docKey".equals(fieldName)) { + deserializedKnowledgeBaseSearchIndexReference.docKey = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseSearchIndexReference; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseWebActivityArguments.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseWebActivityArguments.java new file mode 100644 index 000000000000..a1bf957dfedb --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseWebActivityArguments.java @@ -0,0 +1,218 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents the arguments the web retrieval activity was run with. + */ +@Fluent +public final class KnowledgeBaseWebActivityArguments implements JsonSerializable { + /* + * The search string used to query the web. + */ + @Generated + private String search; + + /* + * The language for the retrieval activity. + */ + @Generated + private String language; + + /* + * The market for the retrieval activity. + */ + @Generated + private String market; + + /* + * The number of web results returned. + */ + @Generated + private Integer count; + + /* + * The freshness for the retrieval activity. + */ + @Generated + private String freshness; + + /** + * Creates an instance of KnowledgeBaseWebActivityArguments class. + */ + @Generated + public KnowledgeBaseWebActivityArguments() { + } + + /** + * Get the search property: The search string used to query the web. + * + * @return the search value. + */ + @Generated + public String getSearch() { + return this.search; + } + + /** + * Set the search property: The search string used to query the web. + * + * @param search the search value to set. + * @return the KnowledgeBaseWebActivityArguments object itself. + */ + @Generated + public KnowledgeBaseWebActivityArguments setSearch(String search) { + this.search = search; + return this; + } + + /** + * Get the language property: The language for the retrieval activity. + * + * @return the language value. + */ + @Generated + public String getLanguage() { + return this.language; + } + + /** + * Set the language property: The language for the retrieval activity. + * + * @param language the language value to set. + * @return the KnowledgeBaseWebActivityArguments object itself. + */ + @Generated + public KnowledgeBaseWebActivityArguments setLanguage(String language) { + this.language = language; + return this; + } + + /** + * Get the market property: The market for the retrieval activity. + * + * @return the market value. + */ + @Generated + public String getMarket() { + return this.market; + } + + /** + * Set the market property: The market for the retrieval activity. + * + * @param market the market value to set. + * @return the KnowledgeBaseWebActivityArguments object itself. + */ + @Generated + public KnowledgeBaseWebActivityArguments setMarket(String market) { + this.market = market; + return this; + } + + /** + * Get the count property: The number of web results returned. + * + * @return the count value. + */ + @Generated + public Integer getCount() { + return this.count; + } + + /** + * Set the count property: The number of web results returned. + * + * @param count the count value to set. + * @return the KnowledgeBaseWebActivityArguments object itself. + */ + @Generated + public KnowledgeBaseWebActivityArguments setCount(Integer count) { + this.count = count; + return this; + } + + /** + * Get the freshness property: The freshness for the retrieval activity. + * + * @return the freshness value. + */ + @Generated + public String getFreshness() { + return this.freshness; + } + + /** + * Set the freshness property: The freshness for the retrieval activity. + * + * @param freshness the freshness value to set. + * @return the KnowledgeBaseWebActivityArguments object itself. + */ + @Generated + public KnowledgeBaseWebActivityArguments setFreshness(String freshness) { + this.freshness = freshness; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("search", this.search); + jsonWriter.writeStringField("language", this.language); + jsonWriter.writeStringField("market", this.market); + jsonWriter.writeNumberField("count", this.count); + jsonWriter.writeStringField("freshness", this.freshness); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseWebActivityArguments from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseWebActivityArguments 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 KnowledgeBaseWebActivityArguments. + */ + @Generated + public static KnowledgeBaseWebActivityArguments fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseWebActivityArguments deserializedKnowledgeBaseWebActivityArguments + = new KnowledgeBaseWebActivityArguments(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("search".equals(fieldName)) { + deserializedKnowledgeBaseWebActivityArguments.search = reader.getString(); + } else if ("language".equals(fieldName)) { + deserializedKnowledgeBaseWebActivityArguments.language = reader.getString(); + } else if ("market".equals(fieldName)) { + deserializedKnowledgeBaseWebActivityArguments.market = reader.getString(); + } else if ("count".equals(fieldName)) { + deserializedKnowledgeBaseWebActivityArguments.count = reader.getNullable(JsonReader::getInt); + } else if ("freshness".equals(fieldName)) { + deserializedKnowledgeBaseWebActivityArguments.freshness = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseWebActivityArguments; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseWebActivityRecord.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseWebActivityRecord.java new file mode 100644 index 000000000000..3115fba8163c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseWebActivityRecord.java @@ -0,0 +1,198 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Represents a web retrieval activity record. + */ +@Fluent +public final class KnowledgeBaseWebActivityRecord extends KnowledgeBaseRetrievalActivityRecord { + /* + * The type of the activity record. + */ + @Generated + private String type = "web"; + + /* + * The web arguments for the retrieval activity. + */ + @Generated + private KnowledgeBaseWebActivityArguments webArguments; + + /** + * Creates an instance of KnowledgeBaseWebActivityRecord class. + */ + @Generated + public KnowledgeBaseWebActivityRecord() { + } + + /** + * Get the type property: The type of the activity record. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the webArguments property: The web arguments for the retrieval activity. + * + * @return the webArguments value. + */ + @Generated + public KnowledgeBaseWebActivityArguments getWebArguments() { + return this.webArguments; + } + + /** + * Set the webArguments property: The web arguments for the retrieval activity. + * + * @param webArguments the webArguments value to set. + * @return the KnowledgeBaseWebActivityRecord object itself. + */ + @Generated + public KnowledgeBaseWebActivityRecord setWebArguments(KnowledgeBaseWebActivityArguments webArguments) { + this.webArguments = webArguments; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseWebActivityRecord setKnowledgeSourceName(String knowledgeSourceName) { + super.setKnowledgeSourceName(knowledgeSourceName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseWebActivityRecord setQueryTime(OffsetDateTime queryTime) { + super.setQueryTime(queryTime); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseWebActivityRecord setCount(Integer count) { + super.setCount(count); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseWebActivityRecord setId(int id) { + super.setId(id); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseWebActivityRecord setElapsedMs(Integer elapsedMs) { + super.setElapsedMs(elapsedMs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseWebActivityRecord setError(KnowledgeBaseErrorDetail error) { + super.setError(error); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("id", getId()); + jsonWriter.writeNumberField("elapsedMs", getElapsedMs()); + jsonWriter.writeJsonField("error", getError()); + jsonWriter.writeStringField("knowledgeSourceName", getKnowledgeSourceName()); + jsonWriter.writeStringField("queryTime", + getQueryTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getQueryTime())); + jsonWriter.writeNumberField("count", getCount()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("webArguments", this.webArguments); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseWebActivityRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseWebActivityRecord 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 KnowledgeBaseWebActivityRecord. + */ + @Generated + public static KnowledgeBaseWebActivityRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseWebActivityRecord deserializedKnowledgeBaseWebActivityRecord + = new KnowledgeBaseWebActivityRecord(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedKnowledgeBaseWebActivityRecord.setId(reader.getInt()); + } else if ("elapsedMs".equals(fieldName)) { + deserializedKnowledgeBaseWebActivityRecord.setElapsedMs(reader.getNullable(JsonReader::getInt)); + } else if ("error".equals(fieldName)) { + deserializedKnowledgeBaseWebActivityRecord.setError(KnowledgeBaseErrorDetail.fromJson(reader)); + } else if ("knowledgeSourceName".equals(fieldName)) { + deserializedKnowledgeBaseWebActivityRecord.setKnowledgeSourceName(reader.getString()); + } else if ("queryTime".equals(fieldName)) { + deserializedKnowledgeBaseWebActivityRecord.setQueryTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("count".equals(fieldName)) { + deserializedKnowledgeBaseWebActivityRecord.setCount(reader.getNullable(JsonReader::getInt)); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseWebActivityRecord.type = reader.getString(); + } else if ("webArguments".equals(fieldName)) { + deserializedKnowledgeBaseWebActivityRecord.webArguments + = KnowledgeBaseWebActivityArguments.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseWebActivityRecord; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseWebReference.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseWebReference.java new file mode 100644 index 000000000000..64e92efddf4e --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeBaseWebReference.java @@ -0,0 +1,198 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Represents a web document reference. + */ +@Fluent +public final class KnowledgeBaseWebReference extends KnowledgeBaseReference { + /* + * The type of the reference. + */ + @Generated + private String type = "web"; + + /* + * The url the reference data originated from. + */ + @Generated + private String url; + + /* + * The title of the web document. + */ + @Generated + private String title; + + /** + * Creates an instance of KnowledgeBaseWebReference class. + */ + @Generated + public KnowledgeBaseWebReference() { + } + + /** + * Get the type property: The type of the reference. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the url property: The url the reference data originated from. + * + * @return the url value. + */ + @Generated + public String getUrl() { + return this.url; + } + + /** + * Set the url property: The url the reference data originated from. + * + * @param url the url value to set. + * @return the KnowledgeBaseWebReference object itself. + */ + @Generated + public KnowledgeBaseWebReference setUrl(String url) { + this.url = url; + return this; + } + + /** + * Get the title property: The title of the web document. + * + * @return the title value. + */ + @Generated + public String getTitle() { + return this.title; + } + + /** + * Set the title property: The title of the web document. + * + * @param title the title value to set. + * @return the KnowledgeBaseWebReference object itself. + */ + @Generated + public KnowledgeBaseWebReference setTitle(String title) { + this.title = title; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseWebReference setId(String id) { + super.setId(id); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseWebReference setActivitySource(int activitySource) { + super.setActivitySource(activitySource); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseWebReference setSourceData(Map sourceData) { + super.setSourceData(sourceData); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public KnowledgeBaseWebReference setRerankerScore(Float rerankerScore) { + super.setRerankerScore(rerankerScore); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeIntField("activitySource", getActivitySource()); + jsonWriter.writeMapField("sourceData", getSourceData(), (writer, element) -> writer.writeUntyped(element)); + jsonWriter.writeNumberField("rerankerScore", getRerankerScore()); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("url", this.url); + jsonWriter.writeStringField("title", this.title); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseWebReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseWebReference 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 KnowledgeBaseWebReference. + */ + @Generated + public static KnowledgeBaseWebReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBaseWebReference deserializedKnowledgeBaseWebReference = new KnowledgeBaseWebReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedKnowledgeBaseWebReference.setId(reader.getString()); + } else if ("activitySource".equals(fieldName)) { + deserializedKnowledgeBaseWebReference.setActivitySource(reader.getInt()); + } else if ("sourceData".equals(fieldName)) { + Map sourceData = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedKnowledgeBaseWebReference.setSourceData(sourceData); + } else if ("rerankerScore".equals(fieldName)) { + deserializedKnowledgeBaseWebReference.setRerankerScore(reader.getNullable(JsonReader::getFloat)); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeBaseWebReference.type = reader.getString(); + } else if ("url".equals(fieldName)) { + deserializedKnowledgeBaseWebReference.url = reader.getString(); + } else if ("title".equals(fieldName)) { + deserializedKnowledgeBaseWebReference.title = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBaseWebReference; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalHighReasoningEffort.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalHighReasoningEffort.java new file mode 100644 index 000000000000..53c91b98ad81 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalHighReasoningEffort.java @@ -0,0 +1,83 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Run knowledge retrieval with high reasoning effort. + */ +@Immutable +public final class KnowledgeRetrievalHighReasoningEffort extends KnowledgeRetrievalReasoningEffort { + /* + * The kind of reasoning effort. + */ + @Generated + private KnowledgeRetrievalReasoningEffortKind kind = KnowledgeRetrievalReasoningEffortKind.HIGH; + + /** + * Creates an instance of KnowledgeRetrievalHighReasoningEffort class. + */ + @Generated + public KnowledgeRetrievalHighReasoningEffort() { + } + + /** + * Get the kind property: The kind of reasoning effort. + * + * @return the kind value. + */ + @Generated + @Override + public KnowledgeRetrievalReasoningEffortKind getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @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 KnowledgeRetrievalHighReasoningEffort from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeRetrievalHighReasoningEffort 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 KnowledgeRetrievalHighReasoningEffort. + */ + @Generated + public static KnowledgeRetrievalHighReasoningEffort fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeRetrievalHighReasoningEffort deserializedKnowledgeRetrievalHighReasoningEffort + = new KnowledgeRetrievalHighReasoningEffort(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedKnowledgeRetrievalHighReasoningEffort.kind + = KnowledgeRetrievalReasoningEffortKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeRetrievalHighReasoningEffort; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalIntent.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalIntent.java new file mode 100644 index 000000000000..00ba2a744978 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalIntent.java @@ -0,0 +1,108 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * An intended query to execute without model query planning. + */ +@Immutable +public class KnowledgeRetrievalIntent implements JsonSerializable { + /* + * The type of the intent. + */ + @Generated + private KnowledgeRetrievalIntentType type = KnowledgeRetrievalIntentType.fromString("KnowledgeRetrievalIntent"); + + /** + * Creates an instance of KnowledgeRetrievalIntent class. + */ + @Generated + public KnowledgeRetrievalIntent() { + } + + /** + * Get the type property: The type of the intent. + * + * @return the type value. + */ + @Generated + public KnowledgeRetrievalIntentType getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeRetrievalIntent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeRetrievalIntent 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 KnowledgeRetrievalIntent. + */ + @Generated + public static KnowledgeRetrievalIntent 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 ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("semantic".equals(discriminatorValue)) { + return KnowledgeRetrievalSemanticIntent.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static KnowledgeRetrievalIntent fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeRetrievalIntent deserializedKnowledgeRetrievalIntent = new KnowledgeRetrievalIntent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedKnowledgeRetrievalIntent.type + = KnowledgeRetrievalIntentType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeRetrievalIntent; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalIntentType.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalIntentType.java new file mode 100644 index 000000000000..75a3a0038f70 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalIntentType.java @@ -0,0 +1,52 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The kind of knowledge base configuration to use. + */ +public final class KnowledgeRetrievalIntentType extends ExpandableStringEnum { + /** + * A natural language semantic query intent. + */ + @Generated + public static final KnowledgeRetrievalIntentType SEMANTIC = fromString("semantic"); + + /** + * Creates a new instance of KnowledgeRetrievalIntentType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public KnowledgeRetrievalIntentType() { + } + + /** + * Creates or finds a KnowledgeRetrievalIntentType from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnowledgeRetrievalIntentType. + */ + @Generated + public static KnowledgeRetrievalIntentType fromString(String name) { + return fromString(name, KnowledgeRetrievalIntentType.class); + } + + /** + * Gets known KnowledgeRetrievalIntentType values. + * + * @return known KnowledgeRetrievalIntentType values. + */ + @Generated + public static Collection values() { + return values(KnowledgeRetrievalIntentType.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalLowReasoningEffort.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalLowReasoningEffort.java new file mode 100644 index 000000000000..535f036d4a86 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalLowReasoningEffort.java @@ -0,0 +1,83 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Run knowledge retrieval with low reasoning effort. + */ +@Immutable +public final class KnowledgeRetrievalLowReasoningEffort extends KnowledgeRetrievalReasoningEffort { + /* + * The kind of reasoning effort. + */ + @Generated + private KnowledgeRetrievalReasoningEffortKind kind = KnowledgeRetrievalReasoningEffortKind.LOW; + + /** + * Creates an instance of KnowledgeRetrievalLowReasoningEffort class. + */ + @Generated + public KnowledgeRetrievalLowReasoningEffort() { + } + + /** + * Get the kind property: The kind of reasoning effort. + * + * @return the kind value. + */ + @Generated + @Override + public KnowledgeRetrievalReasoningEffortKind getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @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 KnowledgeRetrievalLowReasoningEffort from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeRetrievalLowReasoningEffort 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 KnowledgeRetrievalLowReasoningEffort. + */ + @Generated + public static KnowledgeRetrievalLowReasoningEffort fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeRetrievalLowReasoningEffort deserializedKnowledgeRetrievalLowReasoningEffort + = new KnowledgeRetrievalLowReasoningEffort(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedKnowledgeRetrievalLowReasoningEffort.kind + = KnowledgeRetrievalReasoningEffortKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeRetrievalLowReasoningEffort; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalMediumReasoningEffort.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalMediumReasoningEffort.java new file mode 100644 index 000000000000..481cbb75d39d --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalMediumReasoningEffort.java @@ -0,0 +1,83 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Run knowledge retrieval with medium reasoning effort. + */ +@Immutable +public final class KnowledgeRetrievalMediumReasoningEffort extends KnowledgeRetrievalReasoningEffort { + /* + * The kind of reasoning effort. + */ + @Generated + private KnowledgeRetrievalReasoningEffortKind kind = KnowledgeRetrievalReasoningEffortKind.MEDIUM; + + /** + * Creates an instance of KnowledgeRetrievalMediumReasoningEffort class. + */ + @Generated + public KnowledgeRetrievalMediumReasoningEffort() { + } + + /** + * Get the kind property: The kind of reasoning effort. + * + * @return the kind value. + */ + @Generated + @Override + public KnowledgeRetrievalReasoningEffortKind getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @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 KnowledgeRetrievalMediumReasoningEffort from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeRetrievalMediumReasoningEffort 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 KnowledgeRetrievalMediumReasoningEffort. + */ + @Generated + public static KnowledgeRetrievalMediumReasoningEffort fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeRetrievalMediumReasoningEffort deserializedKnowledgeRetrievalMediumReasoningEffort + = new KnowledgeRetrievalMediumReasoningEffort(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedKnowledgeRetrievalMediumReasoningEffort.kind + = KnowledgeRetrievalReasoningEffortKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeRetrievalMediumReasoningEffort; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalMinimalReasoningEffort.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalMinimalReasoningEffort.java new file mode 100644 index 000000000000..071b588423cd --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalMinimalReasoningEffort.java @@ -0,0 +1,83 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Run knowledge retrieval with minimal reasoning effort. + */ +@Immutable +public final class KnowledgeRetrievalMinimalReasoningEffort extends KnowledgeRetrievalReasoningEffort { + /* + * The kind of reasoning effort. + */ + @Generated + private KnowledgeRetrievalReasoningEffortKind kind = KnowledgeRetrievalReasoningEffortKind.MINIMAL; + + /** + * Creates an instance of KnowledgeRetrievalMinimalReasoningEffort class. + */ + @Generated + public KnowledgeRetrievalMinimalReasoningEffort() { + } + + /** + * Get the kind property: The kind of reasoning effort. + * + * @return the kind value. + */ + @Generated + @Override + public KnowledgeRetrievalReasoningEffortKind getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @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 KnowledgeRetrievalMinimalReasoningEffort from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeRetrievalMinimalReasoningEffort 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 KnowledgeRetrievalMinimalReasoningEffort. + */ + @Generated + public static KnowledgeRetrievalMinimalReasoningEffort fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeRetrievalMinimalReasoningEffort deserializedKnowledgeRetrievalMinimalReasoningEffort + = new KnowledgeRetrievalMinimalReasoningEffort(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedKnowledgeRetrievalMinimalReasoningEffort.kind + = KnowledgeRetrievalReasoningEffortKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeRetrievalMinimalReasoningEffort; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalOutputMode.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalOutputMode.java new file mode 100644 index 000000000000..043752636ef1 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalOutputMode.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The output configuration for this retrieval. + */ +public final class KnowledgeRetrievalOutputMode extends ExpandableStringEnum { + /** + * Return data from the knowledge sources directly without generative alteration. + */ + @Generated + public static final KnowledgeRetrievalOutputMode EXTRACTIVE_DATA = fromString("extractiveData"); + + /** + * Synthesize an answer for the response payload. + */ + @Generated + public static final KnowledgeRetrievalOutputMode ANSWER_SYNTHESIS = fromString("answerSynthesis"); + + /** + * Creates a new instance of KnowledgeRetrievalOutputMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public KnowledgeRetrievalOutputMode() { + } + + /** + * Creates or finds a KnowledgeRetrievalOutputMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnowledgeRetrievalOutputMode. + */ + @Generated + public static KnowledgeRetrievalOutputMode fromString(String name) { + return fromString(name, KnowledgeRetrievalOutputMode.class); + } + + /** + * Gets known KnowledgeRetrievalOutputMode values. + * + * @return known KnowledgeRetrievalOutputMode values. + */ + @Generated + public static Collection values() { + return values(KnowledgeRetrievalOutputMode.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalReasoningEffort.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalReasoningEffort.java new file mode 100644 index 000000000000..876f90d95aa7 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalReasoningEffort.java @@ -0,0 +1,116 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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 KnowledgeRetrievalReasoningEffort model. + */ +@Immutable +public class KnowledgeRetrievalReasoningEffort implements JsonSerializable { + /* + * The kind of reasoning effort. + */ + @Generated + private KnowledgeRetrievalReasoningEffortKind kind + = KnowledgeRetrievalReasoningEffortKind.fromString("KnowledgeRetrievalReasoningEffort"); + + /** + * Creates an instance of KnowledgeRetrievalReasoningEffort class. + */ + @Generated + public KnowledgeRetrievalReasoningEffort() { + } + + /** + * Get the kind property: The kind of reasoning effort. + * + * @return the kind value. + */ + @Generated + public KnowledgeRetrievalReasoningEffortKind getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @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 KnowledgeRetrievalReasoningEffort from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeRetrievalReasoningEffort 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 KnowledgeRetrievalReasoningEffort. + */ + @Generated + public static KnowledgeRetrievalReasoningEffort 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 ("minimal".equals(discriminatorValue)) { + return KnowledgeRetrievalMinimalReasoningEffort.fromJson(readerToUse.reset()); + } else if ("low".equals(discriminatorValue)) { + return KnowledgeRetrievalLowReasoningEffort.fromJson(readerToUse.reset()); + } else if ("medium".equals(discriminatorValue)) { + return KnowledgeRetrievalMediumReasoningEffort.fromJson(readerToUse.reset()); + } else if ("high".equals(discriminatorValue)) { + return KnowledgeRetrievalHighReasoningEffort.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static KnowledgeRetrievalReasoningEffort fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeRetrievalReasoningEffort deserializedKnowledgeRetrievalReasoningEffort + = new KnowledgeRetrievalReasoningEffort(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedKnowledgeRetrievalReasoningEffort.kind + = KnowledgeRetrievalReasoningEffortKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeRetrievalReasoningEffort; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalReasoningEffortKind.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalReasoningEffortKind.java new file mode 100644 index 000000000000..5f32da7bd323 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalReasoningEffortKind.java @@ -0,0 +1,71 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The amount of effort to use during retrieval. + */ +public final class KnowledgeRetrievalReasoningEffortKind + extends ExpandableStringEnum { + /** + * Does not perform any source selections, any query planning, or any iterative search. + */ + @Generated + public static final KnowledgeRetrievalReasoningEffortKind MINIMAL = fromString("minimal"); + + /** + * Use low reasoning during retrieval. + */ + @Generated + public static final KnowledgeRetrievalReasoningEffortKind LOW = fromString("low"); + + /** + * Use a moderate amount of reasoning during retrieval. + */ + @Generated + public static final KnowledgeRetrievalReasoningEffortKind MEDIUM = fromString("medium"); + + /** + * Use a high amount of reasoning during retrieval. + */ + @Generated + public static final KnowledgeRetrievalReasoningEffortKind HIGH = fromString("high"); + + /** + * Creates a new instance of KnowledgeRetrievalReasoningEffortKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public KnowledgeRetrievalReasoningEffortKind() { + } + + /** + * Creates or finds a KnowledgeRetrievalReasoningEffortKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnowledgeRetrievalReasoningEffortKind. + */ + @Generated + public static KnowledgeRetrievalReasoningEffortKind fromString(String name) { + return fromString(name, KnowledgeRetrievalReasoningEffortKind.class); + } + + /** + * Gets known KnowledgeRetrievalReasoningEffortKind values. + * + * @return known KnowledgeRetrievalReasoningEffortKind values. + */ + @Generated + public static Collection values() { + return values(KnowledgeRetrievalReasoningEffortKind.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalSemanticIntent.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalSemanticIntent.java new file mode 100644 index 000000000000..95d8cee77bcb --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeRetrievalSemanticIntent.java @@ -0,0 +1,115 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The KnowledgeRetrievalSemanticIntent model. + */ +@Fluent +public final class KnowledgeRetrievalSemanticIntent extends KnowledgeRetrievalIntent { + /* + * The type of the intent. + */ + @Generated + private KnowledgeRetrievalIntentType type = KnowledgeRetrievalIntentType.SEMANTIC; + + /* + * The semantic query to execute + */ + @Generated + private String search; + + /** + * Creates an instance of KnowledgeRetrievalSemanticIntent class. + */ + @Generated + public KnowledgeRetrievalSemanticIntent() { + } + + /** + * Get the type property: The type of the intent. + * + * @return the type value. + */ + @Generated + @Override + public KnowledgeRetrievalIntentType getType() { + return this.type; + } + + /** + * Get the search property: The semantic query to execute. + * + * @return the search value. + */ + @Generated + public String getSearch() { + return this.search; + } + + /** + * Set the search property: The semantic query to execute. + * + * @param search the search value to set. + * @return the KnowledgeRetrievalSemanticIntent object itself. + */ + @Generated + public KnowledgeRetrievalSemanticIntent setSearch(String search) { + this.search = search; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("search", this.search); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeRetrievalSemanticIntent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeRetrievalSemanticIntent 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 KnowledgeRetrievalSemanticIntent. + */ + @Generated + public static KnowledgeRetrievalSemanticIntent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeRetrievalSemanticIntent deserializedKnowledgeRetrievalSemanticIntent + = new KnowledgeRetrievalSemanticIntent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("search".equals(fieldName)) { + deserializedKnowledgeRetrievalSemanticIntent.search = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedKnowledgeRetrievalSemanticIntent.type + = KnowledgeRetrievalIntentType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeRetrievalSemanticIntent; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSource.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSource.java new file mode 100644 index 000000000000..aa7617c06636 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSource.java @@ -0,0 +1,260 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a knowledge source definition. + */ +@Fluent +public class KnowledgeSource implements JsonSerializable { + /* + * The type of the knowledge source. + */ + @Generated + private KnowledgeSourceKind kind = KnowledgeSourceKind.fromString("KnowledgeSource"); + + /* + * The name of the knowledge source. + */ + @Generated + private String name; + + /* + * Optional user-defined description. + */ + @Generated + private String description; + + /* + * The ETag of the knowledge base. + */ + @Generated + private String eTag; + + /* + * 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 knowledge base definition when you want full assurance that no one, not even + * Microsoft, can decrypt them. Once you have encrypted your knowledge base definition, it will always remain + * encrypted. The search service will ignore attempts to set this property to null. You can change this property as + * needed if you want to rotate your encryption key; Your knowledge base definition will be unaffected. Encryption + * with customer-managed keys is not available for free search services, and is only available for paid services + * created on or after January 1, 2019. + */ + @Generated + private SearchResourceEncryptionKey encryptionKey; + + /** + * Creates an instance of KnowledgeSource class. + */ + @Generated + public KnowledgeSource() { + } + + /** + * Get the kind property: The type of the knowledge source. + * + * @return the kind value. + */ + @Generated + public KnowledgeSourceKind getKind() { + return this.kind; + } + + /** + * Get the name property: The name of the knowledge source. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the knowledge source. + * + * @param name the name value to set. + * @return the KnowledgeSource object itself. + */ + @Generated + public KnowledgeSource setName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: Optional user-defined description. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: Optional user-defined description. + * + * @param description the description value to set. + * @return the KnowledgeSource object itself. + */ + @Generated + public KnowledgeSource setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the eTag property: The ETag of the knowledge base. + * + * @return the eTag value. + */ + @Generated + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag of the knowledge base. + * + * @param eTag the eTag value to set. + * @return the KnowledgeSource object itself. + */ + @Generated + public KnowledgeSource setETag(String eTag) { + this.eTag = eTag; + 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 knowledge base definition when you want + * full assurance that no one, not even Microsoft, can decrypt them. Once you have encrypted your knowledge base + * definition, it will always remain encrypted. The search service will ignore attempts to set this property to + * null. You can change this property as needed if you want to rotate your encryption key; Your knowledge base + * definition will be unaffected. Encryption with customer-managed keys is not available for free search services, + * and is only available for paid services created on or after January 1, 2019. + * + * @return the encryptionKey value. + */ + @Generated + public SearchResourceEncryptionKey getEncryptionKey() { + return this.encryptionKey; + } + + /** + * Set 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 knowledge base definition when you want + * full assurance that no one, not even Microsoft, can decrypt them. Once you have encrypted your knowledge base + * definition, it will always remain encrypted. The search service will ignore attempts to set this property to + * null. You can change this property as needed if you want to rotate your encryption key; Your knowledge base + * definition will be unaffected. Encryption with customer-managed keys is not available for free search services, + * and is only available for paid services created on or after January 1, 2019. + * + * @param encryptionKey the encryptionKey value to set. + * @return the KnowledgeSource object itself. + */ + @Generated + public KnowledgeSource setEncryptionKey(SearchResourceEncryptionKey encryptionKey) { + this.encryptionKey = encryptionKey; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("@odata.etag", this.eTag); + jsonWriter.writeJsonField("encryptionKey", this.encryptionKey); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeSource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeSource 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 KnowledgeSource. + */ + @Generated + public static KnowledgeSource 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 ("searchIndex".equals(discriminatorValue)) { + return SearchIndexKnowledgeSource.fromJson(readerToUse.reset()); + } else if ("azureBlob".equals(discriminatorValue)) { + return AzureBlobKnowledgeSource.fromJson(readerToUse.reset()); + } else if ("indexedSharePoint".equals(discriminatorValue)) { + return IndexedSharePointKnowledgeSource.fromJson(readerToUse.reset()); + } else if ("indexedOneLake".equals(discriminatorValue)) { + return IndexedOneLakeKnowledgeSource.fromJson(readerToUse.reset()); + } else if ("web".equals(discriminatorValue)) { + return WebKnowledgeSource.fromJson(readerToUse.reset()); + } else if ("remoteSharePoint".equals(discriminatorValue)) { + return RemoteSharePointKnowledgeSource.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static KnowledgeSource fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeSource deserializedKnowledgeSource = new KnowledgeSource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedKnowledgeSource.name = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedKnowledgeSource.kind = KnowledgeSourceKind.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedKnowledgeSource.description = reader.getString(); + } else if ("@odata.etag".equals(fieldName)) { + deserializedKnowledgeSource.eTag = reader.getString(); + } else if ("encryptionKey".equals(fieldName)) { + deserializedKnowledgeSource.encryptionKey = SearchResourceEncryptionKey.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeSource; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceAzureOpenAIVectorizer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceAzureOpenAIVectorizer.java new file mode 100644 index 000000000000..fa45fdb2f606 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceAzureOpenAIVectorizer.java @@ -0,0 +1,115 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specifies the Azure OpenAI resource used to vectorize a query string. + */ +@Fluent +public final class KnowledgeSourceAzureOpenAIVectorizer extends KnowledgeSourceVectorizer { + /* + * The name of the kind of vectorization method being configured for use with vector search. + */ + @Generated + private VectorSearchVectorizerKind kind = VectorSearchVectorizerKind.AZURE_OPEN_AI; + + /* + * Contains the parameters specific to Azure OpenAI embedding vectorization. + */ + @Generated + private AzureOpenAIParameters azureOpenAIParameters; + + /** + * Creates an instance of KnowledgeSourceAzureOpenAIVectorizer class. + */ + @Generated + public KnowledgeSourceAzureOpenAIVectorizer() { + } + + /** + * Get the kind property: The name of the kind of vectorization method being configured for use with vector search. + * + * @return the kind value. + */ + @Generated + @Override + public VectorSearchVectorizerKind getKind() { + return this.kind; + } + + /** + * Get the azureOpenAIParameters property: Contains the parameters specific to Azure OpenAI embedding vectorization. + * + * @return the azureOpenAIParameters value. + */ + @Generated + public AzureOpenAIParameters getAzureOpenAIParameters() { + return this.azureOpenAIParameters; + } + + /** + * Set the azureOpenAIParameters property: Contains the parameters specific to Azure OpenAI embedding vectorization. + * + * @param azureOpenAIParameters the azureOpenAIParameters value to set. + * @return the KnowledgeSourceAzureOpenAIVectorizer object itself. + */ + @Generated + public KnowledgeSourceAzureOpenAIVectorizer setAzureOpenAIParameters(AzureOpenAIParameters azureOpenAIParameters) { + this.azureOpenAIParameters = azureOpenAIParameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("azureOpenAIParameters", this.azureOpenAIParameters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeSourceAzureOpenAIVectorizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeSourceAzureOpenAIVectorizer 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 KnowledgeSourceAzureOpenAIVectorizer. + */ + @Generated + public static KnowledgeSourceAzureOpenAIVectorizer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeSourceAzureOpenAIVectorizer deserializedKnowledgeSourceAzureOpenAIVectorizer + = new KnowledgeSourceAzureOpenAIVectorizer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedKnowledgeSourceAzureOpenAIVectorizer.kind + = VectorSearchVectorizerKind.fromString(reader.getString()); + } else if ("azureOpenAIParameters".equals(fieldName)) { + deserializedKnowledgeSourceAzureOpenAIVectorizer.azureOpenAIParameters + = AzureOpenAIParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeSourceAzureOpenAIVectorizer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceContentExtractionMode.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceContentExtractionMode.java new file mode 100644 index 000000000000..3b5f010f3c79 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceContentExtractionMode.java @@ -0,0 +1,59 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Optional content extraction mode. Default is 'minimal'. + */ +public final class KnowledgeSourceContentExtractionMode + extends ExpandableStringEnum { + /** + * Extracts only essential metadata while deferring most content processing. + */ + @Generated + public static final KnowledgeSourceContentExtractionMode MINIMAL = fromString("minimal"); + + /** + * Performs the full default content extraction pipeline. + */ + @Generated + public static final KnowledgeSourceContentExtractionMode STANDARD = fromString("standard"); + + /** + * Creates a new instance of KnowledgeSourceContentExtractionMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public KnowledgeSourceContentExtractionMode() { + } + + /** + * Creates or finds a KnowledgeSourceContentExtractionMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnowledgeSourceContentExtractionMode. + */ + @Generated + public static KnowledgeSourceContentExtractionMode fromString(String name) { + return fromString(name, KnowledgeSourceContentExtractionMode.class); + } + + /** + * Gets known KnowledgeSourceContentExtractionMode values. + * + * @return known KnowledgeSourceContentExtractionMode values. + */ + @Generated + public static Collection values() { + return values(KnowledgeSourceContentExtractionMode.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceIngestionParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceIngestionParameters.java new file mode 100644 index 000000000000..29e17ff82bc7 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceIngestionParameters.java @@ -0,0 +1,332 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Consolidates all general ingestion settings for knowledge sources. + */ +@Fluent +public final class KnowledgeSourceIngestionParameters implements JsonSerializable { + /* + * An explicit identity to use for this knowledge source. + */ + @Generated + private SearchIndexerDataIdentity identity; + + /* + * Optional vectorizer configuration for vectorizing content. + */ + @Generated + private KnowledgeSourceVectorizer embeddingModel; + + /* + * Optional chat completion model for image verbalization or context extraction. + */ + @Generated + private KnowledgeBaseModel chatCompletionModel; + + /* + * Indicates whether image verbalization should be disabled. Default is false. + */ + @Generated + private Boolean disableImageVerbalization; + + /* + * Optional schedule for data ingestion. + */ + @Generated + private IndexingSchedule ingestionSchedule; + + /* + * Optional list of permission types to ingest together with document content. If specified, it will set the indexer + * permission options for the data source. + */ + @Generated + private List ingestionPermissionOptions; + + /* + * Optional content extraction mode. Default is 'minimal'. + */ + @Generated + private KnowledgeSourceContentExtractionMode contentExtractionMode; + + /* + * Optional AI Services configuration for content processing. + */ + @Generated + private AIServices aiServices; + + /** + * Creates an instance of KnowledgeSourceIngestionParameters class. + */ + @Generated + public KnowledgeSourceIngestionParameters() { + } + + /** + * Get the identity property: An explicit identity to use for this knowledge source. + * + * @return the identity value. + */ + @Generated + public SearchIndexerDataIdentity getIdentity() { + return this.identity; + } + + /** + * Set the identity property: An explicit identity to use for this knowledge source. + * + * @param identity the identity value to set. + * @return the KnowledgeSourceIngestionParameters object itself. + */ + @Generated + public KnowledgeSourceIngestionParameters setIdentity(SearchIndexerDataIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the embeddingModel property: Optional vectorizer configuration for vectorizing content. + * + * @return the embeddingModel value. + */ + @Generated + public KnowledgeSourceVectorizer getEmbeddingModel() { + return this.embeddingModel; + } + + /** + * Set the embeddingModel property: Optional vectorizer configuration for vectorizing content. + * + * @param embeddingModel the embeddingModel value to set. + * @return the KnowledgeSourceIngestionParameters object itself. + */ + @Generated + public KnowledgeSourceIngestionParameters setEmbeddingModel(KnowledgeSourceVectorizer embeddingModel) { + this.embeddingModel = embeddingModel; + return this; + } + + /** + * Get the chatCompletionModel property: Optional chat completion model for image verbalization or context + * extraction. + * + * @return the chatCompletionModel value. + */ + @Generated + public KnowledgeBaseModel getChatCompletionModel() { + return this.chatCompletionModel; + } + + /** + * Set the chatCompletionModel property: Optional chat completion model for image verbalization or context + * extraction. + * + * @param chatCompletionModel the chatCompletionModel value to set. + * @return the KnowledgeSourceIngestionParameters object itself. + */ + @Generated + public KnowledgeSourceIngestionParameters setChatCompletionModel(KnowledgeBaseModel chatCompletionModel) { + this.chatCompletionModel = chatCompletionModel; + return this; + } + + /** + * Get the disableImageVerbalization property: Indicates whether image verbalization should be disabled. Default is + * false. + * + * @return the disableImageVerbalization value. + */ + @Generated + public Boolean isDisableImageVerbalization() { + return this.disableImageVerbalization; + } + + /** + * Set the disableImageVerbalization property: Indicates whether image verbalization should be disabled. Default is + * false. + * + * @param disableImageVerbalization the disableImageVerbalization value to set. + * @return the KnowledgeSourceIngestionParameters object itself. + */ + @Generated + public KnowledgeSourceIngestionParameters setDisableImageVerbalization(Boolean disableImageVerbalization) { + this.disableImageVerbalization = disableImageVerbalization; + return this; + } + + /** + * Get the ingestionSchedule property: Optional schedule for data ingestion. + * + * @return the ingestionSchedule value. + */ + @Generated + public IndexingSchedule getIngestionSchedule() { + return this.ingestionSchedule; + } + + /** + * Set the ingestionSchedule property: Optional schedule for data ingestion. + * + * @param ingestionSchedule the ingestionSchedule value to set. + * @return the KnowledgeSourceIngestionParameters object itself. + */ + @Generated + public KnowledgeSourceIngestionParameters setIngestionSchedule(IndexingSchedule ingestionSchedule) { + this.ingestionSchedule = ingestionSchedule; + return this; + } + + /** + * Get the ingestionPermissionOptions property: Optional list of permission types to ingest together with document + * content. If specified, it will set the indexer permission options for the data source. + * + * @return the ingestionPermissionOptions value. + */ + @Generated + public List getIngestionPermissionOptions() { + return this.ingestionPermissionOptions; + } + + /** + * Set the ingestionPermissionOptions property: Optional list of permission types to ingest together with document + * content. If specified, it will set the indexer permission options for the data source. + * + * @param ingestionPermissionOptions the ingestionPermissionOptions value to set. + * @return the KnowledgeSourceIngestionParameters object itself. + */ + @Generated + public KnowledgeSourceIngestionParameters + setIngestionPermissionOptions(List ingestionPermissionOptions) { + this.ingestionPermissionOptions = ingestionPermissionOptions; + return this; + } + + /** + * Get the contentExtractionMode property: Optional content extraction mode. Default is 'minimal'. + * + * @return the contentExtractionMode value. + */ + @Generated + public KnowledgeSourceContentExtractionMode getContentExtractionMode() { + return this.contentExtractionMode; + } + + /** + * Set the contentExtractionMode property: Optional content extraction mode. Default is 'minimal'. + * + * @param contentExtractionMode the contentExtractionMode value to set. + * @return the KnowledgeSourceIngestionParameters object itself. + */ + @Generated + public KnowledgeSourceIngestionParameters + setContentExtractionMode(KnowledgeSourceContentExtractionMode contentExtractionMode) { + this.contentExtractionMode = contentExtractionMode; + return this; + } + + /** + * Get the aiServices property: Optional AI Services configuration for content processing. + * + * @return the aiServices value. + */ + @Generated + public AIServices getAiServices() { + return this.aiServices; + } + + /** + * Set the aiServices property: Optional AI Services configuration for content processing. + * + * @param aiServices the aiServices value to set. + * @return the KnowledgeSourceIngestionParameters object itself. + */ + @Generated + public KnowledgeSourceIngestionParameters setAiServices(AIServices aiServices) { + this.aiServices = aiServices; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeJsonField("embeddingModel", this.embeddingModel); + jsonWriter.writeJsonField("chatCompletionModel", this.chatCompletionModel); + jsonWriter.writeBooleanField("disableImageVerbalization", this.disableImageVerbalization); + jsonWriter.writeJsonField("ingestionSchedule", this.ingestionSchedule); + jsonWriter.writeArrayField("ingestionPermissionOptions", this.ingestionPermissionOptions, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("contentExtractionMode", + this.contentExtractionMode == null ? null : this.contentExtractionMode.toString()); + jsonWriter.writeJsonField("aiServices", this.aiServices); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeSourceIngestionParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeSourceIngestionParameters 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 KnowledgeSourceIngestionParameters. + */ + @Generated + public static KnowledgeSourceIngestionParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeSourceIngestionParameters deserializedKnowledgeSourceIngestionParameters + = new KnowledgeSourceIngestionParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("identity".equals(fieldName)) { + deserializedKnowledgeSourceIngestionParameters.identity + = SearchIndexerDataIdentity.fromJson(reader); + } else if ("embeddingModel".equals(fieldName)) { + deserializedKnowledgeSourceIngestionParameters.embeddingModel + = KnowledgeSourceVectorizer.fromJson(reader); + } else if ("chatCompletionModel".equals(fieldName)) { + deserializedKnowledgeSourceIngestionParameters.chatCompletionModel + = KnowledgeBaseModel.fromJson(reader); + } else if ("disableImageVerbalization".equals(fieldName)) { + deserializedKnowledgeSourceIngestionParameters.disableImageVerbalization + = reader.getNullable(JsonReader::getBoolean); + } else if ("ingestionSchedule".equals(fieldName)) { + deserializedKnowledgeSourceIngestionParameters.ingestionSchedule + = IndexingSchedule.fromJson(reader); + } else if ("ingestionPermissionOptions".equals(fieldName)) { + List ingestionPermissionOptions = reader + .readArray(reader1 -> KnowledgeSourceIngestionPermissionOption.fromString(reader1.getString())); + deserializedKnowledgeSourceIngestionParameters.ingestionPermissionOptions + = ingestionPermissionOptions; + } else if ("contentExtractionMode".equals(fieldName)) { + deserializedKnowledgeSourceIngestionParameters.contentExtractionMode + = KnowledgeSourceContentExtractionMode.fromString(reader.getString()); + } else if ("aiServices".equals(fieldName)) { + deserializedKnowledgeSourceIngestionParameters.aiServices = AIServices.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeSourceIngestionParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceIngestionPermissionOption.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceIngestionPermissionOption.java new file mode 100644 index 000000000000..7433336f1982 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceIngestionPermissionOption.java @@ -0,0 +1,65 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for KnowledgeSourceIngestionPermissionOption. + */ +public final class KnowledgeSourceIngestionPermissionOption + extends ExpandableStringEnum { + /** + * Ingest explicit user identifiers alongside document content. + */ + @Generated + public static final KnowledgeSourceIngestionPermissionOption USER_IDS = fromString("userIds"); + + /** + * Ingest group identifiers alongside document content. + */ + @Generated + public static final KnowledgeSourceIngestionPermissionOption GROUP_IDS = fromString("groupIds"); + + /** + * Ingest RBAC scope information alongside document content. + */ + @Generated + public static final KnowledgeSourceIngestionPermissionOption RBAC_SCOPE = fromString("rbacScope"); + + /** + * Creates a new instance of KnowledgeSourceIngestionPermissionOption value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public KnowledgeSourceIngestionPermissionOption() { + } + + /** + * Creates or finds a KnowledgeSourceIngestionPermissionOption from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnowledgeSourceIngestionPermissionOption. + */ + @Generated + public static KnowledgeSourceIngestionPermissionOption fromString(String name) { + return fromString(name, KnowledgeSourceIngestionPermissionOption.class); + } + + /** + * Gets known KnowledgeSourceIngestionPermissionOption values. + * + * @return known KnowledgeSourceIngestionPermissionOption values. + */ + @Generated + public static Collection values() { + return values(KnowledgeSourceIngestionPermissionOption.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceKind.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceKind.java new file mode 100644 index 000000000000..187d0b8ebaa3 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceKind.java @@ -0,0 +1,82 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The kind of the knowledge source. + */ +public final class KnowledgeSourceKind extends ExpandableStringEnum { + /** + * A knowledge source that retrieves data from a Search Index. + */ + @Generated + public static final KnowledgeSourceKind SEARCH_INDEX = fromString("searchIndex"); + + /** + * A knowledge source that retrieves and ingests data from Azure Blob Storage to a Search Index. + */ + @Generated + public static final KnowledgeSourceKind AZURE_BLOB = fromString("azureBlob"); + + /** + * A knowledge source that retrieves data from the web. + */ + @Generated + public static final KnowledgeSourceKind WEB = fromString("web"); + + /** + * A knowledge source that retrieves data from a remote SharePoint endpoint. + */ + @Generated + public static final KnowledgeSourceKind REMOTE_SHARE_POINT = fromString("remoteSharePoint"); + + /** + * A knowledge source that retrieves and ingests data from SharePoint to a Search Index. + */ + @Generated + public static final KnowledgeSourceKind INDEXED_SHARE_POINT = fromString("indexedSharePoint"); + + /** + * A knowledge source that retrieves and ingests data from OneLake to a Search Index. + */ + @Generated + public static final KnowledgeSourceKind INDEXED_ONE_LAKE = fromString("indexedOneLake"); + + /** + * Creates a new instance of KnowledgeSourceKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public KnowledgeSourceKind() { + } + + /** + * Creates or finds a KnowledgeSourceKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnowledgeSourceKind. + */ + @Generated + public static KnowledgeSourceKind fromString(String name) { + return fromString(name, KnowledgeSourceKind.class); + } + + /** + * Gets known KnowledgeSourceKind values. + * + * @return known KnowledgeSourceKind values. + */ + @Generated + public static Collection values() { + return values(KnowledgeSourceKind.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceParams.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceParams.java new file mode 100644 index 000000000000..ee29c2268f79 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceParams.java @@ -0,0 +1,282 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 KnowledgeSourceParams model. + */ +@Fluent +public class KnowledgeSourceParams implements JsonSerializable { + /* + * The type of the knowledge source. + */ + @Generated + private KnowledgeSourceKind kind = KnowledgeSourceKind.fromString("KnowledgeSourceParams"); + + /* + * The name of the index the params apply to. + */ + @Generated + private String knowledgeSourceName; + + /* + * Indicates whether references should be included for data retrieved from this source. + */ + @Generated + private Boolean includeReferences; + + /* + * Indicates whether references should include the structured data obtained during retrieval in their payload. + */ + @Generated + private Boolean includeReferenceSourceData; + + /* + * Indicates that this knowledge source should bypass source selection and always be queried at retrieval time. + */ + @Generated + private Boolean alwaysQuerySource; + + /* + * The reranker threshold all retrieved documents must meet to be included in the response. + */ + @Generated + private Float rerankerThreshold; + + /** + * Creates an instance of KnowledgeSourceParams class. + */ + @Generated + public KnowledgeSourceParams() { + } + + /** + * Get the kind property: The type of the knowledge source. + * + * @return the kind value. + */ + @Generated + public KnowledgeSourceKind getKind() { + return this.kind; + } + + /** + * Get the knowledgeSourceName property: The name of the index the params apply to. + * + * @return the knowledgeSourceName value. + */ + @Generated + public String getKnowledgeSourceName() { + return this.knowledgeSourceName; + } + + /** + * Set the knowledgeSourceName property: The name of the index the params apply to. + * + * @param knowledgeSourceName the knowledgeSourceName value to set. + * @return the KnowledgeSourceParams object itself. + */ + @Generated + public KnowledgeSourceParams setKnowledgeSourceName(String knowledgeSourceName) { + this.knowledgeSourceName = knowledgeSourceName; + return this; + } + + /** + * Get the includeReferences property: Indicates whether references should be included for data retrieved from this + * source. + * + * @return the includeReferences value. + */ + @Generated + public Boolean isIncludeReferences() { + return this.includeReferences; + } + + /** + * Set the includeReferences property: Indicates whether references should be included for data retrieved from this + * source. + * + * @param includeReferences the includeReferences value to set. + * @return the KnowledgeSourceParams object itself. + */ + @Generated + public KnowledgeSourceParams setIncludeReferences(Boolean includeReferences) { + this.includeReferences = includeReferences; + return this; + } + + /** + * Get the includeReferenceSourceData property: Indicates whether references should include the structured data + * obtained during retrieval in their payload. + * + * @return the includeReferenceSourceData value. + */ + @Generated + public Boolean isIncludeReferenceSourceData() { + return this.includeReferenceSourceData; + } + + /** + * Set the includeReferenceSourceData property: Indicates whether references should include the structured data + * obtained during retrieval in their payload. + * + * @param includeReferenceSourceData the includeReferenceSourceData value to set. + * @return the KnowledgeSourceParams object itself. + */ + @Generated + public KnowledgeSourceParams setIncludeReferenceSourceData(Boolean includeReferenceSourceData) { + this.includeReferenceSourceData = includeReferenceSourceData; + return this; + } + + /** + * Get the alwaysQuerySource property: Indicates that this knowledge source should bypass source selection and + * always be queried at retrieval time. + * + * @return the alwaysQuerySource value. + */ + @Generated + public Boolean isAlwaysQuerySource() { + return this.alwaysQuerySource; + } + + /** + * Set the alwaysQuerySource property: Indicates that this knowledge source should bypass source selection and + * always be queried at retrieval time. + * + * @param alwaysQuerySource the alwaysQuerySource value to set. + * @return the KnowledgeSourceParams object itself. + */ + @Generated + public KnowledgeSourceParams setAlwaysQuerySource(Boolean alwaysQuerySource) { + this.alwaysQuerySource = alwaysQuerySource; + return this; + } + + /** + * Get the rerankerThreshold property: The reranker threshold all retrieved documents must meet to be included in + * the response. + * + * @return the rerankerThreshold value. + */ + @Generated + public Float getRerankerThreshold() { + return this.rerankerThreshold; + } + + /** + * Set the rerankerThreshold property: The reranker threshold all retrieved documents must meet to be included in + * the response. + * + * @param rerankerThreshold the rerankerThreshold value to set. + * @return the KnowledgeSourceParams object itself. + */ + @Generated + public KnowledgeSourceParams setRerankerThreshold(Float rerankerThreshold) { + this.rerankerThreshold = rerankerThreshold; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("knowledgeSourceName", this.knowledgeSourceName); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeBooleanField("includeReferences", this.includeReferences); + jsonWriter.writeBooleanField("includeReferenceSourceData", this.includeReferenceSourceData); + jsonWriter.writeBooleanField("alwaysQuerySource", this.alwaysQuerySource); + jsonWriter.writeNumberField("rerankerThreshold", this.rerankerThreshold); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeSourceParams from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeSourceParams 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 KnowledgeSourceParams. + */ + @Generated + public static KnowledgeSourceParams 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 ("searchIndex".equals(discriminatorValue)) { + return SearchIndexKnowledgeSourceParams.fromJson(readerToUse.reset()); + } else if ("azureBlob".equals(discriminatorValue)) { + return AzureBlobKnowledgeSourceParams.fromJson(readerToUse.reset()); + } else if ("indexedSharePoint".equals(discriminatorValue)) { + return IndexedSharePointKnowledgeSourceParams.fromJson(readerToUse.reset()); + } else if ("indexedOneLake".equals(discriminatorValue)) { + return IndexedOneLakeKnowledgeSourceParams.fromJson(readerToUse.reset()); + } else if ("web".equals(discriminatorValue)) { + return WebKnowledgeSourceParams.fromJson(readerToUse.reset()); + } else if ("remoteSharePoint".equals(discriminatorValue)) { + return RemoteSharePointKnowledgeSourceParams.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static KnowledgeSourceParams fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeSourceParams deserializedKnowledgeSourceParams = new KnowledgeSourceParams(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("knowledgeSourceName".equals(fieldName)) { + deserializedKnowledgeSourceParams.knowledgeSourceName = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedKnowledgeSourceParams.kind = KnowledgeSourceKind.fromString(reader.getString()); + } else if ("includeReferences".equals(fieldName)) { + deserializedKnowledgeSourceParams.includeReferences = reader.getNullable(JsonReader::getBoolean); + } else if ("includeReferenceSourceData".equals(fieldName)) { + deserializedKnowledgeSourceParams.includeReferenceSourceData + = reader.getNullable(JsonReader::getBoolean); + } else if ("alwaysQuerySource".equals(fieldName)) { + deserializedKnowledgeSourceParams.alwaysQuerySource = reader.getNullable(JsonReader::getBoolean); + } else if ("rerankerThreshold".equals(fieldName)) { + deserializedKnowledgeSourceParams.rerankerThreshold = reader.getNullable(JsonReader::getFloat); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeSourceParams; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceReference.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceReference.java new file mode 100644 index 000000000000..603479d09162 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceReference.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 KnowledgeSourceReference model. + */ +@Fluent +public final class KnowledgeSourceReference implements JsonSerializable { + /* + * The name of the knowledge source. + */ + @Generated + private String name; + + /** + * Creates an instance of KnowledgeSourceReference class. + */ + @Generated + public KnowledgeSourceReference() { + } + + /** + * Get the name property: The name of the knowledge source. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the knowledge source. + * + * @param name the name value to set. + * @return the KnowledgeSourceReference object itself. + */ + @Generated + public KnowledgeSourceReference setName(String name) { + this.name = name; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeSourceReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeSourceReference 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 KnowledgeSourceReference. + */ + @Generated + public static KnowledgeSourceReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeSourceReference deserializedKnowledgeSourceReference = new KnowledgeSourceReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedKnowledgeSourceReference.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeSourceReference; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceStatistics.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceStatistics.java new file mode 100644 index 000000000000..db99a3a8dd6b --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceStatistics.java @@ -0,0 +1,160 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Statistical information about knowledge source synchronization history. + */ +@Fluent +public final class KnowledgeSourceStatistics implements JsonSerializable { + /* + * The total number of synchronizations completed. + */ + @Generated + private int totalSynchronization; + + /* + * The average duration of synchronizations in HH:MM:SS format. + */ + @Generated + private String averageSynchronizationDuration; + + /* + * The average number of items processed per synchronization. + */ + @Generated + private int averageItemsProcessedPerSynchronization; + + /** + * Creates an instance of KnowledgeSourceStatistics class. + */ + @Generated + public KnowledgeSourceStatistics() { + } + + /** + * Get the totalSynchronization property: The total number of synchronizations completed. + * + * @return the totalSynchronization value. + */ + @Generated + public int getTotalSynchronization() { + return this.totalSynchronization; + } + + /** + * Set the totalSynchronization property: The total number of synchronizations completed. + * + * @param totalSynchronization the totalSynchronization value to set. + * @return the KnowledgeSourceStatistics object itself. + */ + @Generated + public KnowledgeSourceStatistics setTotalSynchronization(int totalSynchronization) { + this.totalSynchronization = totalSynchronization; + return this; + } + + /** + * Get the averageSynchronizationDuration property: The average duration of synchronizations in HH:MM:SS format. + * + * @return the averageSynchronizationDuration value. + */ + @Generated + public String getAverageSynchronizationDuration() { + return this.averageSynchronizationDuration; + } + + /** + * Set the averageSynchronizationDuration property: The average duration of synchronizations in HH:MM:SS format. + * + * @param averageSynchronizationDuration the averageSynchronizationDuration value to set. + * @return the KnowledgeSourceStatistics object itself. + */ + @Generated + public KnowledgeSourceStatistics setAverageSynchronizationDuration(String averageSynchronizationDuration) { + this.averageSynchronizationDuration = averageSynchronizationDuration; + return this; + } + + /** + * Get the averageItemsProcessedPerSynchronization property: The average number of items processed per + * synchronization. + * + * @return the averageItemsProcessedPerSynchronization value. + */ + @Generated + public int getAverageItemsProcessedPerSynchronization() { + return this.averageItemsProcessedPerSynchronization; + } + + /** + * Set the averageItemsProcessedPerSynchronization property: The average number of items processed per + * synchronization. + * + * @param averageItemsProcessedPerSynchronization the averageItemsProcessedPerSynchronization value to set. + * @return the KnowledgeSourceStatistics object itself. + */ + @Generated + public KnowledgeSourceStatistics + setAverageItemsProcessedPerSynchronization(int averageItemsProcessedPerSynchronization) { + this.averageItemsProcessedPerSynchronization = averageItemsProcessedPerSynchronization; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("totalSynchronization", this.totalSynchronization); + jsonWriter.writeStringField("averageSynchronizationDuration", this.averageSynchronizationDuration); + jsonWriter.writeIntField("averageItemsProcessedPerSynchronization", + this.averageItemsProcessedPerSynchronization); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeSourceStatistics from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeSourceStatistics 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 KnowledgeSourceStatistics. + */ + @Generated + public static KnowledgeSourceStatistics fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeSourceStatistics deserializedKnowledgeSourceStatistics = new KnowledgeSourceStatistics(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("totalSynchronization".equals(fieldName)) { + deserializedKnowledgeSourceStatistics.totalSynchronization = reader.getInt(); + } else if ("averageSynchronizationDuration".equals(fieldName)) { + deserializedKnowledgeSourceStatistics.averageSynchronizationDuration = reader.getString(); + } else if ("averageItemsProcessedPerSynchronization".equals(fieldName)) { + deserializedKnowledgeSourceStatistics.averageItemsProcessedPerSynchronization = reader.getInt(); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeSourceStatistics; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceStatus.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceStatus.java new file mode 100644 index 000000000000..066737e54f81 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceStatus.java @@ -0,0 +1,226 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents the status and synchronization history of a knowledge source. + */ +@Fluent +public final class KnowledgeSourceStatus implements JsonSerializable { + /* + * The current synchronization status of the knowledge source. + */ + @Generated + private KnowledgeSourceSynchronizationStatus synchronizationStatus; + + /* + * The synchronization interval (e.g., '1d' for daily). Null if no schedule is configured. + */ + @Generated + private String synchronizationInterval; + + /* + * Current synchronization state that spans multiple indexer runs. + */ + @Generated + private SynchronizationState currentSynchronizationState; + + /* + * Details of the last completed synchronization. Null on first sync. + */ + @Generated + private CompletedSynchronizationState lastSynchronizationState; + + /* + * Statistical information about the knowledge source synchronization history. Null on first sync. + */ + @Generated + private KnowledgeSourceStatistics statistics; + + /** + * Creates an instance of KnowledgeSourceStatus class. + */ + @Generated + public KnowledgeSourceStatus() { + } + + /** + * Get the synchronizationStatus property: The current synchronization status of the knowledge source. + * + * @return the synchronizationStatus value. + */ + @Generated + public KnowledgeSourceSynchronizationStatus getSynchronizationStatus() { + return this.synchronizationStatus; + } + + /** + * Set the synchronizationStatus property: The current synchronization status of the knowledge source. + * + * @param synchronizationStatus the synchronizationStatus value to set. + * @return the KnowledgeSourceStatus object itself. + */ + @Generated + public KnowledgeSourceStatus setSynchronizationStatus(KnowledgeSourceSynchronizationStatus synchronizationStatus) { + this.synchronizationStatus = synchronizationStatus; + return this; + } + + /** + * Get the synchronizationInterval property: The synchronization interval (e.g., '1d' for daily). Null if no + * schedule is configured. + * + * @return the synchronizationInterval value. + */ + @Generated + public String getSynchronizationInterval() { + return this.synchronizationInterval; + } + + /** + * Set the synchronizationInterval property: The synchronization interval (e.g., '1d' for daily). Null if no + * schedule is configured. + * + * @param synchronizationInterval the synchronizationInterval value to set. + * @return the KnowledgeSourceStatus object itself. + */ + @Generated + public KnowledgeSourceStatus setSynchronizationInterval(String synchronizationInterval) { + this.synchronizationInterval = synchronizationInterval; + return this; + } + + /** + * Get the currentSynchronizationState property: Current synchronization state that spans multiple indexer runs. + * + * @return the currentSynchronizationState value. + */ + @Generated + public SynchronizationState getCurrentSynchronizationState() { + return this.currentSynchronizationState; + } + + /** + * Set the currentSynchronizationState property: Current synchronization state that spans multiple indexer runs. + * + * @param currentSynchronizationState the currentSynchronizationState value to set. + * @return the KnowledgeSourceStatus object itself. + */ + @Generated + public KnowledgeSourceStatus setCurrentSynchronizationState(SynchronizationState currentSynchronizationState) { + this.currentSynchronizationState = currentSynchronizationState; + return this; + } + + /** + * Get the lastSynchronizationState property: Details of the last completed synchronization. Null on first sync. + * + * @return the lastSynchronizationState value. + */ + @Generated + public CompletedSynchronizationState getLastSynchronizationState() { + return this.lastSynchronizationState; + } + + /** + * Set the lastSynchronizationState property: Details of the last completed synchronization. Null on first sync. + * + * @param lastSynchronizationState the lastSynchronizationState value to set. + * @return the KnowledgeSourceStatus object itself. + */ + @Generated + public KnowledgeSourceStatus setLastSynchronizationState(CompletedSynchronizationState lastSynchronizationState) { + this.lastSynchronizationState = lastSynchronizationState; + return this; + } + + /** + * Get the statistics property: Statistical information about the knowledge source synchronization history. Null on + * first sync. + * + * @return the statistics value. + */ + @Generated + public KnowledgeSourceStatistics getStatistics() { + return this.statistics; + } + + /** + * Set the statistics property: Statistical information about the knowledge source synchronization history. Null on + * first sync. + * + * @param statistics the statistics value to set. + * @return the KnowledgeSourceStatus object itself. + */ + @Generated + public KnowledgeSourceStatus setStatistics(KnowledgeSourceStatistics statistics) { + this.statistics = statistics; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("synchronizationStatus", + this.synchronizationStatus == null ? null : this.synchronizationStatus.toString()); + jsonWriter.writeStringField("synchronizationInterval", this.synchronizationInterval); + jsonWriter.writeJsonField("currentSynchronizationState", this.currentSynchronizationState); + jsonWriter.writeJsonField("lastSynchronizationState", this.lastSynchronizationState); + jsonWriter.writeJsonField("statistics", this.statistics); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeSourceStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeSourceStatus 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 KnowledgeSourceStatus. + */ + @Generated + public static KnowledgeSourceStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeSourceStatus deserializedKnowledgeSourceStatus = new KnowledgeSourceStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("synchronizationStatus".equals(fieldName)) { + deserializedKnowledgeSourceStatus.synchronizationStatus + = KnowledgeSourceSynchronizationStatus.fromString(reader.getString()); + } else if ("synchronizationInterval".equals(fieldName)) { + deserializedKnowledgeSourceStatus.synchronizationInterval = reader.getString(); + } else if ("currentSynchronizationState".equals(fieldName)) { + deserializedKnowledgeSourceStatus.currentSynchronizationState + = SynchronizationState.fromJson(reader); + } else if ("lastSynchronizationState".equals(fieldName)) { + deserializedKnowledgeSourceStatus.lastSynchronizationState + = CompletedSynchronizationState.fromJson(reader); + } else if ("statistics".equals(fieldName)) { + deserializedKnowledgeSourceStatus.statistics = KnowledgeSourceStatistics.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeSourceStatus; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceSynchronizationStatus.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceSynchronizationStatus.java new file mode 100644 index 000000000000..3a94e610823d --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceSynchronizationStatus.java @@ -0,0 +1,65 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The current synchronization status of the knowledge source. + */ +public final class KnowledgeSourceSynchronizationStatus + extends ExpandableStringEnum { + /** + * The knowledge source is being provisioned. + */ + @Generated + public static final KnowledgeSourceSynchronizationStatus CREATING = fromString("creating"); + + /** + * The knowledge source is active and synchronization runs are occurring. + */ + @Generated + public static final KnowledgeSourceSynchronizationStatus ACTIVE = fromString("active"); + + /** + * The knowledge source is being deleted and synchronization is paused. + */ + @Generated + public static final KnowledgeSourceSynchronizationStatus DELETING = fromString("deleting"); + + /** + * Creates a new instance of KnowledgeSourceSynchronizationStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public KnowledgeSourceSynchronizationStatus() { + } + + /** + * Creates or finds a KnowledgeSourceSynchronizationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnowledgeSourceSynchronizationStatus. + */ + @Generated + public static KnowledgeSourceSynchronizationStatus fromString(String name) { + return fromString(name, KnowledgeSourceSynchronizationStatus.class); + } + + /** + * Gets known KnowledgeSourceSynchronizationStatus values. + * + * @return known KnowledgeSourceSynchronizationStatus values. + */ + @Generated + public static Collection values() { + return values(KnowledgeSourceSynchronizationStatus.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceVectorizer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceVectorizer.java new file mode 100644 index 000000000000..779f51d13234 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/KnowledgeSourceVectorizer.java @@ -0,0 +1,108 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Specifies the vectorization method to be used for knowledge source embedding model, with optional name. + */ +@Immutable +public class KnowledgeSourceVectorizer implements JsonSerializable { + /* + * The name of the kind of vectorization method being configured for use with vector search. + */ + @Generated + private VectorSearchVectorizerKind kind = VectorSearchVectorizerKind.fromString("KnowledgeSourceVectorizer"); + + /** + * Creates an instance of KnowledgeSourceVectorizer class. + */ + @Generated + public KnowledgeSourceVectorizer() { + } + + /** + * Get the kind property: The name of the kind of vectorization method being configured for use with vector search. + * + * @return the kind value. + */ + @Generated + public VectorSearchVectorizerKind getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @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 KnowledgeSourceVectorizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeSourceVectorizer 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 KnowledgeSourceVectorizer. + */ + @Generated + public static KnowledgeSourceVectorizer 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 ("azureOpenAI".equals(discriminatorValue)) { + return KnowledgeSourceAzureOpenAIVectorizer.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static KnowledgeSourceVectorizer fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeSourceVectorizer deserializedKnowledgeSourceVectorizer = new KnowledgeSourceVectorizer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedKnowledgeSourceVectorizer.kind + = VectorSearchVectorizerKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeSourceVectorizer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LanguageDetectionSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LanguageDetectionSkill.java new file mode 100644 index 000000000000..9484084580f6 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LanguageDetectionSkill.java @@ -0,0 +1,222 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A skill that detects the language of input text and reports a single language code for every document submitted on + * the request. The language code is paired with a score indicating the confidence of the analysis. + */ +@Fluent +public final class LanguageDetectionSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Text.LanguageDetectionSkill"; + + /* + * A country code to use as a hint to the language detection model if it cannot disambiguate the language. + */ + @Generated + private String defaultCountryHint; + + /* + * The version of the model to use when calling the Text Analytics service. It will default to the latest available + * when not specified. We recommend you do not specify this value unless absolutely necessary. + */ + @Generated + private String modelVersion; + + /** + * Creates an instance of LanguageDetectionSkill class. + */ + @Generated + public LanguageDetectionSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the defaultCountryHint property: A country code to use as a hint to the language detection model if it cannot + * disambiguate the language. + * + * @return the defaultCountryHint value. + */ + @Generated + public String getDefaultCountryHint() { + return this.defaultCountryHint; + } + + /** + * Set the defaultCountryHint property: A country code to use as a hint to the language detection model if it cannot + * disambiguate the language. + * + * @param defaultCountryHint the defaultCountryHint value to set. + * @return the LanguageDetectionSkill object itself. + */ + @Generated + public LanguageDetectionSkill setDefaultCountryHint(String defaultCountryHint) { + this.defaultCountryHint = defaultCountryHint; + return this; + } + + /** + * Get the modelVersion property: The version of the model to use when calling the Text Analytics service. It will + * default to the latest available when not specified. We recommend you do not specify this value unless absolutely + * necessary. + * + * @return the modelVersion value. + */ + @Generated + public String getModelVersion() { + return this.modelVersion; + } + + /** + * Set the modelVersion property: The version of the model to use when calling the Text Analytics service. It will + * default to the latest available when not specified. We recommend you do not specify this value unless absolutely + * necessary. + * + * @param modelVersion the modelVersion value to set. + * @return the LanguageDetectionSkill object itself. + */ + @Generated + public LanguageDetectionSkill setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public LanguageDetectionSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public LanguageDetectionSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public LanguageDetectionSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public LanguageDetectionSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public LanguageDetectionSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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("defaultCountryHint", this.defaultCountryHint); + jsonWriter.writeStringField("modelVersion", this.modelVersion); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LanguageDetectionSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LanguageDetectionSkill 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 LanguageDetectionSkill. + */ + @Generated + public static LanguageDetectionSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LanguageDetectionSkill deserializedLanguageDetectionSkill = new LanguageDetectionSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedLanguageDetectionSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedLanguageDetectionSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedLanguageDetectionSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedLanguageDetectionSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedLanguageDetectionSkill.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedLanguageDetectionSkill.odataType = reader.getString(); + } else if ("defaultCountryHint".equals(fieldName)) { + deserializedLanguageDetectionSkill.defaultCountryHint = reader.getString(); + } else if ("modelVersion".equals(fieldName)) { + deserializedLanguageDetectionSkill.modelVersion = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLanguageDetectionSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LengthTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LengthTokenFilter.java new file mode 100644 index 000000000000..8e7c1c2fdfd2 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LengthTokenFilter.java @@ -0,0 +1,159 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Removes words that are too long or too short. This token filter is implemented using Apache Lucene. + */ +@Fluent +public final class LengthTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.LengthTokenFilter"; + + /* + * The minimum length in characters. Default is 0. Maximum is 300. Must be less than the value of max. + */ + @Generated + private Integer minLength; + + /* + * The maximum length in characters. Default and maximum is 300. + */ + @Generated + private Integer maxLength; + + /** + * Creates an instance of LengthTokenFilter class. + */ + @Generated + public LengthTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the minLength property: The minimum length in characters. Default is 0. Maximum is 300. Must be less than the + * value of max. + * + * @return the minLength value. + */ + @Generated + public Integer getMinLength() { + return this.minLength; + } + + /** + * Set the minLength property: The minimum length in characters. Default is 0. Maximum is 300. Must be less than the + * value of max. + * + * @param minLength the minLength value to set. + * @return the LengthTokenFilter object itself. + */ + @Generated + public LengthTokenFilter setMinLength(Integer minLength) { + this.minLength = minLength; + return this; + } + + /** + * Get the maxLength property: The maximum length in characters. Default and maximum is 300. + * + * @return the maxLength value. + */ + @Generated + public Integer getMaxLength() { + return this.maxLength; + } + + /** + * Set the maxLength property: The maximum length in characters. Default and maximum is 300. + * + * @param maxLength the maxLength value to set. + * @return the LengthTokenFilter object itself. + */ + @Generated + public LengthTokenFilter setMaxLength(Integer maxLength) { + this.maxLength = maxLength; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public LengthTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("min", this.minLength); + jsonWriter.writeNumberField("max", this.maxLength); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LengthTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LengthTokenFilter 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 LengthTokenFilter. + */ + @Generated + public static LengthTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LengthTokenFilter deserializedLengthTokenFilter = new LengthTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedLengthTokenFilter.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedLengthTokenFilter.odataType = reader.getString(); + } else if ("min".equals(fieldName)) { + deserializedLengthTokenFilter.minLength = reader.getNullable(JsonReader::getInt); + } else if ("max".equals(fieldName)) { + deserializedLengthTokenFilter.maxLength = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedLengthTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalAnalyzer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalAnalyzer.java new file mode 100644 index 000000000000..eb3e61aa8479 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalAnalyzer.java @@ -0,0 +1,148 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 analyzers. + */ +@Fluent +public class LexicalAnalyzer implements JsonSerializable { + /* + * A URI fragment specifying the type of analyzer. + */ + @Generated + private String odataType = "LexicalAnalyzer"; + + /* + * The name of the analyzer. It must only contain letters, digits, spaces, dashes or underscores, can only start and + * end with alphanumeric characters, and is limited to 128 characters. + */ + @Generated + private String name; + + /** + * Creates an instance of LexicalAnalyzer class. + */ + @Generated + public LexicalAnalyzer() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of analyzer. + * + * @return the odataType value. + */ + @Generated + public String getOdataType() { + return this.odataType; + } + + /** + * Get the name property: The name of the analyzer. It must only contain letters, digits, spaces, dashes or + * underscores, can only start and end with alphanumeric characters, and is limited to 128 characters. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the analyzer. It must only contain letters, digits, spaces, dashes or + * underscores, can only start and end with alphanumeric characters, and is limited to 128 characters. + * + * @param name the name value to set. + * @return the LexicalAnalyzer object itself. + */ + @Generated + public LexicalAnalyzer setName(String name) { + this.name = name; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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 LexicalAnalyzer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LexicalAnalyzer 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 LexicalAnalyzer. + */ + @Generated + public static LexicalAnalyzer 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.CustomAnalyzer".equals(discriminatorValue)) { + return CustomAnalyzer.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.PatternAnalyzer".equals(discriminatorValue)) { + return PatternAnalyzer.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.StandardAnalyzer".equals(discriminatorValue)) { + return LuceneStandardAnalyzer.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.StopAnalyzer".equals(discriminatorValue)) { + return StopAnalyzer.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static LexicalAnalyzer fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LexicalAnalyzer deserializedLexicalAnalyzer = new LexicalAnalyzer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedLexicalAnalyzer.name = reader.getString(); + } else if ("@odata.type".equals(fieldName)) { + deserializedLexicalAnalyzer.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLexicalAnalyzer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalAnalyzerName.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalAnalyzerName.java new file mode 100644 index 000000000000..018e8462e2e6 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalAnalyzerName.java @@ -0,0 +1,611 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines the names of all text analyzers supported by the search engine. + */ +public final class LexicalAnalyzerName extends ExpandableStringEnum { + /** + * Microsoft analyzer for Arabic. + */ + @Generated + public static final LexicalAnalyzerName AR_MICROSOFT = fromString("ar.microsoft"); + + /** + * Lucene analyzer for Arabic. + */ + @Generated + public static final LexicalAnalyzerName AR_LUCENE = fromString("ar.lucene"); + + /** + * Lucene analyzer for Armenian. + */ + @Generated + public static final LexicalAnalyzerName HY_LUCENE = fromString("hy.lucene"); + + /** + * Microsoft analyzer for Bangla. + */ + @Generated + public static final LexicalAnalyzerName BN_MICROSOFT = fromString("bn.microsoft"); + + /** + * Lucene analyzer for Basque. + */ + @Generated + public static final LexicalAnalyzerName EU_LUCENE = fromString("eu.lucene"); + + /** + * Microsoft analyzer for Bulgarian. + */ + @Generated + public static final LexicalAnalyzerName BG_MICROSOFT = fromString("bg.microsoft"); + + /** + * Lucene analyzer for Bulgarian. + */ + @Generated + public static final LexicalAnalyzerName BG_LUCENE = fromString("bg.lucene"); + + /** + * Microsoft analyzer for Catalan. + */ + @Generated + public static final LexicalAnalyzerName CA_MICROSOFT = fromString("ca.microsoft"); + + /** + * Lucene analyzer for Catalan. + */ + @Generated + public static final LexicalAnalyzerName CA_LUCENE = fromString("ca.lucene"); + + /** + * Microsoft analyzer for Chinese (Simplified). + */ + @Generated + public static final LexicalAnalyzerName ZH_HANS_MICROSOFT = fromString("zh-Hans.microsoft"); + + /** + * Lucene analyzer for Chinese (Simplified). + */ + @Generated + public static final LexicalAnalyzerName ZH_HANS_LUCENE = fromString("zh-Hans.lucene"); + + /** + * Microsoft analyzer for Chinese (Traditional). + */ + @Generated + public static final LexicalAnalyzerName ZH_HANT_MICROSOFT = fromString("zh-Hant.microsoft"); + + /** + * Lucene analyzer for Chinese (Traditional). + */ + @Generated + public static final LexicalAnalyzerName ZH_HANT_LUCENE = fromString("zh-Hant.lucene"); + + /** + * Microsoft analyzer for Croatian. + */ + @Generated + public static final LexicalAnalyzerName HR_MICROSOFT = fromString("hr.microsoft"); + + /** + * Microsoft analyzer for Czech. + */ + @Generated + public static final LexicalAnalyzerName CS_MICROSOFT = fromString("cs.microsoft"); + + /** + * Lucene analyzer for Czech. + */ + @Generated + public static final LexicalAnalyzerName CS_LUCENE = fromString("cs.lucene"); + + /** + * Microsoft analyzer for Danish. + */ + @Generated + public static final LexicalAnalyzerName DA_MICROSOFT = fromString("da.microsoft"); + + /** + * Lucene analyzer for Danish. + */ + @Generated + public static final LexicalAnalyzerName DA_LUCENE = fromString("da.lucene"); + + /** + * Microsoft analyzer for Dutch. + */ + @Generated + public static final LexicalAnalyzerName NL_MICROSOFT = fromString("nl.microsoft"); + + /** + * Lucene analyzer for Dutch. + */ + @Generated + public static final LexicalAnalyzerName NL_LUCENE = fromString("nl.lucene"); + + /** + * Microsoft analyzer for English. + */ + @Generated + public static final LexicalAnalyzerName EN_MICROSOFT = fromString("en.microsoft"); + + /** + * Lucene analyzer for English. + */ + @Generated + public static final LexicalAnalyzerName EN_LUCENE = fromString("en.lucene"); + + /** + * Microsoft analyzer for Estonian. + */ + @Generated + public static final LexicalAnalyzerName ET_MICROSOFT = fromString("et.microsoft"); + + /** + * Microsoft analyzer for Finnish. + */ + @Generated + public static final LexicalAnalyzerName FI_MICROSOFT = fromString("fi.microsoft"); + + /** + * Lucene analyzer for Finnish. + */ + @Generated + public static final LexicalAnalyzerName FI_LUCENE = fromString("fi.lucene"); + + /** + * Microsoft analyzer for French. + */ + @Generated + public static final LexicalAnalyzerName FR_MICROSOFT = fromString("fr.microsoft"); + + /** + * Lucene analyzer for French. + */ + @Generated + public static final LexicalAnalyzerName FR_LUCENE = fromString("fr.lucene"); + + /** + * Lucene analyzer for Galician. + */ + @Generated + public static final LexicalAnalyzerName GL_LUCENE = fromString("gl.lucene"); + + /** + * Microsoft analyzer for German. + */ + @Generated + public static final LexicalAnalyzerName DE_MICROSOFT = fromString("de.microsoft"); + + /** + * Lucene analyzer for German. + */ + @Generated + public static final LexicalAnalyzerName DE_LUCENE = fromString("de.lucene"); + + /** + * Microsoft analyzer for Greek. + */ + @Generated + public static final LexicalAnalyzerName EL_MICROSOFT = fromString("el.microsoft"); + + /** + * Lucene analyzer for Greek. + */ + @Generated + public static final LexicalAnalyzerName EL_LUCENE = fromString("el.lucene"); + + /** + * Microsoft analyzer for Gujarati. + */ + @Generated + public static final LexicalAnalyzerName GU_MICROSOFT = fromString("gu.microsoft"); + + /** + * Microsoft analyzer for Hebrew. + */ + @Generated + public static final LexicalAnalyzerName HE_MICROSOFT = fromString("he.microsoft"); + + /** + * Microsoft analyzer for Hindi. + */ + @Generated + public static final LexicalAnalyzerName HI_MICROSOFT = fromString("hi.microsoft"); + + /** + * Lucene analyzer for Hindi. + */ + @Generated + public static final LexicalAnalyzerName HI_LUCENE = fromString("hi.lucene"); + + /** + * Microsoft analyzer for Hungarian. + */ + @Generated + public static final LexicalAnalyzerName HU_MICROSOFT = fromString("hu.microsoft"); + + /** + * Lucene analyzer for Hungarian. + */ + @Generated + public static final LexicalAnalyzerName HU_LUCENE = fromString("hu.lucene"); + + /** + * Microsoft analyzer for Icelandic. + */ + @Generated + public static final LexicalAnalyzerName IS_MICROSOFT = fromString("is.microsoft"); + + /** + * Microsoft analyzer for Indonesian (Bahasa). + */ + @Generated + public static final LexicalAnalyzerName ID_MICROSOFT = fromString("id.microsoft"); + + /** + * Lucene analyzer for Indonesian. + */ + @Generated + public static final LexicalAnalyzerName ID_LUCENE = fromString("id.lucene"); + + /** + * Lucene analyzer for Irish. + */ + @Generated + public static final LexicalAnalyzerName GA_LUCENE = fromString("ga.lucene"); + + /** + * Microsoft analyzer for Italian. + */ + @Generated + public static final LexicalAnalyzerName IT_MICROSOFT = fromString("it.microsoft"); + + /** + * Lucene analyzer for Italian. + */ + @Generated + public static final LexicalAnalyzerName IT_LUCENE = fromString("it.lucene"); + + /** + * Microsoft analyzer for Japanese. + */ + @Generated + public static final LexicalAnalyzerName JA_MICROSOFT = fromString("ja.microsoft"); + + /** + * Lucene analyzer for Japanese. + */ + @Generated + public static final LexicalAnalyzerName JA_LUCENE = fromString("ja.lucene"); + + /** + * Microsoft analyzer for Kannada. + */ + @Generated + public static final LexicalAnalyzerName KN_MICROSOFT = fromString("kn.microsoft"); + + /** + * Microsoft analyzer for Korean. + */ + @Generated + public static final LexicalAnalyzerName KO_MICROSOFT = fromString("ko.microsoft"); + + /** + * Lucene analyzer for Korean. + */ + @Generated + public static final LexicalAnalyzerName KO_LUCENE = fromString("ko.lucene"); + + /** + * Microsoft analyzer for Latvian. + */ + @Generated + public static final LexicalAnalyzerName LV_MICROSOFT = fromString("lv.microsoft"); + + /** + * Lucene analyzer for Latvian. + */ + @Generated + public static final LexicalAnalyzerName LV_LUCENE = fromString("lv.lucene"); + + /** + * Microsoft analyzer for Lithuanian. + */ + @Generated + public static final LexicalAnalyzerName LT_MICROSOFT = fromString("lt.microsoft"); + + /** + * Microsoft analyzer for Malayalam. + */ + @Generated + public static final LexicalAnalyzerName ML_MICROSOFT = fromString("ml.microsoft"); + + /** + * Microsoft analyzer for Malay (Latin). + */ + @Generated + public static final LexicalAnalyzerName MS_MICROSOFT = fromString("ms.microsoft"); + + /** + * Microsoft analyzer for Marathi. + */ + @Generated + public static final LexicalAnalyzerName MR_MICROSOFT = fromString("mr.microsoft"); + + /** + * Microsoft analyzer for Norwegian (Bokmål). + */ + @Generated + public static final LexicalAnalyzerName NB_MICROSOFT = fromString("nb.microsoft"); + + /** + * Lucene analyzer for Norwegian. + */ + @Generated + public static final LexicalAnalyzerName NO_LUCENE = fromString("no.lucene"); + + /** + * Lucene analyzer for Persian. + */ + @Generated + public static final LexicalAnalyzerName FA_LUCENE = fromString("fa.lucene"); + + /** + * Microsoft analyzer for Polish. + */ + @Generated + public static final LexicalAnalyzerName PL_MICROSOFT = fromString("pl.microsoft"); + + /** + * Lucene analyzer for Polish. + */ + @Generated + public static final LexicalAnalyzerName PL_LUCENE = fromString("pl.lucene"); + + /** + * Microsoft analyzer for Portuguese (Brazil). + */ + @Generated + public static final LexicalAnalyzerName PT_BR_MICROSOFT = fromString("pt-BR.microsoft"); + + /** + * Lucene analyzer for Portuguese (Brazil). + */ + @Generated + public static final LexicalAnalyzerName PT_BR_LUCENE = fromString("pt-BR.lucene"); + + /** + * Microsoft analyzer for Portuguese (Portugal). + */ + @Generated + public static final LexicalAnalyzerName PT_PT_MICROSOFT = fromString("pt-PT.microsoft"); + + /** + * Lucene analyzer for Portuguese (Portugal). + */ + @Generated + public static final LexicalAnalyzerName PT_PT_LUCENE = fromString("pt-PT.lucene"); + + /** + * Microsoft analyzer for Punjabi. + */ + @Generated + public static final LexicalAnalyzerName PA_MICROSOFT = fromString("pa.microsoft"); + + /** + * Microsoft analyzer for Romanian. + */ + @Generated + public static final LexicalAnalyzerName RO_MICROSOFT = fromString("ro.microsoft"); + + /** + * Lucene analyzer for Romanian. + */ + @Generated + public static final LexicalAnalyzerName RO_LUCENE = fromString("ro.lucene"); + + /** + * Microsoft analyzer for Russian. + */ + @Generated + public static final LexicalAnalyzerName RU_MICROSOFT = fromString("ru.microsoft"); + + /** + * Lucene analyzer for Russian. + */ + @Generated + public static final LexicalAnalyzerName RU_LUCENE = fromString("ru.lucene"); + + /** + * Microsoft analyzer for Serbian (Cyrillic). + */ + @Generated + public static final LexicalAnalyzerName SR_CYRILLIC_MICROSOFT = fromString("sr-cyrillic.microsoft"); + + /** + * Microsoft analyzer for Serbian (Latin). + */ + @Generated + public static final LexicalAnalyzerName SR_LATIN_MICROSOFT = fromString("sr-latin.microsoft"); + + /** + * Microsoft analyzer for Slovak. + */ + @Generated + public static final LexicalAnalyzerName SK_MICROSOFT = fromString("sk.microsoft"); + + /** + * Microsoft analyzer for Slovenian. + */ + @Generated + public static final LexicalAnalyzerName SL_MICROSOFT = fromString("sl.microsoft"); + + /** + * Microsoft analyzer for Spanish. + */ + @Generated + public static final LexicalAnalyzerName ES_MICROSOFT = fromString("es.microsoft"); + + /** + * Lucene analyzer for Spanish. + */ + @Generated + public static final LexicalAnalyzerName ES_LUCENE = fromString("es.lucene"); + + /** + * Microsoft analyzer for Swedish. + */ + @Generated + public static final LexicalAnalyzerName SV_MICROSOFT = fromString("sv.microsoft"); + + /** + * Lucene analyzer for Swedish. + */ + @Generated + public static final LexicalAnalyzerName SV_LUCENE = fromString("sv.lucene"); + + /** + * Microsoft analyzer for Tamil. + */ + @Generated + public static final LexicalAnalyzerName TA_MICROSOFT = fromString("ta.microsoft"); + + /** + * Microsoft analyzer for Telugu. + */ + @Generated + public static final LexicalAnalyzerName TE_MICROSOFT = fromString("te.microsoft"); + + /** + * Microsoft analyzer for Thai. + */ + @Generated + public static final LexicalAnalyzerName TH_MICROSOFT = fromString("th.microsoft"); + + /** + * Lucene analyzer for Thai. + */ + @Generated + public static final LexicalAnalyzerName TH_LUCENE = fromString("th.lucene"); + + /** + * Microsoft analyzer for Turkish. + */ + @Generated + public static final LexicalAnalyzerName TR_MICROSOFT = fromString("tr.microsoft"); + + /** + * Lucene analyzer for Turkish. + */ + @Generated + public static final LexicalAnalyzerName TR_LUCENE = fromString("tr.lucene"); + + /** + * Microsoft analyzer for Ukrainian. + */ + @Generated + public static final LexicalAnalyzerName UK_MICROSOFT = fromString("uk.microsoft"); + + /** + * Microsoft analyzer for Urdu. + */ + @Generated + public static final LexicalAnalyzerName UR_MICROSOFT = fromString("ur.microsoft"); + + /** + * Microsoft analyzer for Vietnamese. + */ + @Generated + public static final LexicalAnalyzerName VI_MICROSOFT = fromString("vi.microsoft"); + + /** + * Standard Lucene analyzer. + */ + @Generated + public static final LexicalAnalyzerName STANDARD_LUCENE = fromString("standard.lucene"); + + /** + * Standard ASCII Folding Lucene analyzer. See + * https://learn.microsoft.com/rest/api/searchservice/Custom-analyzers-in-Azure-Search#Analyzers. + */ + @Generated + public static final LexicalAnalyzerName STANDARD_ASCII_FOLDING_LUCENE = fromString("standardasciifolding.lucene"); + + /** + * Treats the entire content of a field as a single token. This is useful for data like zip codes, ids, and some + * product names. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/core/KeywordAnalyzer.html. + */ + @Generated + public static final LexicalAnalyzerName KEYWORD = fromString("keyword"); + + /** + * Flexibly separates text into terms via a regular expression pattern. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/miscellaneous/PatternAnalyzer.html. + */ + @Generated + public static final LexicalAnalyzerName PATTERN = fromString("pattern"); + + /** + * Divides text at non-letters and converts them to lower case. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/core/SimpleAnalyzer.html. + */ + @Generated + public static final LexicalAnalyzerName SIMPLE = fromString("simple"); + + /** + * Divides text at non-letters; Applies the lowercase and stopword token filters. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/core/StopAnalyzer.html. + */ + @Generated + public static final LexicalAnalyzerName STOP = fromString("stop"); + + /** + * An analyzer that uses the whitespace tokenizer. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/core/WhitespaceAnalyzer.html. + */ + @Generated + public static final LexicalAnalyzerName WHITESPACE = fromString("whitespace"); + + /** + * Creates a new instance of LexicalAnalyzerName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public LexicalAnalyzerName() { + } + + /** + * Creates or finds a LexicalAnalyzerName from its string representation. + * + * @param name a name to look for. + * @return the corresponding LexicalAnalyzerName. + */ + @Generated + public static LexicalAnalyzerName fromString(String name) { + return fromString(name, LexicalAnalyzerName.class); + } + + /** + * Gets known LexicalAnalyzerName values. + * + * @return known LexicalAnalyzerName values. + */ + @Generated + public static Collection values() { + return values(LexicalAnalyzerName.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalNormalizer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalNormalizer.java new file mode 100644 index 000000000000..e4e657d67f4c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalNormalizer.java @@ -0,0 +1,145 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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. + */ +@Fluent +public class LexicalNormalizer implements JsonSerializable { + /* + * A URI fragment specifying the type of normalizer. + */ + @Generated + 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'. + */ + @Generated + private String name; + + /** + * Creates an instance of LexicalNormalizer class. + */ + @Generated + public LexicalNormalizer() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of normalizer. + * + * @return the odataType value. + */ + @Generated + 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. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set 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'. + * + * @param name the name value to set. + * @return the LexicalNormalizer object itself. + */ + @Generated + public LexicalNormalizer setName(String name) { + this.name = name; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + 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()); + } + } + }); + } + + @Generated + static LexicalNormalizer fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LexicalNormalizer deserializedLexicalNormalizer = new LexicalNormalizer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedLexicalNormalizer.name = reader.getString(); + } else if ("@odata.type".equals(fieldName)) { + deserializedLexicalNormalizer.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLexicalNormalizer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalNormalizerName.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalNormalizerName.java new file mode 100644 index 000000000000..c1ae5d9e6e3c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalNormalizerName.java @@ -0,0 +1,82 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + public static final LexicalNormalizerName UPPERCASE = fromString("uppercase"); + + /** + * Creates a new instance of LexicalNormalizerName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public LexicalNormalizerName() { + } + + /** + * Creates or finds a LexicalNormalizerName from its string representation. + * + * @param name a name to look for. + * @return the corresponding LexicalNormalizerName. + */ + @Generated + public static LexicalNormalizerName fromString(String name) { + return fromString(name, LexicalNormalizerName.class); + } + + /** + * Gets known LexicalNormalizerName values. + * + * @return known LexicalNormalizerName values. + */ + @Generated + public static Collection values() { + return values(LexicalNormalizerName.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalTokenizer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalTokenizer.java new file mode 100644 index 000000000000..1fab55459dc3 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalTokenizer.java @@ -0,0 +1,164 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 tokenizers. + */ +@Fluent +public class LexicalTokenizer implements JsonSerializable { + /* + * A URI fragment specifying the type of tokenizer. + */ + @Generated + private String odataType = "LexicalTokenizer"; + + /* + * The name of the tokenizer. It must only contain letters, digits, spaces, dashes or underscores, can only start + * and end with alphanumeric characters, and is limited to 128 characters. + */ + @Generated + private String name; + + /** + * Creates an instance of LexicalTokenizer class. + */ + @Generated + public LexicalTokenizer() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of tokenizer. + * + * @return the odataType value. + */ + @Generated + public String getOdataType() { + return this.odataType; + } + + /** + * Get the name property: The name of the tokenizer. It must only contain letters, digits, spaces, dashes or + * underscores, can only start and end with alphanumeric characters, and is limited to 128 characters. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the tokenizer. It must only contain letters, digits, spaces, dashes or + * underscores, can only start and end with alphanumeric characters, and is limited to 128 characters. + * + * @param name the name value to set. + * @return the LexicalTokenizer object itself. + */ + @Generated + public LexicalTokenizer setName(String name) { + this.name = name; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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 LexicalTokenizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LexicalTokenizer 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 LexicalTokenizer. + */ + @Generated + public static LexicalTokenizer 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.ClassicTokenizer".equals(discriminatorValue)) { + return ClassicTokenizer.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.EdgeNGramTokenizer".equals(discriminatorValue)) { + return EdgeNGramTokenizer.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.KeywordTokenizer".equals(discriminatorValue)) { + return KeywordTokenizer.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.KeywordTokenizerV2".equals(discriminatorValue)) { + return KeywordTokenizerV2.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.MicrosoftLanguageTokenizer".equals(discriminatorValue)) { + return MicrosoftLanguageTokenizer.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.MicrosoftLanguageStemmingTokenizer".equals(discriminatorValue)) { + return MicrosoftLanguageStemmingTokenizer.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.NGramTokenizer".equals(discriminatorValue)) { + return NGramTokenizer.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.PathHierarchyTokenizerV2".equals(discriminatorValue)) { + return PathHierarchyTokenizerV2.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.PatternTokenizer".equals(discriminatorValue)) { + return PatternTokenizer.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.StandardTokenizer".equals(discriminatorValue)) { + return LuceneStandardTokenizer.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.StandardTokenizerV2".equals(discriminatorValue)) { + return LuceneStandardTokenizerV2.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.UaxUrlEmailTokenizer".equals(discriminatorValue)) { + return UaxUrlEmailTokenizer.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static LexicalTokenizer fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LexicalTokenizer deserializedLexicalTokenizer = new LexicalTokenizer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedLexicalTokenizer.name = reader.getString(); + } else if ("@odata.type".equals(fieldName)) { + deserializedLexicalTokenizer.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLexicalTokenizer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalTokenizerName.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalTokenizerName.java new file mode 100644 index 000000000000..63a1d8b4b6b4 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LexicalTokenizerName.java @@ -0,0 +1,136 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines the names of all tokenizers supported by the search engine. + */ +public final class LexicalTokenizerName extends ExpandableStringEnum { + /** + * Grammar-based tokenizer that is suitable for processing most European-language documents. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/standard/ClassicTokenizer.html. + */ + @Generated + public static final LexicalTokenizerName CLASSIC = fromString("classic"); + + /** + * Tokenizes the input from an edge into n-grams of the given size(s). See + * https://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/ngram/EdgeNGramTokenizer.html. + */ + @Generated + public static final LexicalTokenizerName EDGE_NGRAM = fromString("edgeNGram"); + + /** + * Emits the entire input as a single token. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/core/KeywordTokenizer.html. + */ + @Generated + public static final LexicalTokenizerName KEYWORD = fromString("keyword_v2"); + + /** + * Divides text at non-letters. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/core/LetterTokenizer.html. + */ + @Generated + public static final LexicalTokenizerName LETTER = fromString("letter"); + + /** + * Divides text at non-letters and converts them to lower case. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/core/LowerCaseTokenizer.html. + */ + @Generated + public static final LexicalTokenizerName LOWERCASE = fromString("lowercase"); + + /** + * Divides text using language-specific rules. + */ + @Generated + public static final LexicalTokenizerName MICROSOFT_LANGUAGE_TOKENIZER = fromString("microsoft_language_tokenizer"); + + /** + * Divides text using language-specific rules and reduces words to their base forms. + */ + @Generated + public static final LexicalTokenizerName MICROSOFT_LANGUAGE_STEMMING_TOKENIZER + = fromString("microsoft_language_stemming_tokenizer"); + + /** + * Tokenizes the input into n-grams of the given size(s). See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/ngram/NGramTokenizer.html. + */ + @Generated + public static final LexicalTokenizerName NGRAM = fromString("nGram"); + + /** + * Tokenizer for path-like hierarchies. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/path/PathHierarchyTokenizer.html. + */ + @Generated + public static final LexicalTokenizerName PATH_HIERARCHY = fromString("path_hierarchy_v2"); + + /** + * Tokenizer that uses regex pattern matching to construct distinct tokens. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/pattern/PatternTokenizer.html. + */ + @Generated + public static final LexicalTokenizerName PATTERN = fromString("pattern"); + + /** + * Standard Lucene analyzer; Composed of the standard tokenizer, lowercase filter and stop filter. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/standard/StandardTokenizer.html. + */ + @Generated + public static final LexicalTokenizerName STANDARD = fromString("standard_v2"); + + /** + * Tokenizes urls and emails as one token. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/standard/UAX29URLEmailTokenizer.html. + */ + @Generated + public static final LexicalTokenizerName UAX_URL_EMAIL = fromString("uax_url_email"); + + /** + * Divides text at whitespace. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/core/WhitespaceTokenizer.html. + */ + @Generated + public static final LexicalTokenizerName WHITESPACE = fromString("whitespace"); + + /** + * Creates a new instance of LexicalTokenizerName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public LexicalTokenizerName() { + } + + /** + * Creates or finds a LexicalTokenizerName from its string representation. + * + * @param name a name to look for. + * @return the corresponding LexicalTokenizerName. + */ + @Generated + public static LexicalTokenizerName fromString(String name) { + return fromString(name, LexicalTokenizerName.class); + } + + /** + * Gets known LexicalTokenizerName values. + * + * @return known LexicalTokenizerName values. + */ + @Generated + public static Collection values() { + return values(LexicalTokenizerName.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LimitTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LimitTokenFilter.java new file mode 100644 index 000000000000..252ae2ad8b69 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LimitTokenFilter.java @@ -0,0 +1,160 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Limits the number of tokens while indexing. This token filter is implemented using Apache Lucene. + */ +@Fluent +public final class LimitTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.LimitTokenFilter"; + + /* + * The maximum number of tokens to produce. Default is 1. + */ + @Generated + private Integer maxTokenCount; + + /* + * A value indicating whether all tokens from the input must be consumed even if maxTokenCount is reached. Default + * is false. + */ + @Generated + private Boolean consumeAllTokens; + + /** + * Creates an instance of LimitTokenFilter class. + */ + @Generated + public LimitTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the maxTokenCount property: The maximum number of tokens to produce. Default is 1. + * + * @return the maxTokenCount value. + */ + @Generated + public Integer getMaxTokenCount() { + return this.maxTokenCount; + } + + /** + * Set the maxTokenCount property: The maximum number of tokens to produce. Default is 1. + * + * @param maxTokenCount the maxTokenCount value to set. + * @return the LimitTokenFilter object itself. + */ + @Generated + public LimitTokenFilter setMaxTokenCount(Integer maxTokenCount) { + this.maxTokenCount = maxTokenCount; + return this; + } + + /** + * Get the consumeAllTokens property: A value indicating whether all tokens from the input must be consumed even if + * maxTokenCount is reached. Default is false. + * + * @return the consumeAllTokens value. + */ + @Generated + public Boolean isConsumeAllTokens() { + return this.consumeAllTokens; + } + + /** + * Set the consumeAllTokens property: A value indicating whether all tokens from the input must be consumed even if + * maxTokenCount is reached. Default is false. + * + * @param consumeAllTokens the consumeAllTokens value to set. + * @return the LimitTokenFilter object itself. + */ + @Generated + public LimitTokenFilter setConsumeAllTokens(Boolean consumeAllTokens) { + this.consumeAllTokens = consumeAllTokens; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public LimitTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("maxTokenCount", this.maxTokenCount); + jsonWriter.writeBooleanField("consumeAllTokens", this.consumeAllTokens); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LimitTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LimitTokenFilter 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 LimitTokenFilter. + */ + @Generated + public static LimitTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LimitTokenFilter deserializedLimitTokenFilter = new LimitTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedLimitTokenFilter.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedLimitTokenFilter.odataType = reader.getString(); + } else if ("maxTokenCount".equals(fieldName)) { + deserializedLimitTokenFilter.maxTokenCount = reader.getNullable(JsonReader::getInt); + } else if ("consumeAllTokens".equals(fieldName)) { + deserializedLimitTokenFilter.consumeAllTokens = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedLimitTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LineEnding.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LineEnding.java new file mode 100644 index 000000000000..ff5a3f20c016 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LineEnding.java @@ -0,0 +1,71 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines the sequence of characters to use between the lines of text recognized by the OCR skill. The default value is + * "space". + */ +public final class LineEnding extends ExpandableStringEnum { + /** + * Lines are separated by a single space character. + */ + @Generated + public static final LineEnding SPACE = fromString("space"); + + /** + * Lines are separated by a carriage return ('\r') character. + */ + @Generated + public static final LineEnding CARRIAGE_RETURN = fromString("carriageReturn"); + + /** + * Lines are separated by a single line feed ('\n') character. + */ + @Generated + public static final LineEnding LINE_FEED = fromString("lineFeed"); + + /** + * Lines are separated by a carriage return and a line feed ('\r\n') character. + */ + @Generated + public static final LineEnding CARRIAGE_RETURN_LINE_FEED = fromString("carriageReturnLineFeed"); + + /** + * Creates a new instance of LineEnding value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public LineEnding() { + } + + /** + * Creates or finds a LineEnding from its string representation. + * + * @param name a name to look for. + * @return the corresponding LineEnding. + */ + @Generated + public static LineEnding fromString(String name) { + return fromString(name, LineEnding.class); + } + + /** + * Gets known LineEnding values. + * + * @return known LineEnding values. + */ + @Generated + public static Collection values() { + return values(LineEnding.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListAliasesResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListAliasesResult.java new file mode 100644 index 000000000000..ff33bc291497 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListAliasesResult.java @@ -0,0 +1,83 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * 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. + */ + @Generated + private List aliases; + + /** + * Creates an instance of ListAliasesResult class. + */ + @Generated + public ListAliasesResult() { + } + + /** + * Get the aliases property: The aliases in the Search service. + * + * @return the aliases value. + */ + @Generated + public List getAliases() { + return this.aliases; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + public static ListAliasesResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ListAliasesResult deserializedListAliasesResult = new ListAliasesResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List aliases = reader.readArray(reader1 -> SearchAlias.fromJson(reader1)); + deserializedListAliasesResult.aliases = aliases; + } else { + reader.skipChildren(); + } + } + + return deserializedListAliasesResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListDataSourcesResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListDataSourcesResult.java new file mode 100644 index 000000000000..142244d5deb8 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListDataSourcesResult.java @@ -0,0 +1,84 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Response from a List Datasources request. If successful, it includes the full definitions of all datasources. + */ +@Immutable +public final class ListDataSourcesResult implements JsonSerializable { + /* + * The datasources in the Search service. + */ + @Generated + private List dataSources; + + /** + * Creates an instance of ListDataSourcesResult class. + */ + @Generated + public ListDataSourcesResult() { + } + + /** + * Get the dataSources property: The datasources in the Search service. + * + * @return the dataSources value. + */ + @Generated + public List getDataSources() { + return this.dataSources; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListDataSourcesResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListDataSourcesResult 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 ListDataSourcesResult. + */ + @Generated + public static ListDataSourcesResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ListDataSourcesResult deserializedListDataSourcesResult = new ListDataSourcesResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List dataSources + = reader.readArray(reader1 -> SearchIndexerDataSource.fromJson(reader1)); + deserializedListDataSourcesResult.dataSources = dataSources; + } else { + reader.skipChildren(); + } + } + + return deserializedListDataSourcesResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListIndexStatsSummary.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListIndexStatsSummary.java new file mode 100644 index 000000000000..79a5b640899b --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListIndexStatsSummary.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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Response from a request to retrieve stats summary of all indexes. If successful, it includes the stats of each index + * in the service. + */ +@Immutable +public final class ListIndexStatsSummary implements JsonSerializable { + /* + * The Statistics summary of all indexes in the Search service. + */ + @Generated + private List indexesStatistics; + + /** + * Creates an instance of ListIndexStatsSummary class. + */ + @Generated + public ListIndexStatsSummary() { + } + + /** + * Get the indexesStatistics property: The Statistics summary of all indexes in the Search service. + * + * @return the indexesStatistics value. + */ + @Generated + public List getIndexesStatistics() { + return this.indexesStatistics; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListIndexStatsSummary from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListIndexStatsSummary 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 ListIndexStatsSummary. + */ + @Generated + public static ListIndexStatsSummary fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ListIndexStatsSummary deserializedListIndexStatsSummary = new ListIndexStatsSummary(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List indexesStatistics + = reader.readArray(reader1 -> IndexStatisticsSummary.fromJson(reader1)); + deserializedListIndexStatsSummary.indexesStatistics = indexesStatistics; + } else { + reader.skipChildren(); + } + } + + return deserializedListIndexStatsSummary; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListIndexersResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListIndexersResult.java new file mode 100644 index 000000000000..58e0581327f6 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListIndexersResult.java @@ -0,0 +1,83 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Response from a List Indexers request. If successful, it includes the full definitions of all indexers. + */ +@Immutable +public final class ListIndexersResult implements JsonSerializable { + /* + * The indexers in the Search service. + */ + @Generated + private List indexers; + + /** + * Creates an instance of ListIndexersResult class. + */ + @Generated + public ListIndexersResult() { + } + + /** + * Get the indexers property: The indexers in the Search service. + * + * @return the indexers value. + */ + @Generated + public List getIndexers() { + return this.indexers; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListIndexersResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListIndexersResult 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 ListIndexersResult. + */ + @Generated + public static ListIndexersResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ListIndexersResult deserializedListIndexersResult = new ListIndexersResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List indexers = reader.readArray(reader1 -> SearchIndexer.fromJson(reader1)); + deserializedListIndexersResult.indexers = indexers; + } else { + reader.skipChildren(); + } + } + + return deserializedListIndexersResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListIndexesResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListIndexesResult.java new file mode 100644 index 000000000000..635d5242c0d5 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListIndexesResult.java @@ -0,0 +1,83 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Response from a List Indexes request. If successful, it includes the full definitions of all indexes. + */ +@Immutable +public final class ListIndexesResult implements JsonSerializable { + /* + * The indexes in the Search service. + */ + @Generated + private List indexes; + + /** + * Creates an instance of ListIndexesResult class. + */ + @Generated + public ListIndexesResult() { + } + + /** + * Get the indexes property: The indexes in the Search service. + * + * @return the indexes value. + */ + @Generated + public List getIndexes() { + return this.indexes; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListIndexesResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListIndexesResult 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 ListIndexesResult. + */ + @Generated + public static ListIndexesResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ListIndexesResult deserializedListIndexesResult = new ListIndexesResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List indexes = reader.readArray(reader1 -> SearchIndex.fromJson(reader1)); + deserializedListIndexesResult.indexes = indexes; + } else { + reader.skipChildren(); + } + } + + return deserializedListIndexesResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListKnowledgeBasesResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListKnowledgeBasesResult.java new file mode 100644 index 000000000000..1b53f349def1 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListKnowledgeBasesResult.java @@ -0,0 +1,96 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 ListKnowledgeBasesResult model. + */ +@Fluent +public final class ListKnowledgeBasesResult implements JsonSerializable { + /* + * The value property. + */ + @Generated + private List knowledgeBases; + + /** + * Creates an instance of ListKnowledgeBasesResult class. + */ + @Generated + public ListKnowledgeBasesResult() { + } + + /** + * Get the knowledgeBases property: The value property. + * + * @return the knowledgeBases value. + */ + @Generated + public List getKnowledgeBases() { + return this.knowledgeBases; + } + + /** + * Set the knowledgeBases property: The value property. + * + * @param knowledgeBases the knowledgeBases value to set. + * @return the ListKnowledgeBasesResult object itself. + */ + @Generated + public ListKnowledgeBasesResult setKnowledgeBases(List knowledgeBases) { + this.knowledgeBases = knowledgeBases; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.knowledgeBases, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListKnowledgeBasesResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListKnowledgeBasesResult 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 ListKnowledgeBasesResult. + */ + @Generated + public static ListKnowledgeBasesResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ListKnowledgeBasesResult deserializedListKnowledgeBasesResult = new ListKnowledgeBasesResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List knowledgeBases = reader.readArray(reader1 -> KnowledgeBase.fromJson(reader1)); + deserializedListKnowledgeBasesResult.knowledgeBases = knowledgeBases; + } else { + reader.skipChildren(); + } + } + + return deserializedListKnowledgeBasesResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListKnowledgeSourcesResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListKnowledgeSourcesResult.java new file mode 100644 index 000000000000..6f488d523b41 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListKnowledgeSourcesResult.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 ListKnowledgeSourcesResult model. + */ +@Fluent +public final class ListKnowledgeSourcesResult implements JsonSerializable { + /* + * The value property. + */ + @Generated + private List knowledgeSources; + + /** + * Creates an instance of ListKnowledgeSourcesResult class. + */ + @Generated + public ListKnowledgeSourcesResult() { + } + + /** + * Get the knowledgeSources property: The value property. + * + * @return the knowledgeSources value. + */ + @Generated + public List getKnowledgeSources() { + return this.knowledgeSources; + } + + /** + * Set the knowledgeSources property: The value property. + * + * @param knowledgeSources the knowledgeSources value to set. + * @return the ListKnowledgeSourcesResult object itself. + */ + @Generated + public ListKnowledgeSourcesResult setKnowledgeSources(List knowledgeSources) { + this.knowledgeSources = knowledgeSources; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.knowledgeSources, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListKnowledgeSourcesResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListKnowledgeSourcesResult 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 ListKnowledgeSourcesResult. + */ + @Generated + public static ListKnowledgeSourcesResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ListKnowledgeSourcesResult deserializedListKnowledgeSourcesResult = new ListKnowledgeSourcesResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List knowledgeSources + = reader.readArray(reader1 -> KnowledgeSource.fromJson(reader1)); + deserializedListKnowledgeSourcesResult.knowledgeSources = knowledgeSources; + } else { + reader.skipChildren(); + } + } + + return deserializedListKnowledgeSourcesResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListSkillsetsResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListSkillsetsResult.java new file mode 100644 index 000000000000..341e9162cfd1 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListSkillsetsResult.java @@ -0,0 +1,84 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Response from a list skillset request. If successful, it includes the full definitions of all skillsets. + */ +@Immutable +public final class ListSkillsetsResult implements JsonSerializable { + /* + * The skillsets defined in the Search service. + */ + @Generated + private List skillsets; + + /** + * Creates an instance of ListSkillsetsResult class. + */ + @Generated + public ListSkillsetsResult() { + } + + /** + * Get the skillsets property: The skillsets defined in the Search service. + * + * @return the skillsets value. + */ + @Generated + public List getSkillsets() { + return this.skillsets; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListSkillsetsResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListSkillsetsResult 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 ListSkillsetsResult. + */ + @Generated + public static ListSkillsetsResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ListSkillsetsResult deserializedListSkillsetsResult = new ListSkillsetsResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List skillsets + = reader.readArray(reader1 -> SearchIndexerSkillset.fromJson(reader1)); + deserializedListSkillsetsResult.skillsets = skillsets; + } else { + reader.skipChildren(); + } + } + + return deserializedListSkillsetsResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListSynonymMapsResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListSynonymMapsResult.java new file mode 100644 index 000000000000..b4a2e6b18549 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ListSynonymMapsResult.java @@ -0,0 +1,83 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Response from a List SynonymMaps request. If successful, it includes the full definitions of all synonym maps. + */ +@Immutable +public final class ListSynonymMapsResult implements JsonSerializable { + /* + * The synonym maps in the Search service. + */ + @Generated + private List synonymMaps; + + /** + * Creates an instance of ListSynonymMapsResult class. + */ + @Generated + public ListSynonymMapsResult() { + } + + /** + * Get the synonymMaps property: The synonym maps in the Search service. + * + * @return the synonymMaps value. + */ + @Generated + public List getSynonymMaps() { + return this.synonymMaps; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListSynonymMapsResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListSynonymMapsResult 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 ListSynonymMapsResult. + */ + @Generated + public static ListSynonymMapsResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ListSynonymMapsResult deserializedListSynonymMapsResult = new ListSynonymMapsResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List synonymMaps = reader.readArray(reader1 -> SynonymMap.fromJson(reader1)); + deserializedListSynonymMapsResult.synonymMaps = synonymMaps; + } else { + reader.skipChildren(); + } + } + + return deserializedListSynonymMapsResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LuceneStandardAnalyzer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LuceneStandardAnalyzer.java new file mode 100644 index 000000000000..ffcad3501024 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LuceneStandardAnalyzer.java @@ -0,0 +1,162 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Standard Apache Lucene analyzer; Composed of the standard tokenizer, lowercase filter and stop filter. + */ +@Fluent +public final class LuceneStandardAnalyzer extends LexicalAnalyzer { + /* + * A URI fragment specifying the type of analyzer. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.StandardAnalyzer"; + + /* + * The maximum token length. Default is 255. Tokens longer than the maximum length are split. The maximum token + * length that can be used is 300 characters. + */ + @Generated + private Integer maxTokenLength; + + /* + * A list of stopwords. + */ + @Generated + private List stopwords; + + /** + * Creates an instance of LuceneStandardAnalyzer class. + */ + @Generated + public LuceneStandardAnalyzer() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of analyzer. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the maxTokenLength property: The maximum token length. Default is 255. Tokens longer than the maximum length + * are split. The maximum token length that can be used is 300 characters. + * + * @return the maxTokenLength value. + */ + @Generated + public Integer getMaxTokenLength() { + return this.maxTokenLength; + } + + /** + * Set the maxTokenLength property: The maximum token length. Default is 255. Tokens longer than the maximum length + * are split. The maximum token length that can be used is 300 characters. + * + * @param maxTokenLength the maxTokenLength value to set. + * @return the LuceneStandardAnalyzer object itself. + */ + @Generated + public LuceneStandardAnalyzer setMaxTokenLength(Integer maxTokenLength) { + this.maxTokenLength = maxTokenLength; + return this; + } + + /** + * Get the stopwords property: A list of stopwords. + * + * @return the stopwords value. + */ + @Generated + public List getStopwords() { + return this.stopwords; + } + + /** + * Set the stopwords property: A list of stopwords. + * + * @param stopwords the stopwords value to set. + * @return the LuceneStandardAnalyzer object itself. + */ + @Generated + public LuceneStandardAnalyzer setStopwords(List stopwords) { + this.stopwords = stopwords; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public LuceneStandardAnalyzer setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("maxTokenLength", this.maxTokenLength); + jsonWriter.writeArrayField("stopwords", this.stopwords, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LuceneStandardAnalyzer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LuceneStandardAnalyzer 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 LuceneStandardAnalyzer. + */ + @Generated + public static LuceneStandardAnalyzer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LuceneStandardAnalyzer deserializedLuceneStandardAnalyzer = new LuceneStandardAnalyzer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedLuceneStandardAnalyzer.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedLuceneStandardAnalyzer.odataType = reader.getString(); + } else if ("maxTokenLength".equals(fieldName)) { + deserializedLuceneStandardAnalyzer.maxTokenLength = reader.getNullable(JsonReader::getInt); + } else if ("stopwords".equals(fieldName)) { + List stopwords = reader.readArray(reader1 -> reader1.getString()); + deserializedLuceneStandardAnalyzer.stopwords = stopwords; + } else { + reader.skipChildren(); + } + } + + return deserializedLuceneStandardAnalyzer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LuceneStandardTokenizer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LuceneStandardTokenizer.java new file mode 100644 index 000000000000..38474b7d75fd --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LuceneStandardTokenizer.java @@ -0,0 +1,128 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Breaks text following the Unicode Text Segmentation rules. This tokenizer is implemented using Apache Lucene. + */ +@Fluent +public final class LuceneStandardTokenizer extends LexicalTokenizer { + /* + * A URI fragment specifying the type of tokenizer. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.StandardTokenizer"; + + /* + * The maximum token length. Default is 255. Tokens longer than the maximum length are split. + */ + @Generated + private Integer maxTokenLength; + + /** + * Creates an instance of LuceneStandardTokenizer class. + */ + @Generated + public LuceneStandardTokenizer() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of tokenizer. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the maxTokenLength property: The maximum token length. Default is 255. Tokens longer than the maximum length + * are split. + * + * @return the maxTokenLength value. + */ + @Generated + public Integer getMaxTokenLength() { + return this.maxTokenLength; + } + + /** + * Set the maxTokenLength property: The maximum token length. Default is 255. Tokens longer than the maximum length + * are split. + * + * @param maxTokenLength the maxTokenLength value to set. + * @return the LuceneStandardTokenizer object itself. + */ + @Generated + public LuceneStandardTokenizer setMaxTokenLength(Integer maxTokenLength) { + this.maxTokenLength = maxTokenLength; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public LuceneStandardTokenizer setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("maxTokenLength", this.maxTokenLength); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LuceneStandardTokenizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LuceneStandardTokenizer 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 LuceneStandardTokenizer. + */ + @Generated + public static LuceneStandardTokenizer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LuceneStandardTokenizer deserializedLuceneStandardTokenizer = new LuceneStandardTokenizer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedLuceneStandardTokenizer.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedLuceneStandardTokenizer.odataType = reader.getString(); + } else if ("maxTokenLength".equals(fieldName)) { + deserializedLuceneStandardTokenizer.maxTokenLength = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedLuceneStandardTokenizer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LuceneStandardTokenizerV2.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LuceneStandardTokenizerV2.java new file mode 100644 index 000000000000..7b7ea193a3e1 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/LuceneStandardTokenizerV2.java @@ -0,0 +1,129 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Breaks text following the Unicode Text Segmentation rules. This tokenizer is implemented using Apache Lucene. + */ +@Fluent +public final class LuceneStandardTokenizerV2 extends LexicalTokenizer { + /* + * A URI fragment specifying the type of tokenizer. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.StandardTokenizerV2"; + + /* + * The maximum token length. Default is 255. Tokens longer than the maximum length are split. The maximum token + * length that can be used is 300 characters. + */ + @Generated + private Integer maxTokenLength; + + /** + * Creates an instance of LuceneStandardTokenizerV2 class. + */ + @Generated + public LuceneStandardTokenizerV2() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of tokenizer. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the maxTokenLength property: The maximum token length. Default is 255. Tokens longer than the maximum length + * are split. The maximum token length that can be used is 300 characters. + * + * @return the maxTokenLength value. + */ + @Generated + public Integer getMaxTokenLength() { + return this.maxTokenLength; + } + + /** + * Set the maxTokenLength property: The maximum token length. Default is 255. Tokens longer than the maximum length + * are split. The maximum token length that can be used is 300 characters. + * + * @param maxTokenLength the maxTokenLength value to set. + * @return the LuceneStandardTokenizerV2 object itself. + */ + @Generated + public LuceneStandardTokenizerV2 setMaxTokenLength(Integer maxTokenLength) { + this.maxTokenLength = maxTokenLength; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public LuceneStandardTokenizerV2 setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("maxTokenLength", this.maxTokenLength); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LuceneStandardTokenizerV2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LuceneStandardTokenizerV2 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 LuceneStandardTokenizerV2. + */ + @Generated + public static LuceneStandardTokenizerV2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LuceneStandardTokenizerV2 deserializedLuceneStandardTokenizerV2 = new LuceneStandardTokenizerV2(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedLuceneStandardTokenizerV2.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedLuceneStandardTokenizerV2.odataType = reader.getString(); + } else if ("maxTokenLength".equals(fieldName)) { + deserializedLuceneStandardTokenizerV2.maxTokenLength = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedLuceneStandardTokenizerV2; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MagnitudeScoringFunction.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MagnitudeScoringFunction.java new file mode 100644 index 000000000000..ec28cdf5a8ab --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MagnitudeScoringFunction.java @@ -0,0 +1,155 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines a function that boosts scores based on the magnitude of a numeric field. + */ +@Fluent +public final class MagnitudeScoringFunction extends ScoringFunction { + /* + * Indicates the type of function to use. Valid values include magnitude, freshness, distance, and tag. The function + * type must be lower case. + */ + @Generated + private String type = "magnitude"; + + /* + * Parameter values for the magnitude scoring function. + */ + @Generated + private MagnitudeScoringParameters parameters; + + /** + * Creates an instance of MagnitudeScoringFunction class. + */ + @Generated + public MagnitudeScoringFunction() { + } + + /** + * Get the type property: Indicates the type of function to use. Valid values include magnitude, freshness, + * distance, and tag. The function type must be lower case. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the parameters property: Parameter values for the magnitude scoring function. + * + * @return the parameters value. + */ + @Generated + public MagnitudeScoringParameters getParameters() { + return this.parameters; + } + + /** + * Set the parameters property: Parameter values for the magnitude scoring function. + * + * @param parameters the parameters value to set. + * @return the MagnitudeScoringFunction object itself. + */ + @Generated + public MagnitudeScoringFunction setParameters(MagnitudeScoringParameters parameters) { + this.parameters = parameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public MagnitudeScoringFunction setFieldName(String fieldName) { + super.setFieldName(fieldName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public MagnitudeScoringFunction setBoost(double boost) { + super.setBoost(boost); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public MagnitudeScoringFunction setInterpolation(ScoringFunctionInterpolation interpolation) { + super.setInterpolation(interpolation); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("fieldName", getFieldName()); + jsonWriter.writeDoubleField("boost", getBoost()); + jsonWriter.writeStringField("interpolation", getInterpolation() == null ? null : getInterpolation().toString()); + jsonWriter.writeJsonField("magnitude", this.parameters); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MagnitudeScoringFunction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MagnitudeScoringFunction 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 MagnitudeScoringFunction. + */ + @Generated + public static MagnitudeScoringFunction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MagnitudeScoringFunction deserializedMagnitudeScoringFunction = new MagnitudeScoringFunction(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String jsonFieldName = reader.getFieldName(); + reader.nextToken(); + + if ("fieldName".equals(jsonFieldName)) { + deserializedMagnitudeScoringFunction.setFieldName(reader.getString()); + } else if ("boost".equals(jsonFieldName)) { + deserializedMagnitudeScoringFunction.setBoost(reader.getDouble()); + } else if ("interpolation".equals(jsonFieldName)) { + deserializedMagnitudeScoringFunction + .setInterpolation(ScoringFunctionInterpolation.fromString(reader.getString())); + } else if ("magnitude".equals(jsonFieldName)) { + deserializedMagnitudeScoringFunction.parameters = MagnitudeScoringParameters.fromJson(reader); + } else if ("type".equals(jsonFieldName)) { + deserializedMagnitudeScoringFunction.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMagnitudeScoringFunction; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MagnitudeScoringParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MagnitudeScoringParameters.java new file mode 100644 index 000000000000..e21d57d90879 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MagnitudeScoringParameters.java @@ -0,0 +1,160 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Provides parameter values to a magnitude scoring function. + */ +@Fluent +public final class MagnitudeScoringParameters implements JsonSerializable { + /* + * The field value at which boosting starts. + */ + @Generated + private double boostingRangeStart; + + /* + * The field value at which boosting ends. + */ + @Generated + private double boostingRangeEnd; + + /* + * A value indicating whether to apply a constant boost for field values beyond the range end value; default is + * false. + */ + @Generated + private Boolean shouldBoostBeyondRangeByConstant; + + /** + * Creates an instance of MagnitudeScoringParameters class. + */ + @Generated + public MagnitudeScoringParameters() { + } + + /** + * Get the boostingRangeStart property: The field value at which boosting starts. + * + * @return the boostingRangeStart value. + */ + @Generated + public double getBoostingRangeStart() { + return this.boostingRangeStart; + } + + /** + * Set the boostingRangeStart property: The field value at which boosting starts. + * + * @param boostingRangeStart the boostingRangeStart value to set. + * @return the MagnitudeScoringParameters object itself. + */ + @Generated + public MagnitudeScoringParameters setBoostingRangeStart(double boostingRangeStart) { + this.boostingRangeStart = boostingRangeStart; + return this; + } + + /** + * Get the boostingRangeEnd property: The field value at which boosting ends. + * + * @return the boostingRangeEnd value. + */ + @Generated + public double getBoostingRangeEnd() { + return this.boostingRangeEnd; + } + + /** + * Set the boostingRangeEnd property: The field value at which boosting ends. + * + * @param boostingRangeEnd the boostingRangeEnd value to set. + * @return the MagnitudeScoringParameters object itself. + */ + @Generated + public MagnitudeScoringParameters setBoostingRangeEnd(double boostingRangeEnd) { + this.boostingRangeEnd = boostingRangeEnd; + return this; + } + + /** + * Get the shouldBoostBeyondRangeByConstant property: A value indicating whether to apply a constant boost for field + * values beyond the range end value; default is false. + * + * @return the shouldBoostBeyondRangeByConstant value. + */ + @Generated + public Boolean isShouldBoostBeyondRangeByConstant() { + return this.shouldBoostBeyondRangeByConstant; + } + + /** + * Set the shouldBoostBeyondRangeByConstant property: A value indicating whether to apply a constant boost for field + * values beyond the range end value; default is false. + * + * @param shouldBoostBeyondRangeByConstant the shouldBoostBeyondRangeByConstant value to set. + * @return the MagnitudeScoringParameters object itself. + */ + @Generated + public MagnitudeScoringParameters setShouldBoostBeyondRangeByConstant(Boolean shouldBoostBeyondRangeByConstant) { + this.shouldBoostBeyondRangeByConstant = shouldBoostBeyondRangeByConstant; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeDoubleField("boostingRangeStart", this.boostingRangeStart); + jsonWriter.writeDoubleField("boostingRangeEnd", this.boostingRangeEnd); + jsonWriter.writeBooleanField("constantBoostBeyondRange", this.shouldBoostBeyondRangeByConstant); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MagnitudeScoringParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MagnitudeScoringParameters 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 MagnitudeScoringParameters. + */ + @Generated + public static MagnitudeScoringParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MagnitudeScoringParameters deserializedMagnitudeScoringParameters = new MagnitudeScoringParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("boostingRangeStart".equals(fieldName)) { + deserializedMagnitudeScoringParameters.boostingRangeStart = reader.getDouble(); + } else if ("boostingRangeEnd".equals(fieldName)) { + deserializedMagnitudeScoringParameters.boostingRangeEnd = reader.getDouble(); + } else if ("constantBoostBeyondRange".equals(fieldName)) { + deserializedMagnitudeScoringParameters.shouldBoostBeyondRangeByConstant + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedMagnitudeScoringParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MappingCharFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MappingCharFilter.java new file mode 100644 index 000000000000..c2ba79cf0175 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MappingCharFilter.java @@ -0,0 +1,133 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A character filter that applies mappings defined with the mappings option. Matching is greedy (longest pattern + * matching at a given point wins). Replacement is allowed to be the empty string. This character filter is implemented + * using Apache Lucene. + */ +@Fluent +public final class MappingCharFilter extends CharFilter { + /* + * A URI fragment specifying the type of char filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.MappingCharFilter"; + + /* + * A list of mappings of the following format: "a=>b" (all occurrences of the character "a" will be replaced with + * character "b"). + */ + @Generated + private List mappings; + + /** + * Creates an instance of MappingCharFilter class. + */ + @Generated + public MappingCharFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of char filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the mappings property: A list of mappings of the following format: "a=>b" (all occurrences of the + * character "a" will be replaced with character "b"). + * + * @return the mappings value. + */ + @Generated + public List getMappings() { + return this.mappings; + } + + /** + * Set the mappings property: A list of mappings of the following format: "a=>b" (all occurrences of the + * character "a" will be replaced with character "b"). + * + * @param mappings the mappings value to set. + * @return the MappingCharFilter object itself. + */ + @Generated + public MappingCharFilter setMappings(List mappings) { + this.mappings = mappings; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public MappingCharFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeArrayField("mappings", this.mappings, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MappingCharFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MappingCharFilter 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 MappingCharFilter. + */ + @Generated + public static MappingCharFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MappingCharFilter deserializedMappingCharFilter = new MappingCharFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedMappingCharFilter.setName(reader.getString()); + } else if ("mappings".equals(fieldName)) { + List mappings = reader.readArray(reader1 -> reader1.getString()); + deserializedMappingCharFilter.mappings = mappings; + } else if ("@odata.type".equals(fieldName)) { + deserializedMappingCharFilter.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMappingCharFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MarkdownHeaderDepth.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MarkdownHeaderDepth.java new file mode 100644 index 000000000000..a046a2652871 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MarkdownHeaderDepth.java @@ -0,0 +1,83 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the max header depth that will be considered while grouping markdown content. Default is `h6`. + */ +public final class MarkdownHeaderDepth extends ExpandableStringEnum { + /** + * Indicates that headers up to a level of h1 will be considered while grouping markdown content. + */ + @Generated + public static final MarkdownHeaderDepth H1 = fromString("h1"); + + /** + * Indicates that headers up to a level of h2 will be considered while grouping markdown content. + */ + @Generated + public static final MarkdownHeaderDepth H2 = fromString("h2"); + + /** + * Indicates that headers up to a level of h3 will be considered while grouping markdown content. + */ + @Generated + public static final MarkdownHeaderDepth H3 = fromString("h3"); + + /** + * Indicates that headers up to a level of h4 will be considered while grouping markdown content. + */ + @Generated + public static final MarkdownHeaderDepth H4 = fromString("h4"); + + /** + * Indicates that headers up to a level of h5 will be considered while grouping markdown content. + */ + @Generated + public static final MarkdownHeaderDepth H5 = fromString("h5"); + + /** + * Indicates that headers up to a level of h6 will be considered while grouping markdown content. This is the + * default. + */ + @Generated + public static final MarkdownHeaderDepth H6 = fromString("h6"); + + /** + * Creates a new instance of MarkdownHeaderDepth value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public MarkdownHeaderDepth() { + } + + /** + * Creates or finds a MarkdownHeaderDepth from its string representation. + * + * @param name a name to look for. + * @return the corresponding MarkdownHeaderDepth. + */ + @Generated + public static MarkdownHeaderDepth fromString(String name) { + return fromString(name, MarkdownHeaderDepth.class); + } + + /** + * Gets known MarkdownHeaderDepth values. + * + * @return known MarkdownHeaderDepth values. + */ + @Generated + public static Collection values() { + return values(MarkdownHeaderDepth.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MarkdownParsingSubmode.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MarkdownParsingSubmode.java new file mode 100644 index 000000000000..de3fa2f61f29 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MarkdownParsingSubmode.java @@ -0,0 +1,61 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the submode that will determine whether a markdown file will be parsed into exactly one search document or + * multiple search documents. Default is `oneToMany`. + */ +public final class MarkdownParsingSubmode extends ExpandableStringEnum { + /** + * Indicates that each section of the markdown file (up to a specified depth) will be parsed into individual search + * documents. This can result in a single markdown file producing multiple search documents. This is the default + * sub-mode. + */ + @Generated + public static final MarkdownParsingSubmode ONE_TO_MANY = fromString("oneToMany"); + + /** + * Indicates that each markdown file will be parsed into a single search document. + */ + @Generated + public static final MarkdownParsingSubmode ONE_TO_ONE = fromString("oneToOne"); + + /** + * Creates a new instance of MarkdownParsingSubmode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public MarkdownParsingSubmode() { + } + + /** + * Creates or finds a MarkdownParsingSubmode from its string representation. + * + * @param name a name to look for. + * @return the corresponding MarkdownParsingSubmode. + */ + @Generated + public static MarkdownParsingSubmode fromString(String name) { + return fromString(name, MarkdownParsingSubmode.class); + } + + /** + * Gets known MarkdownParsingSubmode values. + * + * @return known MarkdownParsingSubmode values. + */ + @Generated + public static Collection values() { + return values(MarkdownParsingSubmode.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MergeSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MergeSkill.java new file mode 100644 index 000000000000..c8c538fd28df --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MergeSkill.java @@ -0,0 +1,219 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A skill for merging two or more strings into a single unified string, with an optional user-defined delimiter + * separating each component part. + */ +@Fluent +public final class MergeSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Text.MergeSkill"; + + /* + * The tag indicates the start of the merged text. By default, the tag is an empty space. + */ + @Generated + private String insertPreTag; + + /* + * The tag indicates the end of the merged text. By default, the tag is an empty space. + */ + @Generated + private String insertPostTag; + + /** + * Creates an instance of MergeSkill class. + */ + @Generated + public MergeSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the insertPreTag property: The tag indicates the start of the merged text. By default, the tag is an empty + * space. + * + * @return the insertPreTag value. + */ + @Generated + public String getInsertPreTag() { + return this.insertPreTag; + } + + /** + * Set the insertPreTag property: The tag indicates the start of the merged text. By default, the tag is an empty + * space. + * + * @param insertPreTag the insertPreTag value to set. + * @return the MergeSkill object itself. + */ + @Generated + public MergeSkill setInsertPreTag(String insertPreTag) { + this.insertPreTag = insertPreTag; + return this; + } + + /** + * Get the insertPostTag property: The tag indicates the end of the merged text. By default, the tag is an empty + * space. + * + * @return the insertPostTag value. + */ + @Generated + public String getInsertPostTag() { + return this.insertPostTag; + } + + /** + * Set the insertPostTag property: The tag indicates the end of the merged text. By default, the tag is an empty + * space. + * + * @param insertPostTag the insertPostTag value to set. + * @return the MergeSkill object itself. + */ + @Generated + public MergeSkill setInsertPostTag(String insertPostTag) { + this.insertPostTag = insertPostTag; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public MergeSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public MergeSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public MergeSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public MergeSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public MergeSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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("insertPreTag", this.insertPreTag); + jsonWriter.writeStringField("insertPostTag", this.insertPostTag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MergeSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MergeSkill 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 MergeSkill. + */ + @Generated + public static MergeSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MergeSkill deserializedMergeSkill = new MergeSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedMergeSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedMergeSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedMergeSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedMergeSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedMergeSkill.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedMergeSkill.odataType = reader.getString(); + } else if ("insertPreTag".equals(fieldName)) { + deserializedMergeSkill.insertPreTag = reader.getString(); + } else if ("insertPostTag".equals(fieldName)) { + deserializedMergeSkill.insertPostTag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMergeSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MicrosoftLanguageStemmingTokenizer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MicrosoftLanguageStemmingTokenizer.java new file mode 100644 index 000000000000..479a142a403d --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MicrosoftLanguageStemmingTokenizer.java @@ -0,0 +1,201 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Divides text using language-specific rules and reduces words to their base forms. + */ +@Fluent +public final class MicrosoftLanguageStemmingTokenizer extends LexicalTokenizer { + /* + * A URI fragment specifying the type of tokenizer. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.MicrosoftLanguageStemmingTokenizer"; + + /* + * The maximum token length. Tokens longer than the maximum length are split. Maximum token length that can be used + * is 300 characters. Tokens longer than 300 characters are first split into tokens of length 300 and then each of + * those tokens is split based on the max token length set. Default is 255. + */ + @Generated + private Integer maxTokenLength; + + /* + * A value indicating how the tokenizer is used. Set to true if used as the search tokenizer, set to false if used + * as the indexing tokenizer. Default is false. + */ + @Generated + private Boolean isSearchTokenizer; + + /* + * The language to use. The default is English. + */ + @Generated + private MicrosoftStemmingTokenizerLanguage language; + + /** + * Creates an instance of MicrosoftLanguageStemmingTokenizer class. + */ + @Generated + public MicrosoftLanguageStemmingTokenizer() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of tokenizer. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the maxTokenLength property: The maximum token length. Tokens longer than the maximum length are split. + * Maximum token length that can be used is 300 characters. Tokens longer than 300 characters are first split into + * tokens of length 300 and then each of those tokens is split based on the max token length set. Default is 255. + * + * @return the maxTokenLength value. + */ + @Generated + public Integer getMaxTokenLength() { + return this.maxTokenLength; + } + + /** + * Set the maxTokenLength property: The maximum token length. Tokens longer than the maximum length are split. + * Maximum token length that can be used is 300 characters. Tokens longer than 300 characters are first split into + * tokens of length 300 and then each of those tokens is split based on the max token length set. Default is 255. + * + * @param maxTokenLength the maxTokenLength value to set. + * @return the MicrosoftLanguageStemmingTokenizer object itself. + */ + @Generated + public MicrosoftLanguageStemmingTokenizer setMaxTokenLength(Integer maxTokenLength) { + this.maxTokenLength = maxTokenLength; + return this; + } + + /** + * Get the isSearchTokenizer property: A value indicating how the tokenizer is used. Set to true if used as the + * search tokenizer, set to false if used as the indexing tokenizer. Default is false. + * + * @return the isSearchTokenizer value. + */ + @Generated + public Boolean isSearchTokenizer() { + return this.isSearchTokenizer; + } + + /** + * Set the isSearchTokenizer property: A value indicating how the tokenizer is used. Set to true if used as the + * search tokenizer, set to false if used as the indexing tokenizer. Default is false. + * + * @param isSearchTokenizer the isSearchTokenizer value to set. + * @return the MicrosoftLanguageStemmingTokenizer object itself. + */ + @Generated + public MicrosoftLanguageStemmingTokenizer setIsSearchTokenizer(Boolean isSearchTokenizer) { + this.isSearchTokenizer = isSearchTokenizer; + return this; + } + + /** + * Get the language property: The language to use. The default is English. + * + * @return the language value. + */ + @Generated + public MicrosoftStemmingTokenizerLanguage getLanguage() { + return this.language; + } + + /** + * Set the language property: The language to use. The default is English. + * + * @param language the language value to set. + * @return the MicrosoftLanguageStemmingTokenizer object itself. + */ + @Generated + public MicrosoftLanguageStemmingTokenizer setLanguage(MicrosoftStemmingTokenizerLanguage language) { + this.language = language; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public MicrosoftLanguageStemmingTokenizer setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("maxTokenLength", this.maxTokenLength); + jsonWriter.writeBooleanField("isSearchTokenizer", this.isSearchTokenizer); + jsonWriter.writeStringField("language", this.language == null ? null : this.language.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MicrosoftLanguageStemmingTokenizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MicrosoftLanguageStemmingTokenizer 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 MicrosoftLanguageStemmingTokenizer. + */ + @Generated + public static MicrosoftLanguageStemmingTokenizer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MicrosoftLanguageStemmingTokenizer deserializedMicrosoftLanguageStemmingTokenizer + = new MicrosoftLanguageStemmingTokenizer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedMicrosoftLanguageStemmingTokenizer.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedMicrosoftLanguageStemmingTokenizer.odataType = reader.getString(); + } else if ("maxTokenLength".equals(fieldName)) { + deserializedMicrosoftLanguageStemmingTokenizer.maxTokenLength + = reader.getNullable(JsonReader::getInt); + } else if ("isSearchTokenizer".equals(fieldName)) { + deserializedMicrosoftLanguageStemmingTokenizer.isSearchTokenizer + = reader.getNullable(JsonReader::getBoolean); + } else if ("language".equals(fieldName)) { + deserializedMicrosoftLanguageStemmingTokenizer.language + = MicrosoftStemmingTokenizerLanguage.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMicrosoftLanguageStemmingTokenizer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MicrosoftLanguageTokenizer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MicrosoftLanguageTokenizer.java new file mode 100644 index 000000000000..936e3a5197c8 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MicrosoftLanguageTokenizer.java @@ -0,0 +1,199 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Divides text using language-specific rules. + */ +@Fluent +public final class MicrosoftLanguageTokenizer extends LexicalTokenizer { + /* + * A URI fragment specifying the type of tokenizer. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.MicrosoftLanguageTokenizer"; + + /* + * The maximum token length. Tokens longer than the maximum length are split. Maximum token length that can be used + * is 300 characters. Tokens longer than 300 characters are first split into tokens of length 300 and then each of + * those tokens is split based on the max token length set. Default is 255. + */ + @Generated + private Integer maxTokenLength; + + /* + * A value indicating how the tokenizer is used. Set to true if used as the search tokenizer, set to false if used + * as the indexing tokenizer. Default is false. + */ + @Generated + private Boolean isSearchTokenizer; + + /* + * The language to use. The default is English. + */ + @Generated + private MicrosoftTokenizerLanguage language; + + /** + * Creates an instance of MicrosoftLanguageTokenizer class. + */ + @Generated + public MicrosoftLanguageTokenizer() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of tokenizer. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the maxTokenLength property: The maximum token length. Tokens longer than the maximum length are split. + * Maximum token length that can be used is 300 characters. Tokens longer than 300 characters are first split into + * tokens of length 300 and then each of those tokens is split based on the max token length set. Default is 255. + * + * @return the maxTokenLength value. + */ + @Generated + public Integer getMaxTokenLength() { + return this.maxTokenLength; + } + + /** + * Set the maxTokenLength property: The maximum token length. Tokens longer than the maximum length are split. + * Maximum token length that can be used is 300 characters. Tokens longer than 300 characters are first split into + * tokens of length 300 and then each of those tokens is split based on the max token length set. Default is 255. + * + * @param maxTokenLength the maxTokenLength value to set. + * @return the MicrosoftLanguageTokenizer object itself. + */ + @Generated + public MicrosoftLanguageTokenizer setMaxTokenLength(Integer maxTokenLength) { + this.maxTokenLength = maxTokenLength; + return this; + } + + /** + * Get the isSearchTokenizer property: A value indicating how the tokenizer is used. Set to true if used as the + * search tokenizer, set to false if used as the indexing tokenizer. Default is false. + * + * @return the isSearchTokenizer value. + */ + @Generated + public Boolean isSearchTokenizer() { + return this.isSearchTokenizer; + } + + /** + * Set the isSearchTokenizer property: A value indicating how the tokenizer is used. Set to true if used as the + * search tokenizer, set to false if used as the indexing tokenizer. Default is false. + * + * @param isSearchTokenizer the isSearchTokenizer value to set. + * @return the MicrosoftLanguageTokenizer object itself. + */ + @Generated + public MicrosoftLanguageTokenizer setIsSearchTokenizer(Boolean isSearchTokenizer) { + this.isSearchTokenizer = isSearchTokenizer; + return this; + } + + /** + * Get the language property: The language to use. The default is English. + * + * @return the language value. + */ + @Generated + public MicrosoftTokenizerLanguage getLanguage() { + return this.language; + } + + /** + * Set the language property: The language to use. The default is English. + * + * @param language the language value to set. + * @return the MicrosoftLanguageTokenizer object itself. + */ + @Generated + public MicrosoftLanguageTokenizer setLanguage(MicrosoftTokenizerLanguage language) { + this.language = language; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public MicrosoftLanguageTokenizer setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("maxTokenLength", this.maxTokenLength); + jsonWriter.writeBooleanField("isSearchTokenizer", this.isSearchTokenizer); + jsonWriter.writeStringField("language", this.language == null ? null : this.language.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MicrosoftLanguageTokenizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MicrosoftLanguageTokenizer 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 MicrosoftLanguageTokenizer. + */ + @Generated + public static MicrosoftLanguageTokenizer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MicrosoftLanguageTokenizer deserializedMicrosoftLanguageTokenizer = new MicrosoftLanguageTokenizer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedMicrosoftLanguageTokenizer.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedMicrosoftLanguageTokenizer.odataType = reader.getString(); + } else if ("maxTokenLength".equals(fieldName)) { + deserializedMicrosoftLanguageTokenizer.maxTokenLength = reader.getNullable(JsonReader::getInt); + } else if ("isSearchTokenizer".equals(fieldName)) { + deserializedMicrosoftLanguageTokenizer.isSearchTokenizer + = reader.getNullable(JsonReader::getBoolean); + } else if ("language".equals(fieldName)) { + deserializedMicrosoftLanguageTokenizer.language + = MicrosoftTokenizerLanguage.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMicrosoftLanguageTokenizer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MicrosoftStemmingTokenizerLanguage.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MicrosoftStemmingTokenizerLanguage.java new file mode 100644 index 000000000000..76aa9101a7b9 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MicrosoftStemmingTokenizerLanguage.java @@ -0,0 +1,272 @@ +// 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.models; + +/** + * Lists the languages supported by the Microsoft language stemming tokenizer. + */ +public enum MicrosoftStemmingTokenizerLanguage { + /** + * Selects the Microsoft stemming tokenizer for Arabic. + */ + ARABIC("arabic"), + + /** + * Selects the Microsoft stemming tokenizer for Bangla. + */ + BANGLA("bangla"), + + /** + * Selects the Microsoft stemming tokenizer for Bulgarian. + */ + BULGARIAN("bulgarian"), + + /** + * Selects the Microsoft stemming tokenizer for Catalan. + */ + CATALAN("catalan"), + + /** + * Selects the Microsoft stemming tokenizer for Croatian. + */ + CROATIAN("croatian"), + + /** + * Selects the Microsoft stemming tokenizer for Czech. + */ + CZECH("czech"), + + /** + * Selects the Microsoft stemming tokenizer for Danish. + */ + DANISH("danish"), + + /** + * Selects the Microsoft stemming tokenizer for Dutch. + */ + DUTCH("dutch"), + + /** + * Selects the Microsoft stemming tokenizer for English. + */ + ENGLISH("english"), + + /** + * Selects the Microsoft stemming tokenizer for Estonian. + */ + ESTONIAN("estonian"), + + /** + * Selects the Microsoft stemming tokenizer for Finnish. + */ + FINNISH("finnish"), + + /** + * Selects the Microsoft stemming tokenizer for French. + */ + FRENCH("french"), + + /** + * Selects the Microsoft stemming tokenizer for German. + */ + GERMAN("german"), + + /** + * Selects the Microsoft stemming tokenizer for Greek. + */ + GREEK("greek"), + + /** + * Selects the Microsoft stemming tokenizer for Gujarati. + */ + GUJARATI("gujarati"), + + /** + * Selects the Microsoft stemming tokenizer for Hebrew. + */ + HEBREW("hebrew"), + + /** + * Selects the Microsoft stemming tokenizer for Hindi. + */ + HINDI("hindi"), + + /** + * Selects the Microsoft stemming tokenizer for Hungarian. + */ + HUNGARIAN("hungarian"), + + /** + * Selects the Microsoft stemming tokenizer for Icelandic. + */ + ICELANDIC("icelandic"), + + /** + * Selects the Microsoft stemming tokenizer for Indonesian. + */ + INDONESIAN("indonesian"), + + /** + * Selects the Microsoft stemming tokenizer for Italian. + */ + ITALIAN("italian"), + + /** + * Selects the Microsoft stemming tokenizer for Kannada. + */ + KANNADA("kannada"), + + /** + * Selects the Microsoft stemming tokenizer for Latvian. + */ + LATVIAN("latvian"), + + /** + * Selects the Microsoft stemming tokenizer for Lithuanian. + */ + LITHUANIAN("lithuanian"), + + /** + * Selects the Microsoft stemming tokenizer for Malay. + */ + MALAY("malay"), + + /** + * Selects the Microsoft stemming tokenizer for Malayalam. + */ + MALAYALAM("malayalam"), + + /** + * Selects the Microsoft stemming tokenizer for Marathi. + */ + MARATHI("marathi"), + + /** + * Selects the Microsoft stemming tokenizer for Norwegian (Bokmål). + */ + NORWEGIAN_BOKMAAL("norwegianBokmaal"), + + /** + * Selects the Microsoft stemming tokenizer for Polish. + */ + POLISH("polish"), + + /** + * Selects the Microsoft stemming tokenizer for Portuguese. + */ + PORTUGUESE("portuguese"), + + /** + * Selects the Microsoft stemming tokenizer for Portuguese (Brazil). + */ + PORTUGUESE_BRAZILIAN("portugueseBrazilian"), + + /** + * Selects the Microsoft stemming tokenizer for Punjabi. + */ + PUNJABI("punjabi"), + + /** + * Selects the Microsoft stemming tokenizer for Romanian. + */ + ROMANIAN("romanian"), + + /** + * Selects the Microsoft stemming tokenizer for Russian. + */ + RUSSIAN("russian"), + + /** + * Selects the Microsoft stemming tokenizer for Serbian (Cyrillic). + */ + SERBIAN_CYRILLIC("serbianCyrillic"), + + /** + * Selects the Microsoft stemming tokenizer for Serbian (Latin). + */ + SERBIAN_LATIN("serbianLatin"), + + /** + * Selects the Microsoft stemming tokenizer for Slovak. + */ + SLOVAK("slovak"), + + /** + * Selects the Microsoft stemming tokenizer for Slovenian. + */ + SLOVENIAN("slovenian"), + + /** + * Selects the Microsoft stemming tokenizer for Spanish. + */ + SPANISH("spanish"), + + /** + * Selects the Microsoft stemming tokenizer for Swedish. + */ + SWEDISH("swedish"), + + /** + * Selects the Microsoft stemming tokenizer for Tamil. + */ + TAMIL("tamil"), + + /** + * Selects the Microsoft stemming tokenizer for Telugu. + */ + TELUGU("telugu"), + + /** + * Selects the Microsoft stemming tokenizer for Turkish. + */ + TURKISH("turkish"), + + /** + * Selects the Microsoft stemming tokenizer for Ukrainian. + */ + UKRAINIAN("ukrainian"), + + /** + * Selects the Microsoft stemming tokenizer for Urdu. + */ + URDU("urdu"); + + /** + * The actual serialized value for a MicrosoftStemmingTokenizerLanguage instance. + */ + private final String value; + + MicrosoftStemmingTokenizerLanguage(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a MicrosoftStemmingTokenizerLanguage instance. + * + * @param value the serialized value to parse. + * @return the parsed MicrosoftStemmingTokenizerLanguage object, or null if unable to parse. + */ + public static MicrosoftStemmingTokenizerLanguage fromString(String value) { + if (value == null) { + return null; + } + MicrosoftStemmingTokenizerLanguage[] items = MicrosoftStemmingTokenizerLanguage.values(); + for (MicrosoftStemmingTokenizerLanguage item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MicrosoftTokenizerLanguage.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MicrosoftTokenizerLanguage.java new file mode 100644 index 000000000000..2b545ec87b71 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/MicrosoftTokenizerLanguage.java @@ -0,0 +1,257 @@ +// 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.models; + +/** + * Lists the languages supported by the Microsoft language tokenizer. + */ +public enum MicrosoftTokenizerLanguage { + /** + * Selects the Microsoft tokenizer for Bangla. + */ + BANGLA("bangla"), + + /** + * Selects the Microsoft tokenizer for Bulgarian. + */ + BULGARIAN("bulgarian"), + + /** + * Selects the Microsoft tokenizer for Catalan. + */ + CATALAN("catalan"), + + /** + * Selects the Microsoft tokenizer for Chinese (Simplified). + */ + CHINESE_SIMPLIFIED("chineseSimplified"), + + /** + * Selects the Microsoft tokenizer for Chinese (Traditional). + */ + CHINESE_TRADITIONAL("chineseTraditional"), + + /** + * Selects the Microsoft tokenizer for Croatian. + */ + CROATIAN("croatian"), + + /** + * Selects the Microsoft tokenizer for Czech. + */ + CZECH("czech"), + + /** + * Selects the Microsoft tokenizer for Danish. + */ + DANISH("danish"), + + /** + * Selects the Microsoft tokenizer for Dutch. + */ + DUTCH("dutch"), + + /** + * Selects the Microsoft tokenizer for English. + */ + ENGLISH("english"), + + /** + * Selects the Microsoft tokenizer for French. + */ + FRENCH("french"), + + /** + * Selects the Microsoft tokenizer for German. + */ + GERMAN("german"), + + /** + * Selects the Microsoft tokenizer for Greek. + */ + GREEK("greek"), + + /** + * Selects the Microsoft tokenizer for Gujarati. + */ + GUJARATI("gujarati"), + + /** + * Selects the Microsoft tokenizer for Hindi. + */ + HINDI("hindi"), + + /** + * Selects the Microsoft tokenizer for Icelandic. + */ + ICELANDIC("icelandic"), + + /** + * Selects the Microsoft tokenizer for Indonesian. + */ + INDONESIAN("indonesian"), + + /** + * Selects the Microsoft tokenizer for Italian. + */ + ITALIAN("italian"), + + /** + * Selects the Microsoft tokenizer for Japanese. + */ + JAPANESE("japanese"), + + /** + * Selects the Microsoft tokenizer for Kannada. + */ + KANNADA("kannada"), + + /** + * Selects the Microsoft tokenizer for Korean. + */ + KOREAN("korean"), + + /** + * Selects the Microsoft tokenizer for Malay. + */ + MALAY("malay"), + + /** + * Selects the Microsoft tokenizer for Malayalam. + */ + MALAYALAM("malayalam"), + + /** + * Selects the Microsoft tokenizer for Marathi. + */ + MARATHI("marathi"), + + /** + * Selects the Microsoft tokenizer for Norwegian (Bokmål). + */ + NORWEGIAN_BOKMAAL("norwegianBokmaal"), + + /** + * Selects the Microsoft tokenizer for Polish. + */ + POLISH("polish"), + + /** + * Selects the Microsoft tokenizer for Portuguese. + */ + PORTUGUESE("portuguese"), + + /** + * Selects the Microsoft tokenizer for Portuguese (Brazil). + */ + PORTUGUESE_BRAZILIAN("portugueseBrazilian"), + + /** + * Selects the Microsoft tokenizer for Punjabi. + */ + PUNJABI("punjabi"), + + /** + * Selects the Microsoft tokenizer for Romanian. + */ + ROMANIAN("romanian"), + + /** + * Selects the Microsoft tokenizer for Russian. + */ + RUSSIAN("russian"), + + /** + * Selects the Microsoft tokenizer for Serbian (Cyrillic). + */ + SERBIAN_CYRILLIC("serbianCyrillic"), + + /** + * Selects the Microsoft tokenizer for Serbian (Latin). + */ + SERBIAN_LATIN("serbianLatin"), + + /** + * Selects the Microsoft tokenizer for Slovenian. + */ + SLOVENIAN("slovenian"), + + /** + * Selects the Microsoft tokenizer for Spanish. + */ + SPANISH("spanish"), + + /** + * Selects the Microsoft tokenizer for Swedish. + */ + SWEDISH("swedish"), + + /** + * Selects the Microsoft tokenizer for Tamil. + */ + TAMIL("tamil"), + + /** + * Selects the Microsoft tokenizer for Telugu. + */ + TELUGU("telugu"), + + /** + * Selects the Microsoft tokenizer for Thai. + */ + THAI("thai"), + + /** + * Selects the Microsoft tokenizer for Ukrainian. + */ + UKRAINIAN("ukrainian"), + + /** + * Selects the Microsoft tokenizer for Urdu. + */ + URDU("urdu"), + + /** + * Selects the Microsoft tokenizer for Vietnamese. + */ + VIETNAMESE("vietnamese"); + + /** + * The actual serialized value for a MicrosoftTokenizerLanguage instance. + */ + private final String value; + + MicrosoftTokenizerLanguage(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a MicrosoftTokenizerLanguage instance. + * + * @param value the serialized value to parse. + * @return the parsed MicrosoftTokenizerLanguage object, or null if unable to parse. + */ + public static MicrosoftTokenizerLanguage fromString(String value) { + if (value == null) { + return null; + } + MicrosoftTokenizerLanguage[] items = MicrosoftTokenizerLanguage.values(); + for (MicrosoftTokenizerLanguage item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/NGramTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/NGramTokenFilter.java new file mode 100644 index 000000000000..975ad5feadb5 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/NGramTokenFilter.java @@ -0,0 +1,157 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Generates n-grams of the given size(s). This token filter is implemented using Apache Lucene. + */ +@Fluent +public final class NGramTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.NGramTokenFilter"; + + /* + * The minimum n-gram length. Default is 1. Must be less than the value of maxGram. + */ + @Generated + private Integer minGram; + + /* + * The maximum n-gram length. Default is 2. + */ + @Generated + private Integer maxGram; + + /** + * Creates an instance of NGramTokenFilter class. + */ + @Generated + public NGramTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the minGram property: The minimum n-gram length. Default is 1. Must be less than the value of maxGram. + * + * @return the minGram value. + */ + @Generated + public Integer getMinGram() { + return this.minGram; + } + + /** + * Set the minGram property: The minimum n-gram length. Default is 1. Must be less than the value of maxGram. + * + * @param minGram the minGram value to set. + * @return the NGramTokenFilter object itself. + */ + @Generated + public NGramTokenFilter setMinGram(Integer minGram) { + this.minGram = minGram; + return this; + } + + /** + * Get the maxGram property: The maximum n-gram length. Default is 2. + * + * @return the maxGram value. + */ + @Generated + public Integer getMaxGram() { + return this.maxGram; + } + + /** + * Set the maxGram property: The maximum n-gram length. Default is 2. + * + * @param maxGram the maxGram value to set. + * @return the NGramTokenFilter object itself. + */ + @Generated + public NGramTokenFilter setMaxGram(Integer maxGram) { + this.maxGram = maxGram; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public NGramTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("minGram", this.minGram); + jsonWriter.writeNumberField("maxGram", this.maxGram); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NGramTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NGramTokenFilter 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 NGramTokenFilter. + */ + @Generated + public static NGramTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NGramTokenFilter deserializedNGramTokenFilter = new NGramTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedNGramTokenFilter.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedNGramTokenFilter.odataType = reader.getString(); + } else if ("minGram".equals(fieldName)) { + deserializedNGramTokenFilter.minGram = reader.getNullable(JsonReader::getInt); + } else if ("maxGram".equals(fieldName)) { + deserializedNGramTokenFilter.maxGram = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedNGramTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/NGramTokenFilterV2.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/NGramTokenFilterV2.java new file mode 100644 index 000000000000..95069c7e4fea --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/NGramTokenFilterV2.java @@ -0,0 +1,159 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Generates n-grams of the given size(s). This token filter is implemented using Apache Lucene. + */ +@Fluent +public final class NGramTokenFilterV2 extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.NGramTokenFilterV2"; + + /* + * The minimum n-gram length. Default is 1. Maximum is 300. Must be less than the value of maxGram. + */ + @Generated + private Integer minGram; + + /* + * The maximum n-gram length. Default is 2. Maximum is 300. + */ + @Generated + private Integer maxGram; + + /** + * Creates an instance of NGramTokenFilterV2 class. + */ + @Generated + public NGramTokenFilterV2() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the minGram property: The minimum n-gram length. Default is 1. Maximum is 300. Must be less than the value of + * maxGram. + * + * @return the minGram value. + */ + @Generated + public Integer getMinGram() { + return this.minGram; + } + + /** + * Set the minGram property: The minimum n-gram length. Default is 1. Maximum is 300. Must be less than the value of + * maxGram. + * + * @param minGram the minGram value to set. + * @return the NGramTokenFilterV2 object itself. + */ + @Generated + public NGramTokenFilterV2 setMinGram(Integer minGram) { + this.minGram = minGram; + return this; + } + + /** + * Get the maxGram property: The maximum n-gram length. Default is 2. Maximum is 300. + * + * @return the maxGram value. + */ + @Generated + public Integer getMaxGram() { + return this.maxGram; + } + + /** + * Set the maxGram property: The maximum n-gram length. Default is 2. Maximum is 300. + * + * @param maxGram the maxGram value to set. + * @return the NGramTokenFilterV2 object itself. + */ + @Generated + public NGramTokenFilterV2 setMaxGram(Integer maxGram) { + this.maxGram = maxGram; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public NGramTokenFilterV2 setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("minGram", this.minGram); + jsonWriter.writeNumberField("maxGram", this.maxGram); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NGramTokenFilterV2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NGramTokenFilterV2 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 NGramTokenFilterV2. + */ + @Generated + public static NGramTokenFilterV2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NGramTokenFilterV2 deserializedNGramTokenFilterV2 = new NGramTokenFilterV2(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedNGramTokenFilterV2.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedNGramTokenFilterV2.odataType = reader.getString(); + } else if ("minGram".equals(fieldName)) { + deserializedNGramTokenFilterV2.minGram = reader.getNullable(JsonReader::getInt); + } else if ("maxGram".equals(fieldName)) { + deserializedNGramTokenFilterV2.maxGram = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedNGramTokenFilterV2; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/NGramTokenizer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/NGramTokenizer.java new file mode 100644 index 000000000000..61c80ca7ffc2 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/NGramTokenizer.java @@ -0,0 +1,194 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Tokenizes the input into n-grams of the given size(s). This tokenizer is implemented using Apache Lucene. + */ +@Fluent +public final class NGramTokenizer extends LexicalTokenizer { + /* + * A URI fragment specifying the type of tokenizer. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.NGramTokenizer"; + + /* + * The minimum n-gram length. Default is 1. Maximum is 300. Must be less than the value of maxGram. + */ + @Generated + private Integer minGram; + + /* + * The maximum n-gram length. Default is 2. Maximum is 300. + */ + @Generated + private Integer maxGram; + + /* + * Character classes to keep in the tokens. + */ + @Generated + private List tokenChars; + + /** + * Creates an instance of NGramTokenizer class. + */ + @Generated + public NGramTokenizer() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of tokenizer. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the minGram property: The minimum n-gram length. Default is 1. Maximum is 300. Must be less than the value of + * maxGram. + * + * @return the minGram value. + */ + @Generated + public Integer getMinGram() { + return this.minGram; + } + + /** + * Set the minGram property: The minimum n-gram length. Default is 1. Maximum is 300. Must be less than the value of + * maxGram. + * + * @param minGram the minGram value to set. + * @return the NGramTokenizer object itself. + */ + @Generated + public NGramTokenizer setMinGram(Integer minGram) { + this.minGram = minGram; + return this; + } + + /** + * Get the maxGram property: The maximum n-gram length. Default is 2. Maximum is 300. + * + * @return the maxGram value. + */ + @Generated + public Integer getMaxGram() { + return this.maxGram; + } + + /** + * Set the maxGram property: The maximum n-gram length. Default is 2. Maximum is 300. + * + * @param maxGram the maxGram value to set. + * @return the NGramTokenizer object itself. + */ + @Generated + public NGramTokenizer setMaxGram(Integer maxGram) { + this.maxGram = maxGram; + return this; + } + + /** + * Get the tokenChars property: Character classes to keep in the tokens. + * + * @return the tokenChars value. + */ + @Generated + public List getTokenChars() { + return this.tokenChars; + } + + /** + * Set the tokenChars property: Character classes to keep in the tokens. + * + * @param tokenChars the tokenChars value to set. + * @return the NGramTokenizer object itself. + */ + @Generated + public NGramTokenizer setTokenChars(List tokenChars) { + this.tokenChars = tokenChars; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public NGramTokenizer setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("minGram", this.minGram); + jsonWriter.writeNumberField("maxGram", this.maxGram); + jsonWriter.writeArrayField("tokenChars", this.tokenChars, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NGramTokenizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NGramTokenizer 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 NGramTokenizer. + */ + @Generated + public static NGramTokenizer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NGramTokenizer deserializedNGramTokenizer = new NGramTokenizer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedNGramTokenizer.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedNGramTokenizer.odataType = reader.getString(); + } else if ("minGram".equals(fieldName)) { + deserializedNGramTokenizer.minGram = reader.getNullable(JsonReader::getInt); + } else if ("maxGram".equals(fieldName)) { + deserializedNGramTokenizer.maxGram = reader.getNullable(JsonReader::getInt); + } else if ("tokenChars".equals(fieldName)) { + List tokenChars + = reader.readArray(reader1 -> TokenCharacterKind.fromString(reader1.getString())); + deserializedNGramTokenizer.tokenChars = tokenChars; + } else { + reader.skipChildren(); + } + } + + return deserializedNGramTokenizer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/NativeBlobSoftDeleteDeletionDetectionPolicy.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/NativeBlobSoftDeleteDeletionDetectionPolicy.java new file mode 100644 index 000000000000..14a295cd48e4 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/NativeBlobSoftDeleteDeletionDetectionPolicy.java @@ -0,0 +1,83 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.NativeBlobSoftDeleteDeletionDetectionPolicy"; + + /** + * Creates an instance of NativeBlobSoftDeleteDeletionDetectionPolicy class. + */ + @Generated + public NativeBlobSoftDeleteDeletionDetectionPolicy() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of data deletion detection policy. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + 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/search/src/main/java/com/azure/search/models/OcrSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/OcrSkill.java new file mode 100644 index 000000000000..e6137294a790 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/OcrSkill.java @@ -0,0 +1,251 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A skill that extracts text from image files. + */ +@Fluent +public final class OcrSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Vision.OcrSkill"; + + /* + * A value indicating which language code to use. Default is `en`. + */ + @Generated + private OcrSkillLanguage defaultLanguageCode; + + /* + * A value indicating to turn orientation detection on or not. Default is false. + */ + @Generated + private Boolean shouldDetectOrientation; + + /* + * Defines the sequence of characters to use between the lines of text recognized by the OCR skill. The default + * value is "space". + */ + @Generated + private LineEnding lineEnding; + + /** + * Creates an instance of OcrSkill class. + */ + @Generated + public OcrSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @return the defaultLanguageCode value. + */ + @Generated + public OcrSkillLanguage getDefaultLanguageCode() { + return this.defaultLanguageCode; + } + + /** + * Set the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @param defaultLanguageCode the defaultLanguageCode value to set. + * @return the OcrSkill object itself. + */ + @Generated + public OcrSkill setDefaultLanguageCode(OcrSkillLanguage defaultLanguageCode) { + this.defaultLanguageCode = defaultLanguageCode; + return this; + } + + /** + * Get the shouldDetectOrientation property: A value indicating to turn orientation detection on or not. Default is + * false. + * + * @return the shouldDetectOrientation value. + */ + @Generated + public Boolean isShouldDetectOrientation() { + return this.shouldDetectOrientation; + } + + /** + * Set the shouldDetectOrientation property: A value indicating to turn orientation detection on or not. Default is + * false. + * + * @param shouldDetectOrientation the shouldDetectOrientation value to set. + * @return the OcrSkill object itself. + */ + @Generated + public OcrSkill setShouldDetectOrientation(Boolean shouldDetectOrientation) { + this.shouldDetectOrientation = shouldDetectOrientation; + return this; + } + + /** + * Get the lineEnding property: Defines the sequence of characters to use between the lines of text recognized by + * the OCR skill. The default value is "space". + * + * @return the lineEnding value. + */ + @Generated + public LineEnding getLineEnding() { + return this.lineEnding; + } + + /** + * Set the lineEnding property: Defines the sequence of characters to use between the lines of text recognized by + * the OCR skill. The default value is "space". + * + * @param lineEnding the lineEnding value to set. + * @return the OcrSkill object itself. + */ + @Generated + public OcrSkill setLineEnding(LineEnding lineEnding) { + this.lineEnding = lineEnding; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public OcrSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public OcrSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public OcrSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public OcrSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public OcrSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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("defaultLanguageCode", + this.defaultLanguageCode == null ? null : this.defaultLanguageCode.toString()); + jsonWriter.writeBooleanField("detectOrientation", this.shouldDetectOrientation); + jsonWriter.writeStringField("lineEnding", this.lineEnding == null ? null : this.lineEnding.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OcrSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OcrSkill 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 OcrSkill. + */ + @Generated + public static OcrSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OcrSkill deserializedOcrSkill = new OcrSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedOcrSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedOcrSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedOcrSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedOcrSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedOcrSkill.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedOcrSkill.odataType = reader.getString(); + } else if ("defaultLanguageCode".equals(fieldName)) { + deserializedOcrSkill.defaultLanguageCode = OcrSkillLanguage.fromString(reader.getString()); + } else if ("detectOrientation".equals(fieldName)) { + deserializedOcrSkill.shouldDetectOrientation = reader.getNullable(JsonReader::getBoolean); + } else if ("lineEnding".equals(fieldName)) { + deserializedOcrSkill.lineEnding = LineEnding.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOcrSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/OcrSkillLanguage.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/OcrSkillLanguage.java new file mode 100644 index 000000000000..e3b78d5350dc --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/OcrSkillLanguage.java @@ -0,0 +1,1066 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The language codes supported for input by OcrSkill. + */ +public final class OcrSkillLanguage extends ExpandableStringEnum { + /** + * Afrikaans. + */ + @Generated + public static final OcrSkillLanguage AF = fromString("af"); + + /** + * Albanian. + */ + @Generated + public static final OcrSkillLanguage SQ = fromString("sq"); + + /** + * Angika (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage ANP = fromString("anp"); + + /** + * Arabic. + */ + @Generated + public static final OcrSkillLanguage AR = fromString("ar"); + + /** + * Asturian. + */ + @Generated + public static final OcrSkillLanguage AST = fromString("ast"); + + /** + * Awadhi-Hindi (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage AWA = fromString("awa"); + + /** + * Azerbaijani (Latin). + */ + @Generated + public static final OcrSkillLanguage AZ = fromString("az"); + + /** + * Bagheli. + */ + @Generated + public static final OcrSkillLanguage BFY = fromString("bfy"); + + /** + * Basque. + */ + @Generated + public static final OcrSkillLanguage EU = fromString("eu"); + + /** + * Belarusian (Cyrillic and Latin). + */ + @Generated + public static final OcrSkillLanguage BE = fromString("be"); + + /** + * Belarusian (Cyrillic). + */ + @Generated + public static final OcrSkillLanguage BE_CYRL = fromString("be-cyrl"); + + /** + * Belarusian (Latin). + */ + @Generated + public static final OcrSkillLanguage BE_LATN = fromString("be-latn"); + + /** + * Bhojpuri-Hindi (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage BHO = fromString("bho"); + + /** + * Bislama. + */ + @Generated + public static final OcrSkillLanguage BI = fromString("bi"); + + /** + * Bodo (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage BRX = fromString("brx"); + + /** + * Bosnian Latin. + */ + @Generated + public static final OcrSkillLanguage BS = fromString("bs"); + + /** + * Brajbha. + */ + @Generated + public static final OcrSkillLanguage BRA = fromString("bra"); + + /** + * Breton. + */ + @Generated + public static final OcrSkillLanguage BR = fromString("br"); + + /** + * Bulgarian. + */ + @Generated + public static final OcrSkillLanguage BG = fromString("bg"); + + /** + * Bundeli. + */ + @Generated + public static final OcrSkillLanguage BNS = fromString("bns"); + + /** + * Buryat (Cyrillic). + */ + @Generated + public static final OcrSkillLanguage BUA = fromString("bua"); + + /** + * Catalan. + */ + @Generated + public static final OcrSkillLanguage CA = fromString("ca"); + + /** + * Cebuano. + */ + @Generated + public static final OcrSkillLanguage CEB = fromString("ceb"); + + /** + * Chamling. + */ + @Generated + public static final OcrSkillLanguage RAB = fromString("rab"); + + /** + * Chamorro. + */ + @Generated + public static final OcrSkillLanguage CH = fromString("ch"); + + /** + * Chhattisgarhi (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage HNE = fromString("hne"); + + /** + * Chinese Simplified. + */ + @Generated + public static final OcrSkillLanguage ZH_HANS = fromString("zh-Hans"); + + /** + * Chinese Traditional. + */ + @Generated + public static final OcrSkillLanguage ZH_HANT = fromString("zh-Hant"); + + /** + * Cornish. + */ + @Generated + public static final OcrSkillLanguage KW = fromString("kw"); + + /** + * Corsican. + */ + @Generated + public static final OcrSkillLanguage CO = fromString("co"); + + /** + * Crimean Tatar (Latin). + */ + @Generated + public static final OcrSkillLanguage CRH = fromString("crh"); + + /** + * Croatian. + */ + @Generated + public static final OcrSkillLanguage HR = fromString("hr"); + + /** + * Czech. + */ + @Generated + public static final OcrSkillLanguage CS = fromString("cs"); + + /** + * Danish. + */ + @Generated + public static final OcrSkillLanguage DA = fromString("da"); + + /** + * Dari. + */ + @Generated + public static final OcrSkillLanguage PRS = fromString("prs"); + + /** + * Dhimal (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage DHI = fromString("dhi"); + + /** + * Dogri (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage DOI = fromString("doi"); + + /** + * Dutch. + */ + @Generated + public static final OcrSkillLanguage NL = fromString("nl"); + + /** + * English. + */ + @Generated + public static final OcrSkillLanguage EN = fromString("en"); + + /** + * Erzya (Cyrillic). + */ + @Generated + public static final OcrSkillLanguage MYV = fromString("myv"); + + /** + * Estonian. + */ + @Generated + public static final OcrSkillLanguage ET = fromString("et"); + + /** + * Faroese. + */ + @Generated + public static final OcrSkillLanguage FO = fromString("fo"); + + /** + * Fijian. + */ + @Generated + public static final OcrSkillLanguage FJ = fromString("fj"); + + /** + * Filipino. + */ + @Generated + public static final OcrSkillLanguage FIL = fromString("fil"); + + /** + * Finnish. + */ + @Generated + public static final OcrSkillLanguage FI = fromString("fi"); + + /** + * French. + */ + @Generated + public static final OcrSkillLanguage FR = fromString("fr"); + + /** + * Frulian. + */ + @Generated + public static final OcrSkillLanguage FUR = fromString("fur"); + + /** + * Gagauz (Latin). + */ + @Generated + public static final OcrSkillLanguage GAG = fromString("gag"); + + /** + * Galician. + */ + @Generated + public static final OcrSkillLanguage GL = fromString("gl"); + + /** + * German. + */ + @Generated + public static final OcrSkillLanguage DE = fromString("de"); + + /** + * Gilbertese. + */ + @Generated + public static final OcrSkillLanguage GIL = fromString("gil"); + + /** + * Gondi (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage GON = fromString("gon"); + + /** + * Greek. + */ + @Generated + public static final OcrSkillLanguage EL = fromString("el"); + + /** + * Greenlandic. + */ + @Generated + public static final OcrSkillLanguage KL = fromString("kl"); + + /** + * Gurung (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage GVR = fromString("gvr"); + + /** + * Haitian Creole. + */ + @Generated + public static final OcrSkillLanguage HT = fromString("ht"); + + /** + * Halbi (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage HLB = fromString("hlb"); + + /** + * Hani. + */ + @Generated + public static final OcrSkillLanguage HNI = fromString("hni"); + + /** + * Haryanvi. + */ + @Generated + public static final OcrSkillLanguage BGC = fromString("bgc"); + + /** + * Hawaiian. + */ + @Generated + public static final OcrSkillLanguage HAW = fromString("haw"); + + /** + * Hindi. + */ + @Generated + public static final OcrSkillLanguage HI = fromString("hi"); + + /** + * Hmong Daw (Latin). + */ + @Generated + public static final OcrSkillLanguage MWW = fromString("mww"); + + /** + * Ho (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage HOC = fromString("hoc"); + + /** + * Hungarian. + */ + @Generated + public static final OcrSkillLanguage HU = fromString("hu"); + + /** + * Icelandic. + */ + @Generated + public static final OcrSkillLanguage IS = fromString("is"); + + /** + * Inari Sami. + */ + @Generated + public static final OcrSkillLanguage SMN = fromString("smn"); + + /** + * Indonesian. + */ + @Generated + public static final OcrSkillLanguage ID = fromString("id"); + + /** + * Interlingua. + */ + @Generated + public static final OcrSkillLanguage IA = fromString("ia"); + + /** + * Inuktitut (Latin). + */ + @Generated + public static final OcrSkillLanguage IU = fromString("iu"); + + /** + * Irish. + */ + @Generated + public static final OcrSkillLanguage GA = fromString("ga"); + + /** + * Italian. + */ + @Generated + public static final OcrSkillLanguage IT = fromString("it"); + + /** + * Japanese. + */ + @Generated + public static final OcrSkillLanguage JA = fromString("ja"); + + /** + * Jaunsari (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage JNS = fromString("Jns"); + + /** + * Javanese. + */ + @Generated + public static final OcrSkillLanguage JV = fromString("jv"); + + /** + * Kabuverdianu. + */ + @Generated + public static final OcrSkillLanguage KEA = fromString("kea"); + + /** + * Kachin (Latin). + */ + @Generated + public static final OcrSkillLanguage KAC = fromString("kac"); + + /** + * Kangri (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage XNR = fromString("xnr"); + + /** + * Karachay-Balkar. + */ + @Generated + public static final OcrSkillLanguage KRC = fromString("krc"); + + /** + * Kara-Kalpak (Cyrillic). + */ + @Generated + public static final OcrSkillLanguage KAA_CYRL = fromString("kaa-cyrl"); + + /** + * Kara-Kalpak (Latin). + */ + @Generated + public static final OcrSkillLanguage KAA = fromString("kaa"); + + /** + * Kashubian. + */ + @Generated + public static final OcrSkillLanguage CSB = fromString("csb"); + + /** + * Kazakh (Cyrillic). + */ + @Generated + public static final OcrSkillLanguage KK_CYRL = fromString("kk-cyrl"); + + /** + * Kazakh (Latin). + */ + @Generated + public static final OcrSkillLanguage KK_LATN = fromString("kk-latn"); + + /** + * Khaling. + */ + @Generated + public static final OcrSkillLanguage KLR = fromString("klr"); + + /** + * Khasi. + */ + @Generated + public static final OcrSkillLanguage KHA = fromString("kha"); + + /** + * K'iche'. + */ + @Generated + public static final OcrSkillLanguage QUC = fromString("quc"); + + /** + * Korean. + */ + @Generated + public static final OcrSkillLanguage KO = fromString("ko"); + + /** + * Korku. + */ + @Generated + public static final OcrSkillLanguage KFQ = fromString("kfq"); + + /** + * Koryak. + */ + @Generated + public static final OcrSkillLanguage KPY = fromString("kpy"); + + /** + * Kosraean. + */ + @Generated + public static final OcrSkillLanguage KOS = fromString("kos"); + + /** + * Kumyk (Cyrillic). + */ + @Generated + public static final OcrSkillLanguage KUM = fromString("kum"); + + /** + * Kurdish (Arabic). + */ + @Generated + public static final OcrSkillLanguage KU_ARAB = fromString("ku-arab"); + + /** + * Kurdish (Latin). + */ + @Generated + public static final OcrSkillLanguage KU_LATN = fromString("ku-latn"); + + /** + * Kurukh (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage KRU = fromString("kru"); + + /** + * Kyrgyz (Cyrillic). + */ + @Generated + public static final OcrSkillLanguage KY = fromString("ky"); + + /** + * Lakota. + */ + @Generated + public static final OcrSkillLanguage LKT = fromString("lkt"); + + /** + * Latin. + */ + @Generated + public static final OcrSkillLanguage LA = fromString("la"); + + /** + * Lithuanian. + */ + @Generated + public static final OcrSkillLanguage LT = fromString("lt"); + + /** + * Lower Sorbian. + */ + @Generated + public static final OcrSkillLanguage DSB = fromString("dsb"); + + /** + * Lule Sami. + */ + @Generated + public static final OcrSkillLanguage SMJ = fromString("smj"); + + /** + * Luxembourgish. + */ + @Generated + public static final OcrSkillLanguage LB = fromString("lb"); + + /** + * Mahasu Pahari (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage BFZ = fromString("bfz"); + + /** + * Malay (Latin). + */ + @Generated + public static final OcrSkillLanguage MS = fromString("ms"); + + /** + * Maltese. + */ + @Generated + public static final OcrSkillLanguage MT = fromString("mt"); + + /** + * Malto (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage KMJ = fromString("kmj"); + + /** + * Manx. + */ + @Generated + public static final OcrSkillLanguage GV = fromString("gv"); + + /** + * Maori. + */ + @Generated + public static final OcrSkillLanguage MI = fromString("mi"); + + /** + * Marathi. + */ + @Generated + public static final OcrSkillLanguage MR = fromString("mr"); + + /** + * Mongolian (Cyrillic). + */ + @Generated + public static final OcrSkillLanguage MN = fromString("mn"); + + /** + * Montenegrin (Cyrillic). + */ + @Generated + public static final OcrSkillLanguage CNR_CYRL = fromString("cnr-cyrl"); + + /** + * Montenegrin (Latin). + */ + @Generated + public static final OcrSkillLanguage CNR_LATN = fromString("cnr-latn"); + + /** + * Neapolitan. + */ + @Generated + public static final OcrSkillLanguage NAP = fromString("nap"); + + /** + * Nepali. + */ + @Generated + public static final OcrSkillLanguage NE = fromString("ne"); + + /** + * Niuean. + */ + @Generated + public static final OcrSkillLanguage NIU = fromString("niu"); + + /** + * Nogay. + */ + @Generated + public static final OcrSkillLanguage NOG = fromString("nog"); + + /** + * Northern Sami (Latin). + */ + @Generated + public static final OcrSkillLanguage SME = fromString("sme"); + + /** + * Norwegian. + */ + @Generated + public static final OcrSkillLanguage NB = fromString("nb"); + + /** + * Norwegian. + */ + @Generated + public static final OcrSkillLanguage NO = fromString("no"); + + /** + * Occitan. + */ + @Generated + public static final OcrSkillLanguage OC = fromString("oc"); + + /** + * Ossetic. + */ + @Generated + public static final OcrSkillLanguage OS = fromString("os"); + + /** + * Pashto. + */ + @Generated + public static final OcrSkillLanguage PS = fromString("ps"); + + /** + * Persian. + */ + @Generated + public static final OcrSkillLanguage FA = fromString("fa"); + + /** + * Polish. + */ + @Generated + public static final OcrSkillLanguage PL = fromString("pl"); + + /** + * Portuguese. + */ + @Generated + public static final OcrSkillLanguage PT = fromString("pt"); + + /** + * Punjabi (Arabic). + */ + @Generated + public static final OcrSkillLanguage PA = fromString("pa"); + + /** + * Ripuarian. + */ + @Generated + public static final OcrSkillLanguage KSH = fromString("ksh"); + + /** + * Romanian. + */ + @Generated + public static final OcrSkillLanguage RO = fromString("ro"); + + /** + * Romansh. + */ + @Generated + public static final OcrSkillLanguage RM = fromString("rm"); + + /** + * Russian. + */ + @Generated + public static final OcrSkillLanguage RU = fromString("ru"); + + /** + * Sadri (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage SCK = fromString("sck"); + + /** + * Samoan (Latin). + */ + @Generated + public static final OcrSkillLanguage SM = fromString("sm"); + + /** + * Sanskrit (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage SA = fromString("sa"); + + /** + * Santali (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage SAT = fromString("sat"); + + /** + * Scots. + */ + @Generated + public static final OcrSkillLanguage SCO = fromString("sco"); + + /** + * Scottish Gaelic. + */ + @Generated + public static final OcrSkillLanguage GD = fromString("gd"); + + /** + * Serbian (Latin). + */ + @Generated + public static final OcrSkillLanguage SR = fromString("sr"); + + /** + * Serbian (Cyrillic). + */ + @Generated + public static final OcrSkillLanguage SR_CYRL = fromString("sr-Cyrl"); + + /** + * Serbian (Latin). + */ + @Generated + public static final OcrSkillLanguage SR_LATN = fromString("sr-Latn"); + + /** + * Sherpa (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage XSR = fromString("xsr"); + + /** + * Sirmauri (Devanagiri). + */ + @Generated + public static final OcrSkillLanguage SRX = fromString("srx"); + + /** + * Skolt Sami. + */ + @Generated + public static final OcrSkillLanguage SMS = fromString("sms"); + + /** + * Slovak. + */ + @Generated + public static final OcrSkillLanguage SK = fromString("sk"); + + /** + * Slovenian. + */ + @Generated + public static final OcrSkillLanguage SL = fromString("sl"); + + /** + * Somali (Arabic). + */ + @Generated + public static final OcrSkillLanguage SO = fromString("so"); + + /** + * Southern Sami. + */ + @Generated + public static final OcrSkillLanguage SMA = fromString("sma"); + + /** + * Spanish. + */ + @Generated + public static final OcrSkillLanguage ES = fromString("es"); + + /** + * Swahili (Latin). + */ + @Generated + public static final OcrSkillLanguage SW = fromString("sw"); + + /** + * Swedish. + */ + @Generated + public static final OcrSkillLanguage SV = fromString("sv"); + + /** + * Tajik (Cyrillic). + */ + @Generated + public static final OcrSkillLanguage TG = fromString("tg"); + + /** + * Tatar (Latin). + */ + @Generated + public static final OcrSkillLanguage TT = fromString("tt"); + + /** + * Tetum. + */ + @Generated + public static final OcrSkillLanguage TET = fromString("tet"); + + /** + * Thangmi. + */ + @Generated + public static final OcrSkillLanguage THF = fromString("thf"); + + /** + * Tongan. + */ + @Generated + public static final OcrSkillLanguage TO = fromString("to"); + + /** + * Turkish. + */ + @Generated + public static final OcrSkillLanguage TR = fromString("tr"); + + /** + * Turkmen (Latin). + */ + @Generated + public static final OcrSkillLanguage TK = fromString("tk"); + + /** + * Tuvan. + */ + @Generated + public static final OcrSkillLanguage TYV = fromString("tyv"); + + /** + * Upper Sorbian. + */ + @Generated + public static final OcrSkillLanguage HSB = fromString("hsb"); + + /** + * Urdu. + */ + @Generated + public static final OcrSkillLanguage UR = fromString("ur"); + + /** + * Uyghur (Arabic). + */ + @Generated + public static final OcrSkillLanguage UG = fromString("ug"); + + /** + * Uzbek (Arabic). + */ + @Generated + public static final OcrSkillLanguage UZ_ARAB = fromString("uz-arab"); + + /** + * Uzbek (Cyrillic). + */ + @Generated + public static final OcrSkillLanguage UZ_CYRL = fromString("uz-cyrl"); + + /** + * Uzbek (Latin). + */ + @Generated + public static final OcrSkillLanguage UZ = fromString("uz"); + + /** + * Volapük. + */ + @Generated + public static final OcrSkillLanguage VO = fromString("vo"); + + /** + * Walser. + */ + @Generated + public static final OcrSkillLanguage WAE = fromString("wae"); + + /** + * Welsh. + */ + @Generated + public static final OcrSkillLanguage CY = fromString("cy"); + + /** + * Western Frisian. + */ + @Generated + public static final OcrSkillLanguage FY = fromString("fy"); + + /** + * Yucatec Maya. + */ + @Generated + public static final OcrSkillLanguage YUA = fromString("yua"); + + /** + * Zhuang. + */ + @Generated + public static final OcrSkillLanguage ZA = fromString("za"); + + /** + * Zulu. + */ + @Generated + public static final OcrSkillLanguage ZU = fromString("zu"); + + /** + * Unknown (All). + */ + @Generated + public static final OcrSkillLanguage UNK = fromString("unk"); + + /** + * Creates a new instance of OcrSkillLanguage value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public OcrSkillLanguage() { + } + + /** + * Creates or finds a OcrSkillLanguage from its string representation. + * + * @param name a name to look for. + * @return the corresponding OcrSkillLanguage. + */ + @Generated + public static OcrSkillLanguage fromString(String name) { + return fromString(name, OcrSkillLanguage.class); + } + + /** + * Gets known OcrSkillLanguage values. + * + * @return known OcrSkillLanguage values. + */ + @Generated + public static Collection values() { + return values(OcrSkillLanguage.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/OutputFieldMappingEntry.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/OutputFieldMappingEntry.java new file mode 100644 index 000000000000..40357085a2fe --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/OutputFieldMappingEntry.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Output field mapping for a skill. + */ +@Fluent +public final class OutputFieldMappingEntry implements JsonSerializable { + /* + * The name of the output defined by the skill. + */ + @Generated + private String name; + + /* + * The target name of the output. It is optional and default to name. + */ + @Generated + private String targetName; + + /** + * Creates an instance of OutputFieldMappingEntry class. + */ + @Generated + public OutputFieldMappingEntry() { + } + + /** + * Get the name property: The name of the output defined by the skill. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the output defined by the skill. + * + * @param name the name value to set. + * @return the OutputFieldMappingEntry object itself. + */ + @Generated + public OutputFieldMappingEntry setName(String name) { + this.name = name; + return this; + } + + /** + * Get the targetName property: The target name of the output. It is optional and default to name. + * + * @return the targetName value. + */ + @Generated + public String getTargetName() { + return this.targetName; + } + + /** + * Set the targetName property: The target name of the output. It is optional and default to name. + * + * @param targetName the targetName value to set. + * @return the OutputFieldMappingEntry object itself. + */ + @Generated + public OutputFieldMappingEntry setTargetName(String targetName) { + this.targetName = targetName; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("targetName", this.targetName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OutputFieldMappingEntry from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OutputFieldMappingEntry 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 OutputFieldMappingEntry. + */ + @Generated + public static OutputFieldMappingEntry fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OutputFieldMappingEntry deserializedOutputFieldMappingEntry = new OutputFieldMappingEntry(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOutputFieldMappingEntry.name = reader.getString(); + } else if ("targetName".equals(fieldName)) { + deserializedOutputFieldMappingEntry.targetName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOutputFieldMappingEntry; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PIIDetectionSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PIIDetectionSkill.java new file mode 100644 index 000000000000..d200cdd56356 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PIIDetectionSkill.java @@ -0,0 +1,391 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Using the Text Analytics API, extracts personal information from an input text and gives you the option of masking + * it. + */ +@Fluent +public final class PIIDetectionSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Text.PIIDetectionSkill"; + + /* + * A value indicating which language code to use. Default is `en`. + */ + @Generated + private String defaultLanguageCode; + + /* + * A value between 0 and 1 that be used to only include entities whose confidence score is greater than the value + * specified. If not set (default), or if explicitly set to null, all entities will be included. + */ + @Generated + private Double minimumPrecision; + + /* + * A parameter that provides various ways to mask the personal information detected in the input text. Default is + * 'none'. + */ + @Generated + private PIIDetectionSkillMaskingMode maskingMode; + + /* + * The character used to mask the text if the maskingMode parameter is set to replace. Default is '*'. + */ + @Generated + private String mask; + + /* + * The version of the model to use when calling the Text Analytics service. It will default to the latest available + * when not specified. We recommend you do not specify this value unless absolutely necessary. + */ + @Generated + private String modelVersion; + + /* + * A list of PII entity categories that should be extracted and masked. + */ + @Generated + private List piiCategories; + + /* + * If specified, will set the PII domain to include only a subset of the entity categories. Possible values include: + * 'phi', 'none'. Default is 'none'. + */ + @Generated + private String domain; + + /** + * Creates an instance of PIIDetectionSkill class. + */ + @Generated + public PIIDetectionSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @return the defaultLanguageCode value. + */ + @Generated + public String getDefaultLanguageCode() { + return this.defaultLanguageCode; + } + + /** + * Set the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @param defaultLanguageCode the defaultLanguageCode value to set. + * @return the PIIDetectionSkill object itself. + */ + @Generated + public PIIDetectionSkill setDefaultLanguageCode(String defaultLanguageCode) { + this.defaultLanguageCode = defaultLanguageCode; + return this; + } + + /** + * Get the minimumPrecision property: A value between 0 and 1 that be used to only include entities whose confidence + * score is greater than the value specified. If not set (default), or if explicitly set to null, all entities will + * be included. + * + * @return the minimumPrecision value. + */ + @Generated + public Double getMinimumPrecision() { + return this.minimumPrecision; + } + + /** + * Set the minimumPrecision property: A value between 0 and 1 that be used to only include entities whose confidence + * score is greater than the value specified. If not set (default), or if explicitly set to null, all entities will + * be included. + * + * @param minimumPrecision the minimumPrecision value to set. + * @return the PIIDetectionSkill object itself. + */ + @Generated + public PIIDetectionSkill setMinimumPrecision(Double minimumPrecision) { + this.minimumPrecision = minimumPrecision; + return this; + } + + /** + * Get the maskingMode property: A parameter that provides various ways to mask the personal information detected in + * the input text. Default is 'none'. + * + * @return the maskingMode value. + */ + @Generated + public PIIDetectionSkillMaskingMode getMaskingMode() { + return this.maskingMode; + } + + /** + * Set the maskingMode property: A parameter that provides various ways to mask the personal information detected in + * the input text. Default is 'none'. + * + * @param maskingMode the maskingMode value to set. + * @return the PIIDetectionSkill object itself. + */ + @Generated + public PIIDetectionSkill setMaskingMode(PIIDetectionSkillMaskingMode maskingMode) { + this.maskingMode = maskingMode; + return this; + } + + /** + * Get the mask property: The character used to mask the text if the maskingMode parameter is set to replace. + * Default is '*'. + * + * @return the mask value. + */ + @Generated + public String getMask() { + return this.mask; + } + + /** + * Set the mask property: The character used to mask the text if the maskingMode parameter is set to replace. + * Default is '*'. + * + * @param mask the mask value to set. + * @return the PIIDetectionSkill object itself. + */ + @Generated + public PIIDetectionSkill setMask(String mask) { + this.mask = mask; + return this; + } + + /** + * Get the modelVersion property: The version of the model to use when calling the Text Analytics service. It will + * default to the latest available when not specified. We recommend you do not specify this value unless absolutely + * necessary. + * + * @return the modelVersion value. + */ + @Generated + public String getModelVersion() { + return this.modelVersion; + } + + /** + * Set the modelVersion property: The version of the model to use when calling the Text Analytics service. It will + * default to the latest available when not specified. We recommend you do not specify this value unless absolutely + * necessary. + * + * @param modelVersion the modelVersion value to set. + * @return the PIIDetectionSkill object itself. + */ + @Generated + public PIIDetectionSkill setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + return this; + } + + /** + * Get the piiCategories property: A list of PII entity categories that should be extracted and masked. + * + * @return the piiCategories value. + */ + @Generated + public List getPiiCategories() { + return this.piiCategories; + } + + /** + * Set the piiCategories property: A list of PII entity categories that should be extracted and masked. + * + * @param piiCategories the piiCategories value to set. + * @return the PIIDetectionSkill object itself. + */ + @Generated + public PIIDetectionSkill setPiiCategories(List piiCategories) { + this.piiCategories = piiCategories; + return this; + } + + /** + * Get the domain property: If specified, will set the PII domain to include only a subset of the entity categories. + * Possible values include: 'phi', 'none'. Default is 'none'. + * + * @return the domain value. + */ + @Generated + public String getDomain() { + return this.domain; + } + + /** + * Set the domain property: If specified, will set the PII domain to include only a subset of the entity categories. + * Possible values include: 'phi', 'none'. Default is 'none'. + * + * @param domain the domain value to set. + * @return the PIIDetectionSkill object itself. + */ + @Generated + public PIIDetectionSkill setDomain(String domain) { + this.domain = domain; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public PIIDetectionSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public PIIDetectionSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public PIIDetectionSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public PIIDetectionSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public PIIDetectionSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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("defaultLanguageCode", this.defaultLanguageCode); + jsonWriter.writeNumberField("minimumPrecision", this.minimumPrecision); + jsonWriter.writeStringField("maskingMode", this.maskingMode == null ? null : this.maskingMode.toString()); + jsonWriter.writeStringField("maskingCharacter", this.mask); + jsonWriter.writeStringField("modelVersion", this.modelVersion); + jsonWriter.writeArrayField("piiCategories", this.piiCategories, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("domain", this.domain); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PIIDetectionSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PIIDetectionSkill 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 PIIDetectionSkill. + */ + @Generated + public static PIIDetectionSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PIIDetectionSkill deserializedPIIDetectionSkill = new PIIDetectionSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedPIIDetectionSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedPIIDetectionSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedPIIDetectionSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedPIIDetectionSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedPIIDetectionSkill.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedPIIDetectionSkill.odataType = reader.getString(); + } else if ("defaultLanguageCode".equals(fieldName)) { + deserializedPIIDetectionSkill.defaultLanguageCode = reader.getString(); + } else if ("minimumPrecision".equals(fieldName)) { + deserializedPIIDetectionSkill.minimumPrecision = reader.getNullable(JsonReader::getDouble); + } else if ("maskingMode".equals(fieldName)) { + deserializedPIIDetectionSkill.maskingMode + = PIIDetectionSkillMaskingMode.fromString(reader.getString()); + } else if ("maskingCharacter".equals(fieldName)) { + deserializedPIIDetectionSkill.mask = reader.getString(); + } else if ("modelVersion".equals(fieldName)) { + deserializedPIIDetectionSkill.modelVersion = reader.getString(); + } else if ("piiCategories".equals(fieldName)) { + List piiCategories = reader.readArray(reader1 -> reader1.getString()); + deserializedPIIDetectionSkill.piiCategories = piiCategories; + } else if ("domain".equals(fieldName)) { + deserializedPIIDetectionSkill.domain = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPIIDetectionSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PIIDetectionSkillMaskingMode.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PIIDetectionSkillMaskingMode.java new file mode 100644 index 000000000000..e616c44c210c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PIIDetectionSkillMaskingMode.java @@ -0,0 +1,60 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * A string indicating what maskingMode to use to mask the personal information detected in the input text. + */ +public final class PIIDetectionSkillMaskingMode extends ExpandableStringEnum { + /** + * No masking occurs and the maskedText output will not be returned. + */ + @Generated + public static final PIIDetectionSkillMaskingMode NONE = fromString("none"); + + /** + * Replaces the detected entities with the character given in the maskingCharacter parameter. The character will be + * repeated to the length of the detected entity so that the offsets will correctly correspond to both the input + * text as well as the output maskedText. + */ + @Generated + public static final PIIDetectionSkillMaskingMode REPLACE = fromString("replace"); + + /** + * Creates a new instance of PIIDetectionSkillMaskingMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public PIIDetectionSkillMaskingMode() { + } + + /** + * Creates or finds a PIIDetectionSkillMaskingMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding PIIDetectionSkillMaskingMode. + */ + @Generated + public static PIIDetectionSkillMaskingMode fromString(String name) { + return fromString(name, PIIDetectionSkillMaskingMode.class); + } + + /** + * Gets known PIIDetectionSkillMaskingMode values. + * + * @return known PIIDetectionSkillMaskingMode values. + */ + @Generated + public static Collection values() { + return values(PIIDetectionSkillMaskingMode.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PathHierarchyTokenizerV2.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PathHierarchyTokenizerV2.java new file mode 100644 index 000000000000..5bd34f51faec --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PathHierarchyTokenizerV2.java @@ -0,0 +1,255 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Objects; + +/** + * Tokenizer for path-like hierarchies. This tokenizer is implemented using Apache Lucene. + */ +@Fluent +public final class PathHierarchyTokenizerV2 extends LexicalTokenizer { + /* + * A URI fragment specifying the type of tokenizer. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.PathHierarchyTokenizerV2"; + + /* + * The delimiter character to use. Default is "/". + */ + @Generated + private Character delimiter; + + /* + * A value that, if set, replaces the delimiter character. Default is "/". + */ + @Generated + private Character replacement; + + /* + * The maximum token length. Default and maximum is 300. + */ + @Generated + private Integer maxTokenLength; + + /* + * A value indicating whether to generate tokens in reverse order. Default is false. + */ + @Generated + private Boolean reverseTokenOrder; + + /* + * The number of initial tokens to skip. Default is 0. + */ + @Generated + private Integer numberOfTokensToSkip; + + /** + * Creates an instance of PathHierarchyTokenizerV2 class. + */ + @Generated + public PathHierarchyTokenizerV2() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of tokenizer. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the delimiter property: The delimiter character to use. Default is "/". + * + * @return the delimiter value. + */ + @Generated + public Character getDelimiter() { + return this.delimiter; + } + + /** + * Set the delimiter property: The delimiter character to use. Default is "/". + * + * @param delimiter the delimiter value to set. + * @return the PathHierarchyTokenizerV2 object itself. + */ + @Generated + public PathHierarchyTokenizerV2 setDelimiter(Character delimiter) { + this.delimiter = delimiter; + return this; + } + + /** + * Get the replacement property: A value that, if set, replaces the delimiter character. Default is "/". + * + * @return the replacement value. + */ + @Generated + public Character getReplacement() { + return this.replacement; + } + + /** + * Set the replacement property: A value that, if set, replaces the delimiter character. Default is "/". + * + * @param replacement the replacement value to set. + * @return the PathHierarchyTokenizerV2 object itself. + */ + @Generated + public PathHierarchyTokenizerV2 setReplacement(Character replacement) { + this.replacement = replacement; + return this; + } + + /** + * Get the maxTokenLength property: The maximum token length. Default and maximum is 300. + * + * @return the maxTokenLength value. + */ + @Generated + public Integer getMaxTokenLength() { + return this.maxTokenLength; + } + + /** + * Set the maxTokenLength property: The maximum token length. Default and maximum is 300. + * + * @param maxTokenLength the maxTokenLength value to set. + * @return the PathHierarchyTokenizerV2 object itself. + */ + @Generated + public PathHierarchyTokenizerV2 setMaxTokenLength(Integer maxTokenLength) { + this.maxTokenLength = maxTokenLength; + return this; + } + + /** + * Get the reverseTokenOrder property: A value indicating whether to generate tokens in reverse order. Default is + * false. + * + * @return the reverseTokenOrder value. + */ + @Generated + public Boolean isReverseTokenOrder() { + return this.reverseTokenOrder; + } + + /** + * Set the reverseTokenOrder property: A value indicating whether to generate tokens in reverse order. Default is + * false. + * + * @param reverseTokenOrder the reverseTokenOrder value to set. + * @return the PathHierarchyTokenizerV2 object itself. + */ + @Generated + public PathHierarchyTokenizerV2 setReverseTokenOrder(Boolean reverseTokenOrder) { + this.reverseTokenOrder = reverseTokenOrder; + return this; + } + + /** + * Get the numberOfTokensToSkip property: The number of initial tokens to skip. Default is 0. + * + * @return the numberOfTokensToSkip value. + */ + @Generated + public Integer getNumberOfTokensToSkip() { + return this.numberOfTokensToSkip; + } + + /** + * Set the numberOfTokensToSkip property: The number of initial tokens to skip. Default is 0. + * + * @param numberOfTokensToSkip the numberOfTokensToSkip value to set. + * @return the PathHierarchyTokenizerV2 object itself. + */ + @Generated + public PathHierarchyTokenizerV2 setNumberOfTokensToSkip(Integer numberOfTokensToSkip) { + this.numberOfTokensToSkip = numberOfTokensToSkip; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public PathHierarchyTokenizerV2 setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeStringField("delimiter", Objects.toString(this.delimiter, null)); + jsonWriter.writeStringField("replacement", Objects.toString(this.replacement, null)); + jsonWriter.writeNumberField("maxTokenLength", this.maxTokenLength); + jsonWriter.writeBooleanField("reverse", this.reverseTokenOrder); + jsonWriter.writeNumberField("skip", this.numberOfTokensToSkip); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PathHierarchyTokenizerV2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PathHierarchyTokenizerV2 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 PathHierarchyTokenizerV2. + */ + @Generated + public static PathHierarchyTokenizerV2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PathHierarchyTokenizerV2 deserializedPathHierarchyTokenizerV2 = new PathHierarchyTokenizerV2(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedPathHierarchyTokenizerV2.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedPathHierarchyTokenizerV2.odataType = reader.getString(); + } else if ("delimiter".equals(fieldName)) { + deserializedPathHierarchyTokenizerV2.delimiter + = reader.getNullable(nonNullReader -> nonNullReader.getString().charAt(0)); + } else if ("replacement".equals(fieldName)) { + deserializedPathHierarchyTokenizerV2.replacement + = reader.getNullable(nonNullReader -> nonNullReader.getString().charAt(0)); + } else if ("maxTokenLength".equals(fieldName)) { + deserializedPathHierarchyTokenizerV2.maxTokenLength = reader.getNullable(JsonReader::getInt); + } else if ("reverse".equals(fieldName)) { + deserializedPathHierarchyTokenizerV2.reverseTokenOrder = reader.getNullable(JsonReader::getBoolean); + } else if ("skip".equals(fieldName)) { + deserializedPathHierarchyTokenizerV2.numberOfTokensToSkip = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedPathHierarchyTokenizerV2; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternAnalyzer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternAnalyzer.java new file mode 100644 index 000000000000..6183b37ad672 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternAnalyzer.java @@ -0,0 +1,225 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Flexibly separates text into terms via a regular expression pattern. This analyzer is implemented using Apache + * Lucene. + */ +@Fluent +public final class PatternAnalyzer extends LexicalAnalyzer { + /* + * A URI fragment specifying the type of analyzer. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.PatternAnalyzer"; + + /* + * A value indicating whether terms should be lower-cased. Default is true. + */ + @Generated + private Boolean lowerCaseTerms; + + /* + * A regular expression pattern to match token separators. Default is an expression that matches one or more + * non-word characters. + */ + @Generated + private String pattern; + + /* + * Regular expression flags. + */ + @Generated + private RegexFlags flags; + + /* + * A list of stopwords. + */ + @Generated + private List stopwords; + + /** + * Creates an instance of PatternAnalyzer class. + */ + @Generated + public PatternAnalyzer() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of analyzer. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the lowerCaseTerms property: A value indicating whether terms should be lower-cased. Default is true. + * + * @return the lowerCaseTerms value. + */ + @Generated + public Boolean isLowerCaseTerms() { + return this.lowerCaseTerms; + } + + /** + * Set the lowerCaseTerms property: A value indicating whether terms should be lower-cased. Default is true. + * + * @param lowerCaseTerms the lowerCaseTerms value to set. + * @return the PatternAnalyzer object itself. + */ + @Generated + public PatternAnalyzer setLowerCaseTerms(Boolean lowerCaseTerms) { + this.lowerCaseTerms = lowerCaseTerms; + return this; + } + + /** + * Get the pattern property: A regular expression pattern to match token separators. Default is an expression that + * matches one or more non-word characters. + * + * @return the pattern value. + */ + @Generated + public String getPattern() { + return this.pattern; + } + + /** + * Set the pattern property: A regular expression pattern to match token separators. Default is an expression that + * matches one or more non-word characters. + * + * @param pattern the pattern value to set. + * @return the PatternAnalyzer object itself. + */ + @Generated + public PatternAnalyzer setPattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Get the flags property: Regular expression flags. + * + * @return the flags value. + */ + @Generated + public RegexFlags getFlags() { + return this.flags; + } + + /** + * Set the flags property: Regular expression flags. + * + * @param flags the flags value to set. + * @return the PatternAnalyzer object itself. + */ + @Generated + public PatternAnalyzer setFlags(RegexFlags flags) { + this.flags = flags; + return this; + } + + /** + * Get the stopwords property: A list of stopwords. + * + * @return the stopwords value. + */ + @Generated + public List getStopwords() { + return this.stopwords; + } + + /** + * Set the stopwords property: A list of stopwords. + * + * @param stopwords the stopwords value to set. + * @return the PatternAnalyzer object itself. + */ + @Generated + public PatternAnalyzer setStopwords(List stopwords) { + this.stopwords = stopwords; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public PatternAnalyzer setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeBooleanField("lowercase", this.lowerCaseTerms); + jsonWriter.writeStringField("pattern", this.pattern); + jsonWriter.writeStringField("flags", this.flags == null ? null : this.flags.toString()); + jsonWriter.writeArrayField("stopwords", this.stopwords, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PatternAnalyzer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PatternAnalyzer 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 PatternAnalyzer. + */ + @Generated + public static PatternAnalyzer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PatternAnalyzer deserializedPatternAnalyzer = new PatternAnalyzer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedPatternAnalyzer.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedPatternAnalyzer.odataType = reader.getString(); + } else if ("lowercase".equals(fieldName)) { + deserializedPatternAnalyzer.lowerCaseTerms = reader.getNullable(JsonReader::getBoolean); + } else if ("pattern".equals(fieldName)) { + deserializedPatternAnalyzer.pattern = reader.getString(); + } else if ("flags".equals(fieldName)) { + deserializedPatternAnalyzer.flags = RegexFlags.fromString(reader.getString()); + } else if ("stopwords".equals(fieldName)) { + List stopwords = reader.readArray(reader1 -> reader1.getString()); + deserializedPatternAnalyzer.stopwords = stopwords; + } else { + reader.skipChildren(); + } + } + + return deserializedPatternAnalyzer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternCaptureTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternCaptureTokenFilter.java new file mode 100644 index 000000000000..25625bd2aa9d --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternCaptureTokenFilter.java @@ -0,0 +1,162 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Uses Java regexes to emit multiple tokens - one for each capture group in one or more patterns. This token filter is + * implemented using Apache Lucene. + */ +@Fluent +public final class PatternCaptureTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.PatternCaptureTokenFilter"; + + /* + * A list of patterns to match against each token. + */ + @Generated + private List patterns; + + /* + * A value indicating whether to return the original token even if one of the patterns matches. Default is true. + */ + @Generated + private Boolean preserveOriginal; + + /** + * Creates an instance of PatternCaptureTokenFilter class. + */ + @Generated + public PatternCaptureTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the patterns property: A list of patterns to match against each token. + * + * @return the patterns value. + */ + @Generated + public List getPatterns() { + return this.patterns; + } + + /** + * Set the patterns property: A list of patterns to match against each token. + * + * @param patterns the patterns value to set. + * @return the PatternCaptureTokenFilter object itself. + */ + @Generated + public PatternCaptureTokenFilter setPatterns(List patterns) { + this.patterns = patterns; + return this; + } + + /** + * Get the preserveOriginal property: A value indicating whether to return the original token even if one of the + * patterns matches. Default is true. + * + * @return the preserveOriginal value. + */ + @Generated + public Boolean isPreserveOriginal() { + return this.preserveOriginal; + } + + /** + * Set the preserveOriginal property: A value indicating whether to return the original token even if one of the + * patterns matches. Default is true. + * + * @param preserveOriginal the preserveOriginal value to set. + * @return the PatternCaptureTokenFilter object itself. + */ + @Generated + public PatternCaptureTokenFilter setPreserveOriginal(Boolean preserveOriginal) { + this.preserveOriginal = preserveOriginal; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public PatternCaptureTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeArrayField("patterns", this.patterns, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeBooleanField("preserveOriginal", this.preserveOriginal); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PatternCaptureTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PatternCaptureTokenFilter 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 PatternCaptureTokenFilter. + */ + @Generated + public static PatternCaptureTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PatternCaptureTokenFilter deserializedPatternCaptureTokenFilter = new PatternCaptureTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedPatternCaptureTokenFilter.setName(reader.getString()); + } else if ("patterns".equals(fieldName)) { + List patterns = reader.readArray(reader1 -> reader1.getString()); + deserializedPatternCaptureTokenFilter.patterns = patterns; + } else if ("@odata.type".equals(fieldName)) { + deserializedPatternCaptureTokenFilter.odataType = reader.getString(); + } else if ("preserveOriginal".equals(fieldName)) { + deserializedPatternCaptureTokenFilter.preserveOriginal = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedPatternCaptureTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternReplaceCharFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternReplaceCharFilter.java new file mode 100644 index 000000000000..e5bb0b88f29a --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternReplaceCharFilter.java @@ -0,0 +1,160 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A character filter that replaces characters in the input string. It uses a regular expression to identify character + * sequences to preserve and a replacement pattern to identify characters to replace. For example, given the input text + * "aa bb aa bb", pattern "(aa)\s+(bb)", and replacement "$1#$2", the result would be "aa#bb aa#bb". This character + * filter is implemented using Apache Lucene. + */ +@Fluent +public final class PatternReplaceCharFilter extends CharFilter { + /* + * A URI fragment specifying the type of char filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.PatternReplaceCharFilter"; + + /* + * A regular expression pattern. + */ + @Generated + private String pattern; + + /* + * The replacement text. + */ + @Generated + private String replacement; + + /** + * Creates an instance of PatternReplaceCharFilter class. + */ + @Generated + public PatternReplaceCharFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of char filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the pattern property: A regular expression pattern. + * + * @return the pattern value. + */ + @Generated + public String getPattern() { + return this.pattern; + } + + /** + * Set the pattern property: A regular expression pattern. + * + * @param pattern the pattern value to set. + * @return the PatternReplaceCharFilter object itself. + */ + @Generated + public PatternReplaceCharFilter setPattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Get the replacement property: The replacement text. + * + * @return the replacement value. + */ + @Generated + public String getReplacement() { + return this.replacement; + } + + /** + * Set the replacement property: The replacement text. + * + * @param replacement the replacement value to set. + * @return the PatternReplaceCharFilter object itself. + */ + @Generated + public PatternReplaceCharFilter setReplacement(String replacement) { + this.replacement = replacement; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public PatternReplaceCharFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("pattern", this.pattern); + jsonWriter.writeStringField("replacement", this.replacement); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PatternReplaceCharFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PatternReplaceCharFilter 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 PatternReplaceCharFilter. + */ + @Generated + public static PatternReplaceCharFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PatternReplaceCharFilter deserializedPatternReplaceCharFilter = new PatternReplaceCharFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedPatternReplaceCharFilter.setName(reader.getString()); + } else if ("pattern".equals(fieldName)) { + deserializedPatternReplaceCharFilter.pattern = reader.getString(); + } else if ("replacement".equals(fieldName)) { + deserializedPatternReplaceCharFilter.replacement = reader.getString(); + } else if ("@odata.type".equals(fieldName)) { + deserializedPatternReplaceCharFilter.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPatternReplaceCharFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternReplaceTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternReplaceTokenFilter.java new file mode 100644 index 000000000000..f2d0576f6bf9 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternReplaceTokenFilter.java @@ -0,0 +1,160 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A character filter that replaces characters in the input string. It uses a regular expression to identify character + * sequences to preserve and a replacement pattern to identify characters to replace. For example, given the input text + * "aa bb aa bb", pattern "(aa)\s+(bb)", and replacement "$1#$2", the result would be "aa#bb aa#bb". This token filter + * is implemented using Apache Lucene. + */ +@Fluent +public final class PatternReplaceTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.PatternReplaceTokenFilter"; + + /* + * A regular expression pattern. + */ + @Generated + private String pattern; + + /* + * The replacement text. + */ + @Generated + private String replacement; + + /** + * Creates an instance of PatternReplaceTokenFilter class. + */ + @Generated + public PatternReplaceTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the pattern property: A regular expression pattern. + * + * @return the pattern value. + */ + @Generated + public String getPattern() { + return this.pattern; + } + + /** + * Set the pattern property: A regular expression pattern. + * + * @param pattern the pattern value to set. + * @return the PatternReplaceTokenFilter object itself. + */ + @Generated + public PatternReplaceTokenFilter setPattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Get the replacement property: The replacement text. + * + * @return the replacement value. + */ + @Generated + public String getReplacement() { + return this.replacement; + } + + /** + * Set the replacement property: The replacement text. + * + * @param replacement the replacement value to set. + * @return the PatternReplaceTokenFilter object itself. + */ + @Generated + public PatternReplaceTokenFilter setReplacement(String replacement) { + this.replacement = replacement; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public PatternReplaceTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("pattern", this.pattern); + jsonWriter.writeStringField("replacement", this.replacement); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PatternReplaceTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PatternReplaceTokenFilter 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 PatternReplaceTokenFilter. + */ + @Generated + public static PatternReplaceTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PatternReplaceTokenFilter deserializedPatternReplaceTokenFilter = new PatternReplaceTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedPatternReplaceTokenFilter.setName(reader.getString()); + } else if ("pattern".equals(fieldName)) { + deserializedPatternReplaceTokenFilter.pattern = reader.getString(); + } else if ("replacement".equals(fieldName)) { + deserializedPatternReplaceTokenFilter.replacement = reader.getString(); + } else if ("@odata.type".equals(fieldName)) { + deserializedPatternReplaceTokenFilter.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPatternReplaceTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternTokenizer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternTokenizer.java new file mode 100644 index 000000000000..eab598afc187 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PatternTokenizer.java @@ -0,0 +1,198 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Tokenizer that uses regex pattern matching to construct distinct tokens. This tokenizer is implemented using Apache + * Lucene. + */ +@Fluent +public final class PatternTokenizer extends LexicalTokenizer { + /* + * A URI fragment specifying the type of tokenizer. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.PatternTokenizer"; + + /* + * A regular expression pattern to match token separators. Default is an expression that matches one or more + * non-word characters. + */ + @Generated + private String pattern; + + /* + * Regular expression flags. + */ + @Generated + private RegexFlags flags; + + /* + * The zero-based ordinal of the matching group in the regular expression pattern to extract into tokens. Use -1 if + * you want to use the entire pattern to split the input into tokens, irrespective of matching groups. Default is + * -1. + */ + @Generated + private Integer group; + + /** + * Creates an instance of PatternTokenizer class. + */ + @Generated + public PatternTokenizer() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of tokenizer. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the pattern property: A regular expression pattern to match token separators. Default is an expression that + * matches one or more non-word characters. + * + * @return the pattern value. + */ + @Generated + public String getPattern() { + return this.pattern; + } + + /** + * Set the pattern property: A regular expression pattern to match token separators. Default is an expression that + * matches one or more non-word characters. + * + * @param pattern the pattern value to set. + * @return the PatternTokenizer object itself. + */ + @Generated + public PatternTokenizer setPattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Get the flags property: Regular expression flags. + * + * @return the flags value. + */ + @Generated + public RegexFlags getFlags() { + return this.flags; + } + + /** + * Set the flags property: Regular expression flags. + * + * @param flags the flags value to set. + * @return the PatternTokenizer object itself. + */ + @Generated + public PatternTokenizer setFlags(RegexFlags flags) { + this.flags = flags; + return this; + } + + /** + * Get the group property: The zero-based ordinal of the matching group in the regular expression pattern to extract + * into tokens. Use -1 if you want to use the entire pattern to split the input into tokens, irrespective of + * matching groups. Default is -1. + * + * @return the group value. + */ + @Generated + public Integer getGroup() { + return this.group; + } + + /** + * Set the group property: The zero-based ordinal of the matching group in the regular expression pattern to extract + * into tokens. Use -1 if you want to use the entire pattern to split the input into tokens, irrespective of + * matching groups. Default is -1. + * + * @param group the group value to set. + * @return the PatternTokenizer object itself. + */ + @Generated + public PatternTokenizer setGroup(Integer group) { + this.group = group; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public PatternTokenizer setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeStringField("pattern", this.pattern); + jsonWriter.writeStringField("flags", this.flags == null ? null : this.flags.toString()); + jsonWriter.writeNumberField("group", this.group); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PatternTokenizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PatternTokenizer 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 PatternTokenizer. + */ + @Generated + public static PatternTokenizer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PatternTokenizer deserializedPatternTokenizer = new PatternTokenizer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedPatternTokenizer.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedPatternTokenizer.odataType = reader.getString(); + } else if ("pattern".equals(fieldName)) { + deserializedPatternTokenizer.pattern = reader.getString(); + } else if ("flags".equals(fieldName)) { + deserializedPatternTokenizer.flags = RegexFlags.fromString(reader.getString()); + } else if ("group".equals(fieldName)) { + deserializedPatternTokenizer.group = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedPatternTokenizer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PermissionFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PermissionFilter.java new file mode 100644 index 000000000000..7e8bdc086a08 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PermissionFilter.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * A value indicating whether the field should be used as a permission filter. + */ +public final class PermissionFilter extends ExpandableStringEnum { + /** + * Field represents user IDs that should be used to filter document access on queries. + */ + @Generated + public static final PermissionFilter USER_IDS = fromString("userIds"); + + /** + * Field represents group IDs that should be used to filter document access on queries. + */ + @Generated + public static final PermissionFilter GROUP_IDS = fromString("groupIds"); + + /** + * Field represents an RBAC scope that should be used to filter document access on queries. + */ + @Generated + public static final PermissionFilter RBAC_SCOPE = fromString("rbacScope"); + + /** + * Creates a new instance of PermissionFilter value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public PermissionFilter() { + } + + /** + * Creates or finds a PermissionFilter from its string representation. + * + * @param name a name to look for. + * @return the corresponding PermissionFilter. + */ + @Generated + public static PermissionFilter fromString(String name) { + return fromString(name, PermissionFilter.class); + } + + /** + * Gets known PermissionFilter values. + * + * @return known PermissionFilter values. + */ + @Generated + public static Collection values() { + return values(PermissionFilter.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PhoneticEncoder.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PhoneticEncoder.java new file mode 100644 index 000000000000..c464d3def466 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PhoneticEncoder.java @@ -0,0 +1,102 @@ +// 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.models; + +/** + * Identifies the type of phonetic encoder to use with a PhoneticTokenFilter. + */ +public enum PhoneticEncoder { + /** + * Encodes a token into a Metaphone value. + */ + METAPHONE("metaphone"), + + /** + * Encodes a token into a double metaphone value. + */ + DOUBLE_METAPHONE("doubleMetaphone"), + + /** + * Encodes a token into a Soundex value. + */ + SOUNDEX("soundex"), + + /** + * Encodes a token into a Refined Soundex value. + */ + REFINED_SOUNDEX("refinedSoundex"), + + /** + * Encodes a token into a Caverphone 1.0 value. + */ + CAVERPHONE1("caverphone1"), + + /** + * Encodes a token into a Caverphone 2.0 value. + */ + CAVERPHONE2("caverphone2"), + + /** + * Encodes a token into a Cologne Phonetic value. + */ + COLOGNE("cologne"), + + /** + * Encodes a token into a NYSIIS value. + */ + NYSIIS("nysiis"), + + /** + * Encodes a token using the Kölner Phonetik algorithm. + */ + KOELNER_PHONETIK("koelnerPhonetik"), + + /** + * Encodes a token using the Haase refinement of the Kölner Phonetik algorithm. + */ + HAASE_PHONETIK("haasePhonetik"), + + /** + * Encodes a token into a Beider-Morse value. + */ + BEIDER_MORSE("beiderMorse"); + + /** + * The actual serialized value for a PhoneticEncoder instance. + */ + private final String value; + + PhoneticEncoder(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PhoneticEncoder instance. + * + * @param value the serialized value to parse. + * @return the parsed PhoneticEncoder object, or null if unable to parse. + */ + public static PhoneticEncoder fromString(String value) { + if (value == null) { + return null; + } + PhoneticEncoder[] items = PhoneticEncoder.values(); + for (PhoneticEncoder item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PhoneticTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PhoneticTokenFilter.java new file mode 100644 index 000000000000..e345fc571c6b --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/PhoneticTokenFilter.java @@ -0,0 +1,160 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Create tokens for phonetic matches. This token filter is implemented using Apache Lucene. + */ +@Fluent +public final class PhoneticTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.PhoneticTokenFilter"; + + /* + * The phonetic encoder to use. Default is "metaphone". + */ + @Generated + private PhoneticEncoder encoder; + + /* + * A value indicating whether encoded tokens should replace original tokens. If false, encoded tokens are added as + * synonyms. Default is true. + */ + @Generated + private Boolean replaceOriginalTokens; + + /** + * Creates an instance of PhoneticTokenFilter class. + */ + @Generated + public PhoneticTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the encoder property: The phonetic encoder to use. Default is "metaphone". + * + * @return the encoder value. + */ + @Generated + public PhoneticEncoder getEncoder() { + return this.encoder; + } + + /** + * Set the encoder property: The phonetic encoder to use. Default is "metaphone". + * + * @param encoder the encoder value to set. + * @return the PhoneticTokenFilter object itself. + */ + @Generated + public PhoneticTokenFilter setEncoder(PhoneticEncoder encoder) { + this.encoder = encoder; + return this; + } + + /** + * Get the replaceOriginalTokens property: A value indicating whether encoded tokens should replace original tokens. + * If false, encoded tokens are added as synonyms. Default is true. + * + * @return the replaceOriginalTokens value. + */ + @Generated + public Boolean isReplaceOriginalTokens() { + return this.replaceOriginalTokens; + } + + /** + * Set the replaceOriginalTokens property: A value indicating whether encoded tokens should replace original tokens. + * If false, encoded tokens are added as synonyms. Default is true. + * + * @param replaceOriginalTokens the replaceOriginalTokens value to set. + * @return the PhoneticTokenFilter object itself. + */ + @Generated + public PhoneticTokenFilter setReplaceOriginalTokens(Boolean replaceOriginalTokens) { + this.replaceOriginalTokens = replaceOriginalTokens; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public PhoneticTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeStringField("encoder", this.encoder == null ? null : this.encoder.toString()); + jsonWriter.writeBooleanField("replace", this.replaceOriginalTokens); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PhoneticTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PhoneticTokenFilter 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 PhoneticTokenFilter. + */ + @Generated + public static PhoneticTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PhoneticTokenFilter deserializedPhoneticTokenFilter = new PhoneticTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedPhoneticTokenFilter.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedPhoneticTokenFilter.odataType = reader.getString(); + } else if ("encoder".equals(fieldName)) { + deserializedPhoneticTokenFilter.encoder = PhoneticEncoder.fromString(reader.getString()); + } else if ("replace".equals(fieldName)) { + deserializedPhoneticTokenFilter.replaceOriginalTokens = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedPhoneticTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryAnswerResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryAnswerResult.java new file mode 100644 index 000000000000..8d8337241047 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryAnswerResult.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.LinkedHashMap; +import java.util.Map; + +/** + * An answer is a text passage extracted from the contents of the most relevant documents that matched the query. + * Answers are extracted from the top search results. Answer candidates are scored and the top answers are selected. + */ +@Fluent +public final class QueryAnswerResult implements JsonSerializable { + /* + * The score value represents how relevant the answer is to the query relative to other answers returned for the + * query. + */ + @Generated + private Double score; + + /* + * The key of the document the answer was extracted from. + */ + @Generated + private String key; + + /* + * The text passage extracted from the document contents as the answer. + */ + @Generated + private String text; + + /* + * Same text passage as in the Text property with highlighted text phrases most relevant to the query. + */ + @Generated + private String highlights; + + /* + * An answer is a text passage extracted from the contents of the most relevant documents that matched the query. + * Answers are extracted from the top search results. Answer candidates are scored and the top answers are selected. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of QueryAnswerResult class. + */ + @Generated + public QueryAnswerResult() { + } + + /** + * Get the score property: The score value represents how relevant the answer is to the query relative to other + * answers returned for the query. + * + * @return the score value. + */ + @Generated + public Double getScore() { + return this.score; + } + + /** + * Get the key property: The key of the document the answer was extracted from. + * + * @return the key value. + */ + @Generated + public String getKey() { + return this.key; + } + + /** + * Get the text property: The text passage extracted from the document contents as the answer. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Get the highlights property: Same text passage as in the Text property with highlighted text phrases most + * relevant to the query. + * + * @return the highlights value. + */ + @Generated + public String getHighlights() { + return this.highlights; + } + + /** + * Get the additionalProperties property: An answer is a text passage extracted from the contents of the most + * relevant documents that matched the query. Answers are extracted from the top search results. Answer candidates + * are scored and the top answers are selected. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: An answer is a text passage extracted from the contents of the most + * relevant documents that matched the query. Answers are extracted from the top search results. Answer candidates + * are scored and the top answers are selected. + * + * @param additionalProperties the additionalProperties value to set. + * @return the QueryAnswerResult object itself. + */ + @Generated + public QueryAnswerResult setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of QueryAnswerResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of QueryAnswerResult 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 QueryAnswerResult. + */ + @Generated + public static QueryAnswerResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + QueryAnswerResult deserializedQueryAnswerResult = new QueryAnswerResult(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("score".equals(fieldName)) { + deserializedQueryAnswerResult.score = reader.getNullable(JsonReader::getDouble); + } else if ("key".equals(fieldName)) { + deserializedQueryAnswerResult.key = reader.getString(); + } else if ("text".equals(fieldName)) { + deserializedQueryAnswerResult.text = reader.getString(); + } else if ("highlights".equals(fieldName)) { + deserializedQueryAnswerResult.highlights = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedQueryAnswerResult.additionalProperties = additionalProperties; + + return deserializedQueryAnswerResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryAnswerType.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryAnswerType.java new file mode 100644 index 000000000000..f82edeb6c447 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryAnswerType.java @@ -0,0 +1,66 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * This parameter is only valid if the query type is `semantic`. If set, the query returns answers extracted from key + * passages in the highest ranked documents. The number of answers returned can be configured by appending the pipe + * character `|` followed by the `count-<number of answers>` option after the answers parameter value, such as + * `extractive|count-3`. Default count is 1. The confidence threshold can be configured by appending the pipe character + * `|` followed by the `threshold-<confidence threshold>` option after the answers parameter value, such as + * `extractive|threshold-0.9`. Default threshold is 0.7. The maximum character length of answers can be configured by + * appending the pipe character '|' followed by the 'count-<number of maximum character length>', such as + * 'extractive|maxcharlength-600'. + */ +public final class QueryAnswerType extends ExpandableStringEnum { + /** + * Do not return answers for the query. + */ + @Generated + public static final QueryAnswerType NONE = fromString("none"); + + /** + * Extracts answer candidates from the contents of the documents returned in response to a query expressed as a + * question in natural language. + */ + @Generated + public static final QueryAnswerType EXTRACTIVE = fromString("extractive"); + + /** + * Creates a new instance of QueryAnswerType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public QueryAnswerType() { + } + + /** + * Creates or finds a QueryAnswerType from its string representation. + * + * @param name a name to look for. + * @return the corresponding QueryAnswerType. + */ + @Generated + public static QueryAnswerType fromString(String name) { + return fromString(name, QueryAnswerType.class); + } + + /** + * Gets known QueryAnswerType values. + * + * @return known QueryAnswerType values. + */ + @Generated + public static Collection values() { + return values(QueryAnswerType.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryCaptionResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryCaptionResult.java new file mode 100644 index 000000000000..0923c17a2b65 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryCaptionResult.java @@ -0,0 +1,147 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.LinkedHashMap; +import java.util.Map; + +/** + * Captions are the most representative passages from the document relatively to the search query. They are often used + * as document summary. Captions are only returned for queries of type `semantic`. + */ +@Fluent +public final class QueryCaptionResult implements JsonSerializable { + /* + * A representative text passage extracted from the document most relevant to the search query. + */ + @Generated + private String text; + + /* + * Same text passage as in the Text property with highlighted phrases most relevant to the query. + */ + @Generated + private String highlights; + + /* + * Captions are the most representative passages from the document relatively to the search query. They are often + * used as document summary. Captions are only returned for queries of type `semantic`. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of QueryCaptionResult class. + */ + @Generated + public QueryCaptionResult() { + } + + /** + * Get the text property: A representative text passage extracted from the document most relevant to the search + * query. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Get the highlights property: Same text passage as in the Text property with highlighted phrases most relevant to + * the query. + * + * @return the highlights value. + */ + @Generated + public String getHighlights() { + return this.highlights; + } + + /** + * Get the additionalProperties property: Captions are the most representative passages from the document relatively + * to the search query. They are often used as document summary. Captions are only returned for queries of type + * `semantic`. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: Captions are the most representative passages from the document relatively + * to the search query. They are often used as document summary. Captions are only returned for queries of type + * `semantic`. + * + * @param additionalProperties the additionalProperties value to set. + * @return the QueryCaptionResult object itself. + */ + @Generated + public QueryCaptionResult setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of QueryCaptionResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of QueryCaptionResult 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 QueryCaptionResult. + */ + @Generated + public static QueryCaptionResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + QueryCaptionResult deserializedQueryCaptionResult = new QueryCaptionResult(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("text".equals(fieldName)) { + deserializedQueryCaptionResult.text = reader.getString(); + } else if ("highlights".equals(fieldName)) { + deserializedQueryCaptionResult.highlights = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedQueryCaptionResult.additionalProperties = additionalProperties; + + return deserializedQueryCaptionResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryCaptionType.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryCaptionType.java new file mode 100644 index 000000000000..490461160c26 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryCaptionType.java @@ -0,0 +1,63 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * This parameter is only valid if the query type is `semantic`. If set, the query returns captions extracted from key + * passages in the highest ranked documents. When Captions is set to `extractive`, highlighting is enabled by default, + * and can be configured by appending the pipe character `|` followed by the `highlight-<true/false>` option, such + * as `extractive|highlight-true`. Defaults to `None`. The maximum character length of captions can be configured by + * appending the pipe character '|' followed by the 'count-<number of maximum character length>', such as + * 'extractive|maxcharlength-600'. + */ +public final class QueryCaptionType extends ExpandableStringEnum { + /** + * Do not return captions for the query. + */ + @Generated + public static final QueryCaptionType NONE = fromString("none"); + + /** + * Extracts captions from the matching documents that contain passages relevant to the search query. + */ + @Generated + public static final QueryCaptionType EXTRACTIVE = fromString("extractive"); + + /** + * Creates a new instance of QueryCaptionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public QueryCaptionType() { + } + + /** + * Creates or finds a QueryCaptionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding QueryCaptionType. + */ + @Generated + public static QueryCaptionType fromString(String name) { + return fromString(name, QueryCaptionType.class); + } + + /** + * Gets known QueryCaptionType values. + * + * @return known QueryCaptionType values. + */ + @Generated + public static Collection values() { + return values(QueryCaptionType.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryDebugMode.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryDebugMode.java new file mode 100644 index 000000000000..6956396c290b --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryDebugMode.java @@ -0,0 +1,83 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enables a debugging tool that can be used to further explore your search results. You can enable multiple debug modes + * simultaneously by separating them with a | character, for example: semantic|queryRewrites. + */ +public final class QueryDebugMode extends ExpandableStringEnum { + /** + * No query debugging information will be returned. + */ + @Generated + public static final QueryDebugMode DISABLED = fromString("disabled"); + + /** + * Allows the user to further explore their reranked results. + */ + @Generated + public static final QueryDebugMode SEMANTIC = fromString("semantic"); + + /** + * Allows the user to further explore their hybrid and vector query results. + */ + @Generated + public static final QueryDebugMode VECTOR = fromString("vector"); + + /** + * Allows the user to explore the list of query rewrites generated for their search request. + */ + @Generated + public static final QueryDebugMode QUERY_REWRITES = fromString("queryRewrites"); + + /** + * Allows the user to retrieve scoring information regarding vectors matched within a collection of complex types. + */ + @Generated + public static final QueryDebugMode INNER_HITS = fromString("innerHits"); + + /** + * Turn on all debug options. + */ + @Generated + public static final QueryDebugMode ALL = fromString("all"); + + /** + * Creates a new instance of QueryDebugMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public QueryDebugMode() { + } + + /** + * Creates or finds a QueryDebugMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding QueryDebugMode. + */ + @Generated + public static QueryDebugMode fromString(String name) { + return fromString(name, QueryDebugMode.class); + } + + /** + * Gets known QueryDebugMode values. + * + * @return known QueryDebugMode values. + */ + @Generated + public static Collection values() { + return values(QueryDebugMode.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryLanguage.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryLanguage.java new file mode 100644 index 000000000000..757f7a8c3bc3 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryLanguage.java @@ -0,0 +1,478 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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. + */ + @Generated + public static final QueryLanguage NONE = fromString("none"); + + /** + * Query language value for English (United States). + */ + @Generated + public static final QueryLanguage EN_US = fromString("en-us"); + + /** + * Query language value for English (Great Britain). + */ + @Generated + public static final QueryLanguage EN_GB = fromString("en-gb"); + + /** + * Query language value for English (India). + */ + @Generated + public static final QueryLanguage EN_IN = fromString("en-in"); + + /** + * Query language value for English (Canada). + */ + @Generated + public static final QueryLanguage EN_CA = fromString("en-ca"); + + /** + * Query language value for English (Australia). + */ + @Generated + public static final QueryLanguage EN_AU = fromString("en-au"); + + /** + * Query language value for French (France). + */ + @Generated + public static final QueryLanguage FR_FR = fromString("fr-fr"); + + /** + * Query language value for French (Canada). + */ + @Generated + public static final QueryLanguage FR_CA = fromString("fr-ca"); + + /** + * Query language value for German (Germany). + */ + @Generated + public static final QueryLanguage DE_DE = fromString("de-de"); + + /** + * Query language value for Spanish (Spain). + */ + @Generated + public static final QueryLanguage ES_ES = fromString("es-es"); + + /** + * Query language value for Spanish (Mexico). + */ + @Generated + public static final QueryLanguage ES_MX = fromString("es-mx"); + + /** + * Query language value for Chinese (China). + */ + @Generated + public static final QueryLanguage ZH_CN = fromString("zh-cn"); + + /** + * Query language value for Chinese (Taiwan). + */ + @Generated + public static final QueryLanguage ZH_TW = fromString("zh-tw"); + + /** + * Query language value for Portuguese (Brazil). + */ + @Generated + public static final QueryLanguage PT_BR = fromString("pt-br"); + + /** + * Query language value for Portuguese (Portugal). + */ + @Generated + public static final QueryLanguage PT_PT = fromString("pt-pt"); + + /** + * Query language value for Italian (Italy). + */ + @Generated + public static final QueryLanguage IT_IT = fromString("it-it"); + + /** + * Query language value for Japanese (Japan). + */ + @Generated + public static final QueryLanguage JA_JP = fromString("ja-jp"); + + /** + * Query language value for Korean (Korea). + */ + @Generated + public static final QueryLanguage KO_KR = fromString("ko-kr"); + + /** + * Query language value for Russian (Russia). + */ + @Generated + public static final QueryLanguage RU_RU = fromString("ru-ru"); + + /** + * Query language value for Czech (Czech Republic). + */ + @Generated + public static final QueryLanguage CS_CZ = fromString("cs-cz"); + + /** + * Query language value for Dutch (Belgium). + */ + @Generated + public static final QueryLanguage NL_BE = fromString("nl-be"); + + /** + * Query language value for Dutch (Netherlands). + */ + @Generated + public static final QueryLanguage NL_NL = fromString("nl-nl"); + + /** + * Query language value for Hungarian (Hungary). + */ + @Generated + public static final QueryLanguage HU_HU = fromString("hu-hu"); + + /** + * Query language value for Polish (Poland). + */ + @Generated + public static final QueryLanguage PL_PL = fromString("pl-pl"); + + /** + * Query language value for Swedish (Sweden). + */ + @Generated + public static final QueryLanguage SV_SE = fromString("sv-se"); + + /** + * Query language value for Turkish (Turkey). + */ + @Generated + public static final QueryLanguage TR_TR = fromString("tr-tr"); + + /** + * Query language value for Hindi (India). + */ + @Generated + public static final QueryLanguage HI_IN = fromString("hi-in"); + + /** + * Query language value for Arabic (Saudi Arabia). + */ + @Generated + public static final QueryLanguage AR_SA = fromString("ar-sa"); + + /** + * Query language value for Arabic (Egypt). + */ + @Generated + public static final QueryLanguage AR_EG = fromString("ar-eg"); + + /** + * Query language value for Arabic (Morocco). + */ + @Generated + public static final QueryLanguage AR_MA = fromString("ar-ma"); + + /** + * Query language value for Arabic (Kuwait). + */ + @Generated + public static final QueryLanguage AR_KW = fromString("ar-kw"); + + /** + * Query language value for Arabic (Jordan). + */ + @Generated + public static final QueryLanguage AR_JO = fromString("ar-jo"); + + /** + * Query language value for Danish (Denmark). + */ + @Generated + public static final QueryLanguage DA_DK = fromString("da-dk"); + + /** + * Query language value for Norwegian (Norway). + */ + @Generated + public static final QueryLanguage NO_NO = fromString("no-no"); + + /** + * Query language value for Bulgarian (Bulgaria). + */ + @Generated + public static final QueryLanguage BG_BG = fromString("bg-bg"); + + /** + * Query language value for Croatian (Croatia). + */ + @Generated + public static final QueryLanguage HR_HR = fromString("hr-hr"); + + /** + * Query language value for Croatian (Bosnia and Herzegovina). + */ + @Generated + public static final QueryLanguage HR_BA = fromString("hr-ba"); + + /** + * Query language value for Malay (Malaysia). + */ + @Generated + public static final QueryLanguage MS_MY = fromString("ms-my"); + + /** + * Query language value for Malay (Brunei Darussalam). + */ + @Generated + public static final QueryLanguage MS_BN = fromString("ms-bn"); + + /** + * Query language value for Slovenian (Slovenia). + */ + @Generated + public static final QueryLanguage SL_SL = fromString("sl-sl"); + + /** + * Query language value for Tamil (India). + */ + @Generated + public static final QueryLanguage TA_IN = fromString("ta-in"); + + /** + * Query language value for Vietnamese (Viet Nam). + */ + @Generated + public static final QueryLanguage VI_VN = fromString("vi-vn"); + + /** + * Query language value for Greek (Greece). + */ + @Generated + public static final QueryLanguage EL_GR = fromString("el-gr"); + + /** + * Query language value for Romanian (Romania). + */ + @Generated + public static final QueryLanguage RO_RO = fromString("ro-ro"); + + /** + * Query language value for Icelandic (Iceland). + */ + @Generated + public static final QueryLanguage IS_IS = fromString("is-is"); + + /** + * Query language value for Indonesian (Indonesia). + */ + @Generated + public static final QueryLanguage ID_ID = fromString("id-id"); + + /** + * Query language value for Thai (Thailand). + */ + @Generated + public static final QueryLanguage TH_TH = fromString("th-th"); + + /** + * Query language value for Lithuanian (Lithuania). + */ + @Generated + public static final QueryLanguage LT_LT = fromString("lt-lt"); + + /** + * Query language value for Ukrainian (Ukraine). + */ + @Generated + public static final QueryLanguage UK_UA = fromString("uk-ua"); + + /** + * Query language value for Latvian (Latvia). + */ + @Generated + public static final QueryLanguage LV_LV = fromString("lv-lv"); + + /** + * Query language value for Estonian (Estonia). + */ + @Generated + public static final QueryLanguage ET_EE = fromString("et-ee"); + + /** + * Query language value for Catalan. + */ + @Generated + public static final QueryLanguage CA_ES = fromString("ca-es"); + + /** + * Query language value for Finnish (Finland). + */ + @Generated + public static final QueryLanguage FI_FI = fromString("fi-fi"); + + /** + * Query language value for Serbian (Bosnia and Herzegovina). + */ + @Generated + public static final QueryLanguage SR_BA = fromString("sr-ba"); + + /** + * Query language value for Serbian (Montenegro). + */ + @Generated + public static final QueryLanguage SR_ME = fromString("sr-me"); + + /** + * Query language value for Serbian (Serbia). + */ + @Generated + public static final QueryLanguage SR_RS = fromString("sr-rs"); + + /** + * Query language value for Slovak (Slovakia). + */ + @Generated + public static final QueryLanguage SK_SK = fromString("sk-sk"); + + /** + * Query language value for Norwegian (Norway). + */ + @Generated + public static final QueryLanguage NB_NO = fromString("nb-no"); + + /** + * Query language value for Armenian (Armenia). + */ + @Generated + public static final QueryLanguage HY_AM = fromString("hy-am"); + + /** + * Query language value for Bengali (India). + */ + @Generated + public static final QueryLanguage BN_IN = fromString("bn-in"); + + /** + * Query language value for Basque. + */ + @Generated + public static final QueryLanguage EU_ES = fromString("eu-es"); + + /** + * Query language value for Galician. + */ + @Generated + public static final QueryLanguage GL_ES = fromString("gl-es"); + + /** + * Query language value for Gujarati (India). + */ + @Generated + public static final QueryLanguage GU_IN = fromString("gu-in"); + + /** + * Query language value for Hebrew (Israel). + */ + @Generated + public static final QueryLanguage HE_IL = fromString("he-il"); + + /** + * Query language value for Irish (Ireland). + */ + @Generated + public static final QueryLanguage GA_IE = fromString("ga-ie"); + + /** + * Query language value for Kannada (India). + */ + @Generated + public static final QueryLanguage KN_IN = fromString("kn-in"); + + /** + * Query language value for Malayalam (India). + */ + @Generated + public static final QueryLanguage ML_IN = fromString("ml-in"); + + /** + * Query language value for Marathi (India). + */ + @Generated + public static final QueryLanguage MR_IN = fromString("mr-in"); + + /** + * Query language value for Persian (U.A.E.). + */ + @Generated + public static final QueryLanguage FA_AE = fromString("fa-ae"); + + /** + * Query language value for Punjabi (India). + */ + @Generated + public static final QueryLanguage PA_IN = fromString("pa-in"); + + /** + * Query language value for Telugu (India). + */ + @Generated + public static final QueryLanguage TE_IN = fromString("te-in"); + + /** + * Query language value for Urdu (Pakistan). + */ + @Generated + public static final QueryLanguage UR_PK = fromString("ur-pk"); + + /** + * Creates a new instance of QueryLanguage value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public QueryLanguage() { + } + + /** + * Creates or finds a QueryLanguage from its string representation. + * + * @param name a name to look for. + * @return the corresponding QueryLanguage. + */ + @Generated + public static QueryLanguage fromString(String name) { + return fromString(name, QueryLanguage.class); + } + + /** + * Gets known QueryLanguage values. + * + * @return known QueryLanguage values. + */ + @Generated + public static Collection values() { + return values(QueryLanguage.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryResultDocumentInnerHit.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryResultDocumentInnerHit.java new file mode 100644 index 000000000000..8abd0b043991 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryResultDocumentInnerHit.java @@ -0,0 +1,104 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Detailed scoring information for an individual element of a complex collection. + */ +@Immutable +public final class QueryResultDocumentInnerHit implements JsonSerializable { + /* + * Position of this specific matching element within it's original collection. Position starts at 0. + */ + @Generated + private Long ordinal; + + /* + * Detailed scoring information for an individual element of a complex collection that matched a vector query. + */ + @Generated + private List> vectors; + + /** + * Creates an instance of QueryResultDocumentInnerHit class. + */ + @Generated + public QueryResultDocumentInnerHit() { + } + + /** + * Get the ordinal property: Position of this specific matching element within it's original collection. Position + * starts at 0. + * + * @return the ordinal value. + */ + @Generated + public Long getOrdinal() { + return this.ordinal; + } + + /** + * Get the vectors property: Detailed scoring information for an individual element of a complex collection that + * matched a vector query. + * + * @return the vectors value. + */ + @Generated + public List> getVectors() { + return this.vectors; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of QueryResultDocumentInnerHit from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of QueryResultDocumentInnerHit 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 QueryResultDocumentInnerHit. + */ + @Generated + public static QueryResultDocumentInnerHit fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + QueryResultDocumentInnerHit deserializedQueryResultDocumentInnerHit = new QueryResultDocumentInnerHit(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ordinal".equals(fieldName)) { + deserializedQueryResultDocumentInnerHit.ordinal = reader.getNullable(JsonReader::getLong); + } else if ("vectors".equals(fieldName)) { + List> vectors = reader + .readArray(reader1 -> reader1.readMap(reader2 -> SingleVectorFieldResult.fromJson(reader2))); + deserializedQueryResultDocumentInnerHit.vectors = vectors; + } else { + reader.skipChildren(); + } + } + + return deserializedQueryResultDocumentInnerHit; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryResultDocumentRerankerInput.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryResultDocumentRerankerInput.java new file mode 100644 index 000000000000..3c4885865343 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryResultDocumentRerankerInput.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.models; + +import com.azure.core.annotation.Generated; +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. + */ + @Generated + private String title; + + /* + * The raw concatenated strings for the content fields that were used for semantic enrichment. + */ + @Generated + private String content; + + /* + * The raw concatenated strings for the keyword fields that were used for semantic enrichment. + */ + @Generated + private String keywords; + + /** + * Creates an instance of QueryResultDocumentRerankerInput class. + */ + @Generated + public QueryResultDocumentRerankerInput() { + } + + /** + * Get the title property: The raw string for the title field that was used for semantic enrichment. + * + * @return the title value. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + public String getKeywords() { + return this.keywords; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + 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/search/src/main/java/com/azure/search/models/QueryResultDocumentSemanticField.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryResultDocumentSemanticField.java new file mode 100644 index 000000000000..93646d70f07a --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryResultDocumentSemanticField.java @@ -0,0 +1,101 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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 + */ + @Generated + private String name; + + /* + * The way the field was used for the semantic enrichment process (fully used, partially used, or unused) + */ + @Generated + private SemanticFieldState state; + + /** + * Creates an instance of QueryResultDocumentSemanticField class. + */ + @Generated + public QueryResultDocumentSemanticField() { + } + + /** + * Get the name property: The name of the field that was sent to the semantic enrichment process. + * + * @return the name value. + */ + @Generated + 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. + */ + @Generated + public SemanticFieldState getState() { + return this.state; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + 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/search/src/main/java/com/azure/search/models/QueryResultDocumentSubscores.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryResultDocumentSubscores.java new file mode 100644 index 000000000000..0d2f0f05a52c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryResultDocumentSubscores.java @@ -0,0 +1,121 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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. + */ + @Generated + private TextResult text; + + /* + * The vector similarity and @search.score values for each vector query. + */ + @Generated + private List> vectors; + + /* + * The BM25 or Classic score for the text portion of the query. + */ + @Generated + private Double documentBoost; + + /** + * Creates an instance of QueryResultDocumentSubscores class. + */ + @Generated + public QueryResultDocumentSubscores() { + } + + /** + * Get the text property: The BM25 or Classic score for the text portion of the query. + * + * @return the text value. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + public Double getDocumentBoost() { + return this.documentBoost; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + 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/search/src/main/java/com/azure/search/models/QueryRewritesDebugInfo.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryRewritesDebugInfo.java new file mode 100644 index 000000000000..91c5b1875657 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryRewritesDebugInfo.java @@ -0,0 +1,101 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Contains debugging information specific to query rewrites. + */ +@Immutable +public final class QueryRewritesDebugInfo implements JsonSerializable { + /* + * List of query rewrites generated for the text query. + */ + @Generated + private QueryRewritesValuesDebugInfo text; + + /* + * List of query rewrites generated for the vectorizable text queries. + */ + @Generated + private List vectors; + + /** + * Creates an instance of QueryRewritesDebugInfo class. + */ + @Generated + public QueryRewritesDebugInfo() { + } + + /** + * Get the text property: List of query rewrites generated for the text query. + * + * @return the text value. + */ + @Generated + public QueryRewritesValuesDebugInfo getText() { + return this.text; + } + + /** + * Get the vectors property: List of query rewrites generated for the vectorizable text queries. + * + * @return the vectors value. + */ + @Generated + public List getVectors() { + return this.vectors; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of QueryRewritesDebugInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of QueryRewritesDebugInfo 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 QueryRewritesDebugInfo. + */ + @Generated + public static QueryRewritesDebugInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + QueryRewritesDebugInfo deserializedQueryRewritesDebugInfo = new QueryRewritesDebugInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("text".equals(fieldName)) { + deserializedQueryRewritesDebugInfo.text = QueryRewritesValuesDebugInfo.fromJson(reader); + } else if ("vectors".equals(fieldName)) { + List vectors + = reader.readArray(reader1 -> QueryRewritesValuesDebugInfo.fromJson(reader1)); + deserializedQueryRewritesDebugInfo.vectors = vectors; + } else { + reader.skipChildren(); + } + } + + return deserializedQueryRewritesDebugInfo; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryRewritesType.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryRewritesType.java new file mode 100644 index 000000000000..8defe5e951e5 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryRewritesType.java @@ -0,0 +1,61 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * This parameter is only valid if the query type is `semantic`. When QueryRewrites is set to `generative`, the query + * terms are sent to a generate model which will produce 10 (default) rewrites to help increase the recall of the + * request. The requested count can be configured by appending the pipe character `|` followed by the `count-<number + * of rewrites>` option, such as `generative|count-3`. Defaults to `None`. + */ +public final class QueryRewritesType extends ExpandableStringEnum { + /** + * Do not generate additional query rewrites for this query. + */ + @Generated + public static final QueryRewritesType NONE = fromString("none"); + + /** + * Generate alternative query terms to increase the recall of a search request. + */ + @Generated + public static final QueryRewritesType GENERATIVE = fromString("generative"); + + /** + * Creates a new instance of QueryRewritesType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public QueryRewritesType() { + } + + /** + * Creates or finds a QueryRewritesType from its string representation. + * + * @param name a name to look for. + * @return the corresponding QueryRewritesType. + */ + @Generated + public static QueryRewritesType fromString(String name) { + return fromString(name, QueryRewritesType.class); + } + + /** + * Gets known QueryRewritesType values. + * + * @return known QueryRewritesType values. + */ + @Generated + public static Collection values() { + return values(QueryRewritesType.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryRewritesValuesDebugInfo.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryRewritesValuesDebugInfo.java new file mode 100644 index 000000000000..0ab2d603c5a1 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryRewritesValuesDebugInfo.java @@ -0,0 +1,102 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Contains debugging information specific to query rewrites. + */ +@Immutable +public final class QueryRewritesValuesDebugInfo implements JsonSerializable { + /* + * The input text to the generative query rewriting model. There may be cases where the user query and the input to + * the generative model are not identical. + */ + @Generated + private String inputQuery; + + /* + * List of query rewrites. + */ + @Generated + private List rewrites; + + /** + * Creates an instance of QueryRewritesValuesDebugInfo class. + */ + @Generated + public QueryRewritesValuesDebugInfo() { + } + + /** + * Get the inputQuery property: The input text to the generative query rewriting model. There may be cases where the + * user query and the input to the generative model are not identical. + * + * @return the inputQuery value. + */ + @Generated + public String getInputQuery() { + return this.inputQuery; + } + + /** + * Get the rewrites property: List of query rewrites. + * + * @return the rewrites value. + */ + @Generated + public List getRewrites() { + return this.rewrites; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of QueryRewritesValuesDebugInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of QueryRewritesValuesDebugInfo 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 QueryRewritesValuesDebugInfo. + */ + @Generated + public static QueryRewritesValuesDebugInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + QueryRewritesValuesDebugInfo deserializedQueryRewritesValuesDebugInfo = new QueryRewritesValuesDebugInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputQuery".equals(fieldName)) { + deserializedQueryRewritesValuesDebugInfo.inputQuery = reader.getString(); + } else if ("rewrites".equals(fieldName)) { + List rewrites = reader.readArray(reader1 -> reader1.getString()); + deserializedQueryRewritesValuesDebugInfo.rewrites = rewrites; + } else { + reader.skipChildren(); + } + } + + return deserializedQueryRewritesValuesDebugInfo; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QuerySpellerType.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QuerySpellerType.java new file mode 100644 index 000000000000..90265bd4fb5e --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QuerySpellerType.java @@ -0,0 +1,59 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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. + */ + @Generated + public static final QuerySpellerType NONE = fromString("none"); + + /** + * Speller corrects individual query terms using a static lexicon for the language specified by the queryLanguage + * parameter. + */ + @Generated + public static final QuerySpellerType LEXICON = fromString("lexicon"); + + /** + * Creates a new instance of QuerySpellerType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public QuerySpellerType() { + } + + /** + * Creates or finds a QuerySpellerType from its string representation. + * + * @param name a name to look for. + * @return the corresponding QuerySpellerType. + */ + @Generated + public static QuerySpellerType fromString(String name) { + return fromString(name, QuerySpellerType.class); + } + + /** + * Gets known QuerySpellerType values. + * + * @return known QuerySpellerType values. + */ + @Generated + public static Collection values() { + return values(QuerySpellerType.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryType.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryType.java new file mode 100644 index 000000000000..6d58756de4af --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/QueryType.java @@ -0,0 +1,67 @@ +// 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.models; + +/** + * Specifies the syntax of the search query. The default is 'simple'. Use 'full' if your query uses the Lucene query + * syntax and 'semantic' if query syntax is not needed. + */ +public enum QueryType { + /** + * Uses the simple query syntax for searches. Search text is interpreted using a simple query language that allows + * for symbols such as +, * and "". Queries are evaluated across all searchable fields by default, unless the + * searchFields parameter is specified. + */ + SIMPLE("simple"), + + /** + * Uses the full Lucene query syntax for searches. Search text is interpreted using the Lucene query language which + * allows field-specific and weighted searches, as well as other advanced features. + */ + FULL("full"), + + /** + * Best suited for queries expressed in natural language as opposed to keywords. Improves precision of search + * results by re-ranking the top search results using a ranking model trained on the Web corpus. + */ + SEMANTIC("semantic"); + + /** + * The actual serialized value for a QueryType instance. + */ + private final String value; + + QueryType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a QueryType instance. + * + * @param value the serialized value to parse. + * @return the parsed QueryType object, or null if unable to parse. + */ + public static QueryType fromString(String value) { + if (value == null) { + return null; + } + QueryType[] items = QueryType.values(); + for (QueryType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RankingOrder.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RankingOrder.java new file mode 100644 index 000000000000..0e3c2082b12a --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RankingOrder.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Represents score to use for sort order of documents. + */ +public final class RankingOrder extends ExpandableStringEnum { + /** + * Sets sort order as BoostedRerankerScore. + */ + @Generated + public static final RankingOrder BOOSTED_RERANKER_SCORE = fromString("BoostedRerankerScore"); + + /** + * Sets sort order as ReRankerScore. + */ + @Generated + public static final RankingOrder RE_RANKER_SCORE = fromString("RerankerScore"); + + /** + * Creates a new instance of RankingOrder value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public RankingOrder() { + } + + /** + * Creates or finds a RankingOrder from its string representation. + * + * @param name a name to look for. + * @return the corresponding RankingOrder. + */ + @Generated + public static RankingOrder fromString(String name) { + return fromString(name, RankingOrder.class); + } + + /** + * Gets known RankingOrder values. + * + * @return known RankingOrder values. + */ + @Generated + public static Collection values() { + return values(RankingOrder.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RegexFlags.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RegexFlags.java new file mode 100644 index 000000000000..4546ffd49323 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RegexFlags.java @@ -0,0 +1,95 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines flags that can be combined to control how regular expressions are used in the pattern analyzer and pattern + * tokenizer. + */ +public final class RegexFlags extends ExpandableStringEnum { + /** + * Enables canonical equivalence. + */ + @Generated + public static final RegexFlags CANON_EQ = fromString("CANON_EQ"); + + /** + * Enables case-insensitive matching. + */ + @Generated + public static final RegexFlags CASE_INSENSITIVE = fromString("CASE_INSENSITIVE"); + + /** + * Permits whitespace and comments in the pattern. + */ + @Generated + public static final RegexFlags COMMENTS = fromString("COMMENTS"); + + /** + * Enables dotall mode. + */ + @Generated + public static final RegexFlags DOT_ALL = fromString("DOTALL"); + + /** + * Enables literal parsing of the pattern. + */ + @Generated + public static final RegexFlags LITERAL = fromString("LITERAL"); + + /** + * Enables multiline mode. + */ + @Generated + public static final RegexFlags MULTILINE = fromString("MULTILINE"); + + /** + * Enables Unicode-aware case folding. + */ + @Generated + public static final RegexFlags UNICODE_CASE = fromString("UNICODE_CASE"); + + /** + * Enables Unix lines mode. + */ + @Generated + public static final RegexFlags UNIX_LINES = fromString("UNIX_LINES"); + + /** + * Creates a new instance of RegexFlags value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public RegexFlags() { + } + + /** + * Creates or finds a RegexFlags from its string representation. + * + * @param name a name to look for. + * @return the corresponding RegexFlags. + */ + @Generated + public static RegexFlags fromString(String name) { + return fromString(name, RegexFlags.class); + } + + /** + * Gets known RegexFlags values. + * + * @return known RegexFlags values. + */ + @Generated + public static Collection values() { + return values(RegexFlags.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RemoteSharePointKnowledgeSource.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RemoteSharePointKnowledgeSource.java new file mode 100644 index 000000000000..21b6dcf9cf57 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RemoteSharePointKnowledgeSource.java @@ -0,0 +1,170 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Configuration for remote SharePoint knowledge source. + */ +@Fluent +public final class RemoteSharePointKnowledgeSource extends KnowledgeSource { + /* + * The type of the knowledge source. + */ + @Generated + private KnowledgeSourceKind kind = KnowledgeSourceKind.REMOTE_SHARE_POINT; + + /* + * The parameters for the knowledge source. + */ + @Generated + private RemoteSharePointKnowledgeSourceParameters remoteSharePointParameters; + + /** + * Creates an instance of RemoteSharePointKnowledgeSource class. + */ + @Generated + public RemoteSharePointKnowledgeSource() { + } + + /** + * Get the kind property: The type of the knowledge source. + * + * @return the kind value. + */ + @Generated + @Override + public KnowledgeSourceKind getKind() { + return this.kind; + } + + /** + * Get the remoteSharePointParameters property: The parameters for the knowledge source. + * + * @return the remoteSharePointParameters value. + */ + @Generated + public RemoteSharePointKnowledgeSourceParameters getRemoteSharePointParameters() { + return this.remoteSharePointParameters; + } + + /** + * Set the remoteSharePointParameters property: The parameters for the knowledge source. + * + * @param remoteSharePointParameters the remoteSharePointParameters value to set. + * @return the RemoteSharePointKnowledgeSource object itself. + */ + @Generated + public RemoteSharePointKnowledgeSource + setRemoteSharePointParameters(RemoteSharePointKnowledgeSourceParameters remoteSharePointParameters) { + this.remoteSharePointParameters = remoteSharePointParameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public RemoteSharePointKnowledgeSource setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public RemoteSharePointKnowledgeSource setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public RemoteSharePointKnowledgeSource setETag(String eTag) { + super.setETag(eTag); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public RemoteSharePointKnowledgeSource setEncryptionKey(SearchResourceEncryptionKey encryptionKey) { + super.setEncryptionKey(encryptionKey); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("description", getDescription()); + jsonWriter.writeStringField("@odata.etag", getETag()); + jsonWriter.writeJsonField("encryptionKey", getEncryptionKey()); + jsonWriter.writeJsonField("remoteSharePointParameters", this.remoteSharePointParameters); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RemoteSharePointKnowledgeSource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RemoteSharePointKnowledgeSource 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 RemoteSharePointKnowledgeSource. + */ + @Generated + public static RemoteSharePointKnowledgeSource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RemoteSharePointKnowledgeSource deserializedRemoteSharePointKnowledgeSource + = new RemoteSharePointKnowledgeSource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedRemoteSharePointKnowledgeSource.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedRemoteSharePointKnowledgeSource.setDescription(reader.getString()); + } else if ("@odata.etag".equals(fieldName)) { + deserializedRemoteSharePointKnowledgeSource.setETag(reader.getString()); + } else if ("encryptionKey".equals(fieldName)) { + deserializedRemoteSharePointKnowledgeSource + .setEncryptionKey(SearchResourceEncryptionKey.fromJson(reader)); + } else if ("remoteSharePointParameters".equals(fieldName)) { + deserializedRemoteSharePointKnowledgeSource.remoteSharePointParameters + = RemoteSharePointKnowledgeSourceParameters.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedRemoteSharePointKnowledgeSource.kind + = KnowledgeSourceKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedRemoteSharePointKnowledgeSource; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RemoteSharePointKnowledgeSourceParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RemoteSharePointKnowledgeSourceParameters.java new file mode 100644 index 000000000000..6f24e6ede7cc --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RemoteSharePointKnowledgeSourceParameters.java @@ -0,0 +1,171 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Parameters for remote SharePoint knowledge source. + */ +@Fluent +public final class RemoteSharePointKnowledgeSourceParameters + implements JsonSerializable { + /* + * Keyword Query Language (KQL) expression with queryable SharePoint properties and attributes to scope the + * retrieval before the query runs. See documentation: + * https://learn.microsoft.com/en-us/sharepoint/dev/general-development/keyword-query-language-kql-syntax-reference + */ + @Generated + private String filterExpression; + + /* + * A list of metadata fields to be returned for each item in the response. Only retrievable metadata properties can + * be included in this list. By default, no metadata is returned. Optional. + */ + @Generated + private List resourceMetadata; + + /* + * Container ID for SharePoint Embedded connection. When this is null, it will use SharePoint Online. + */ + @Generated + private String containerTypeId; + + /** + * Creates an instance of RemoteSharePointKnowledgeSourceParameters class. + */ + @Generated + public RemoteSharePointKnowledgeSourceParameters() { + } + + /** + * Get the filterExpression property: Keyword Query Language (KQL) expression with queryable SharePoint properties + * and attributes to scope the retrieval before the query runs. See documentation: + * https://learn.microsoft.com/en-us/sharepoint/dev/general-development/keyword-query-language-kql-syntax-reference. + * + * @return the filterExpression value. + */ + @Generated + public String getFilterExpression() { + return this.filterExpression; + } + + /** + * Set the filterExpression property: Keyword Query Language (KQL) expression with queryable SharePoint properties + * and attributes to scope the retrieval before the query runs. See documentation: + * https://learn.microsoft.com/en-us/sharepoint/dev/general-development/keyword-query-language-kql-syntax-reference. + * + * @param filterExpression the filterExpression value to set. + * @return the RemoteSharePointKnowledgeSourceParameters object itself. + */ + @Generated + public RemoteSharePointKnowledgeSourceParameters setFilterExpression(String filterExpression) { + this.filterExpression = filterExpression; + return this; + } + + /** + * Get the resourceMetadata property: A list of metadata fields to be returned for each item in the response. Only + * retrievable metadata properties can be included in this list. By default, no metadata is returned. Optional. + * + * @return the resourceMetadata value. + */ + @Generated + public List getResourceMetadata() { + return this.resourceMetadata; + } + + /** + * Set the resourceMetadata property: A list of metadata fields to be returned for each item in the response. Only + * retrievable metadata properties can be included in this list. By default, no metadata is returned. Optional. + * + * @param resourceMetadata the resourceMetadata value to set. + * @return the RemoteSharePointKnowledgeSourceParameters object itself. + */ + @Generated + public RemoteSharePointKnowledgeSourceParameters setResourceMetadata(List resourceMetadata) { + this.resourceMetadata = resourceMetadata; + return this; + } + + /** + * Get the containerTypeId property: Container ID for SharePoint Embedded connection. When this is null, it will use + * SharePoint Online. + * + * @return the containerTypeId value. + */ + @Generated + public String getContainerTypeId() { + return this.containerTypeId; + } + + /** + * Set the containerTypeId property: Container ID for SharePoint Embedded connection. When this is null, it will use + * SharePoint Online. + * + * @param containerTypeId the containerTypeId value to set. + * @return the RemoteSharePointKnowledgeSourceParameters object itself. + */ + @Generated + public RemoteSharePointKnowledgeSourceParameters setContainerTypeId(String containerTypeId) { + this.containerTypeId = containerTypeId; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("filterExpression", this.filterExpression); + jsonWriter.writeArrayField("resourceMetadata", this.resourceMetadata, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("containerTypeId", this.containerTypeId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RemoteSharePointKnowledgeSourceParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RemoteSharePointKnowledgeSourceParameters 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 RemoteSharePointKnowledgeSourceParameters. + */ + @Generated + public static RemoteSharePointKnowledgeSourceParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RemoteSharePointKnowledgeSourceParameters deserializedRemoteSharePointKnowledgeSourceParameters + = new RemoteSharePointKnowledgeSourceParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("filterExpression".equals(fieldName)) { + deserializedRemoteSharePointKnowledgeSourceParameters.filterExpression = reader.getString(); + } else if ("resourceMetadata".equals(fieldName)) { + List resourceMetadata = reader.readArray(reader1 -> reader1.getString()); + deserializedRemoteSharePointKnowledgeSourceParameters.resourceMetadata = resourceMetadata; + } else if ("containerTypeId".equals(fieldName)) { + deserializedRemoteSharePointKnowledgeSourceParameters.containerTypeId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRemoteSharePointKnowledgeSourceParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RemoteSharePointKnowledgeSourceParams.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RemoteSharePointKnowledgeSourceParams.java new file mode 100644 index 000000000000..f37442f672a9 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RemoteSharePointKnowledgeSourceParams.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specifies runtime parameters for a remote SharePoint knowledge source. + */ +@Fluent +public final class RemoteSharePointKnowledgeSourceParams extends KnowledgeSourceParams { + /* + * The type of the knowledge source. + */ + @Generated + private KnowledgeSourceKind kind = KnowledgeSourceKind.REMOTE_SHARE_POINT; + + /* + * A filter condition applied to the SharePoint data source. It must be specified in the Keyword Query Language + * syntax. It will be combined as a conjunction with the filter expression specified in the knowledge source + * definition. + */ + @Generated + private String filterExpressionAddOn; + + /** + * Creates an instance of RemoteSharePointKnowledgeSourceParams class. + */ + @Generated + public RemoteSharePointKnowledgeSourceParams() { + } + + /** + * Get the kind property: The type of the knowledge source. + * + * @return the kind value. + */ + @Generated + @Override + public KnowledgeSourceKind getKind() { + return this.kind; + } + + /** + * Get the filterExpressionAddOn property: A filter condition applied to the SharePoint data source. It must be + * specified in the Keyword Query Language syntax. It will be combined as a conjunction with the filter expression + * specified in the knowledge source definition. + * + * @return the filterExpressionAddOn value. + */ + @Generated + public String getFilterExpressionAddOn() { + return this.filterExpressionAddOn; + } + + /** + * Set the filterExpressionAddOn property: A filter condition applied to the SharePoint data source. It must be + * specified in the Keyword Query Language syntax. It will be combined as a conjunction with the filter expression + * specified in the knowledge source definition. + * + * @param filterExpressionAddOn the filterExpressionAddOn value to set. + * @return the RemoteSharePointKnowledgeSourceParams object itself. + */ + @Generated + public RemoteSharePointKnowledgeSourceParams setFilterExpressionAddOn(String filterExpressionAddOn) { + this.filterExpressionAddOn = filterExpressionAddOn; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public RemoteSharePointKnowledgeSourceParams setKnowledgeSourceName(String knowledgeSourceName) { + super.setKnowledgeSourceName(knowledgeSourceName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public RemoteSharePointKnowledgeSourceParams setIncludeReferences(Boolean includeReferences) { + super.setIncludeReferences(includeReferences); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public RemoteSharePointKnowledgeSourceParams setIncludeReferenceSourceData(Boolean includeReferenceSourceData) { + super.setIncludeReferenceSourceData(includeReferenceSourceData); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public RemoteSharePointKnowledgeSourceParams setAlwaysQuerySource(Boolean alwaysQuerySource) { + super.setAlwaysQuerySource(alwaysQuerySource); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public RemoteSharePointKnowledgeSourceParams setRerankerThreshold(Float rerankerThreshold) { + super.setRerankerThreshold(rerankerThreshold); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("knowledgeSourceName", getKnowledgeSourceName()); + jsonWriter.writeBooleanField("includeReferences", isIncludeReferences()); + jsonWriter.writeBooleanField("includeReferenceSourceData", isIncludeReferenceSourceData()); + jsonWriter.writeBooleanField("alwaysQuerySource", isAlwaysQuerySource()); + jsonWriter.writeNumberField("rerankerThreshold", getRerankerThreshold()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("filterExpressionAddOn", this.filterExpressionAddOn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RemoteSharePointKnowledgeSourceParams from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RemoteSharePointKnowledgeSourceParams 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 RemoteSharePointKnowledgeSourceParams. + */ + @Generated + public static RemoteSharePointKnowledgeSourceParams fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RemoteSharePointKnowledgeSourceParams deserializedRemoteSharePointKnowledgeSourceParams + = new RemoteSharePointKnowledgeSourceParams(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("knowledgeSourceName".equals(fieldName)) { + deserializedRemoteSharePointKnowledgeSourceParams.setKnowledgeSourceName(reader.getString()); + } else if ("includeReferences".equals(fieldName)) { + deserializedRemoteSharePointKnowledgeSourceParams + .setIncludeReferences(reader.getNullable(JsonReader::getBoolean)); + } else if ("includeReferenceSourceData".equals(fieldName)) { + deserializedRemoteSharePointKnowledgeSourceParams + .setIncludeReferenceSourceData(reader.getNullable(JsonReader::getBoolean)); + } else if ("alwaysQuerySource".equals(fieldName)) { + deserializedRemoteSharePointKnowledgeSourceParams + .setAlwaysQuerySource(reader.getNullable(JsonReader::getBoolean)); + } else if ("rerankerThreshold".equals(fieldName)) { + deserializedRemoteSharePointKnowledgeSourceParams + .setRerankerThreshold(reader.getNullable(JsonReader::getFloat)); + } else if ("kind".equals(fieldName)) { + deserializedRemoteSharePointKnowledgeSourceParams.kind + = KnowledgeSourceKind.fromString(reader.getString()); + } else if ("filterExpressionAddOn".equals(fieldName)) { + deserializedRemoteSharePointKnowledgeSourceParams.filterExpressionAddOn = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRemoteSharePointKnowledgeSourceParams; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RequestOptions.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RequestOptions.java new file mode 100644 index 000000000000..afe844f02c9d --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RequestOptions.java @@ -0,0 +1,51 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import java.util.UUID; + +/** + * Parameter group. + */ +@Fluent +public final class RequestOptions { + /* + * The tracking ID sent with the request to help with debugging. + */ + @Generated + private UUID xMsClientRequestId; + + /** + * Creates an instance of RequestOptions class. + */ + @Generated + public RequestOptions() { + } + + /** + * Get the xMsClientRequestId property: The tracking ID sent with the request to help with debugging. + * + * @return the xMsClientRequestId value. + */ + @Generated + public UUID getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The tracking ID sent with the request to help with debugging. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the RequestOptions object itself. + */ + @Generated + public RequestOptions setXMsClientRequestId(UUID xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RescoringOptions.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RescoringOptions.java new file mode 100644 index 000000000000..ec4479e46ff5 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/RescoringOptions.java @@ -0,0 +1,173 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 the options for rescoring. + */ +@Fluent +public final class RescoringOptions implements JsonSerializable { + /* + * If set to true, after the initial search on the compressed vectors, the similarity scores are recalculated using + * the full-precision vectors. This will improve recall at the expense of latency. + */ + @Generated + private Boolean enableRescoring; + + /* + * Default oversampling factor. Oversampling retrieves a greater set of potential documents to offset the resolution + * loss due to quantization. This increases the set of results that will be rescored on full-precision vectors. + * Minimum value is 1, meaning no oversampling (1x). This parameter can only be set when 'enableRescoring' is true. + * Higher values improve recall at the expense of latency. + */ + @Generated + private Double defaultOversampling; + + /* + * Controls the storage method for original vectors. This setting is immutable. + */ + @Generated + private VectorSearchCompressionRescoreStorageMethod rescoreStorageMethod; + + /** + * Creates an instance of RescoringOptions class. + */ + @Generated + public RescoringOptions() { + } + + /** + * Get the enableRescoring property: If set to true, after the initial search on the compressed vectors, the + * similarity scores are recalculated using the full-precision vectors. This will improve recall at the expense of + * latency. + * + * @return the enableRescoring value. + */ + @Generated + public Boolean isEnableRescoring() { + return this.enableRescoring; + } + + /** + * Set the enableRescoring property: If set to true, after the initial search on the compressed vectors, the + * similarity scores are recalculated using the full-precision vectors. This will improve recall at the expense of + * latency. + * + * @param enableRescoring the enableRescoring value to set. + * @return the RescoringOptions object itself. + */ + @Generated + public RescoringOptions setEnableRescoring(Boolean enableRescoring) { + this.enableRescoring = enableRescoring; + return this; + } + + /** + * Get the defaultOversampling property: Default oversampling factor. Oversampling retrieves a greater set of + * potential documents to offset the resolution loss due to quantization. This increases the set of results that + * will be rescored on full-precision vectors. Minimum value is 1, meaning no oversampling (1x). This parameter can + * only be set when 'enableRescoring' is true. Higher values improve recall at the expense of latency. + * + * @return the defaultOversampling value. + */ + @Generated + public Double getDefaultOversampling() { + return this.defaultOversampling; + } + + /** + * Set the defaultOversampling property: Default oversampling factor. Oversampling retrieves a greater set of + * potential documents to offset the resolution loss due to quantization. This increases the set of results that + * will be rescored on full-precision vectors. Minimum value is 1, meaning no oversampling (1x). This parameter can + * only be set when 'enableRescoring' is true. Higher values improve recall at the expense of latency. + * + * @param defaultOversampling the defaultOversampling value to set. + * @return the RescoringOptions object itself. + */ + @Generated + public RescoringOptions setDefaultOversampling(Double defaultOversampling) { + this.defaultOversampling = defaultOversampling; + return this; + } + + /** + * Get the rescoreStorageMethod property: Controls the storage method for original vectors. This setting is + * immutable. + * + * @return the rescoreStorageMethod value. + */ + @Generated + public VectorSearchCompressionRescoreStorageMethod getRescoreStorageMethod() { + return this.rescoreStorageMethod; + } + + /** + * Set the rescoreStorageMethod property: Controls the storage method for original vectors. This setting is + * immutable. + * + * @param rescoreStorageMethod the rescoreStorageMethod value to set. + * @return the RescoringOptions object itself. + */ + @Generated + public RescoringOptions setRescoreStorageMethod(VectorSearchCompressionRescoreStorageMethod rescoreStorageMethod) { + this.rescoreStorageMethod = rescoreStorageMethod; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enableRescoring", this.enableRescoring); + jsonWriter.writeNumberField("defaultOversampling", this.defaultOversampling); + jsonWriter.writeStringField("rescoreStorageMethod", + this.rescoreStorageMethod == null ? null : this.rescoreStorageMethod.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RescoringOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RescoringOptions 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 RescoringOptions. + */ + @Generated + public static RescoringOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RescoringOptions deserializedRescoringOptions = new RescoringOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enableRescoring".equals(fieldName)) { + deserializedRescoringOptions.enableRescoring = reader.getNullable(JsonReader::getBoolean); + } else if ("defaultOversampling".equals(fieldName)) { + deserializedRescoringOptions.defaultOversampling = reader.getNullable(JsonReader::getDouble); + } else if ("rescoreStorageMethod".equals(fieldName)) { + deserializedRescoringOptions.rescoreStorageMethod + = VectorSearchCompressionRescoreStorageMethod.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedRescoringOptions; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ResourceCounter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ResourceCounter.java new file mode 100644 index 000000000000..6ffef8dbecc7 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ResourceCounter.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a resource's usage and quota. + */ +@Fluent +public final class ResourceCounter implements JsonSerializable { + /* + * The resource usage amount. + */ + @Generated + private long usage; + + /* + * The resource amount quota. + */ + @Generated + private Long quota; + + /** + * Creates an instance of ResourceCounter class. + */ + @Generated + public ResourceCounter() { + } + + /** + * Get the usage property: The resource usage amount. + * + * @return the usage value. + */ + @Generated + public long getUsage() { + return this.usage; + } + + /** + * Set the usage property: The resource usage amount. + * + * @param usage the usage value to set. + * @return the ResourceCounter object itself. + */ + @Generated + public ResourceCounter setUsage(long usage) { + this.usage = usage; + return this; + } + + /** + * Get the quota property: The resource amount quota. + * + * @return the quota value. + */ + @Generated + public Long getQuota() { + return this.quota; + } + + /** + * Set the quota property: The resource amount quota. + * + * @param quota the quota value to set. + * @return the ResourceCounter object itself. + */ + @Generated + public ResourceCounter setQuota(Long quota) { + this.quota = quota; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeLongField("usage", this.usage); + jsonWriter.writeNumberField("quota", this.quota); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceCounter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceCounter 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 ResourceCounter. + */ + @Generated + public static ResourceCounter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceCounter deserializedResourceCounter = new ResourceCounter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("usage".equals(fieldName)) { + deserializedResourceCounter.usage = reader.getLong(); + } else if ("quota".equals(fieldName)) { + deserializedResourceCounter.quota = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceCounter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScalarQuantizationCompressionConfiguration.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScalarQuantizationCompressionConfiguration.java new file mode 100644 index 000000000000..ad243c5d6878 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScalarQuantizationCompressionConfiguration.java @@ -0,0 +1,186 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Contains configuration options specific to the scalar quantization compression method used during indexing and + * querying. + */ +@Fluent +public final class ScalarQuantizationCompressionConfiguration extends VectorSearchCompressionConfiguration { + /* + * The name of the kind of compression method being configured for use with vector search. + */ + @Generated + private VectorSearchCompressionKind kind = VectorSearchCompressionKind.SCALAR_QUANTIZATION; + + /* + * Contains the parameters specific to Scalar Quantization. + */ + @Generated + private ScalarQuantizationParameters parameters; + + /** + * Creates an instance of ScalarQuantizationCompressionConfiguration class. + */ + @Generated + public ScalarQuantizationCompressionConfiguration() { + } + + /** + * Get the kind property: The name of the kind of compression method being configured for use with vector search. + * + * @return the kind value. + */ + @Generated + @Override + public VectorSearchCompressionKind getKind() { + return this.kind; + } + + /** + * Get the parameters property: Contains the parameters specific to Scalar Quantization. + * + * @return the parameters value. + */ + @Generated + public ScalarQuantizationParameters getParameters() { + return this.parameters; + } + + /** + * Set the parameters property: Contains the parameters specific to Scalar Quantization. + * + * @param parameters the parameters value to set. + * @return the ScalarQuantizationCompressionConfiguration object itself. + */ + @Generated + public ScalarQuantizationCompressionConfiguration setParameters(ScalarQuantizationParameters parameters) { + this.parameters = parameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ScalarQuantizationCompressionConfiguration setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ScalarQuantizationCompressionConfiguration setRerankWithOriginalVectors(Boolean rerankWithOriginalVectors) { + super.setRerankWithOriginalVectors(rerankWithOriginalVectors); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ScalarQuantizationCompressionConfiguration setDefaultOversampling(Double defaultOversampling) { + super.setDefaultOversampling(defaultOversampling); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ScalarQuantizationCompressionConfiguration setRescoringOptions(RescoringOptions rescoringOptions) { + super.setRescoringOptions(rescoringOptions); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ScalarQuantizationCompressionConfiguration setTruncationDimension(Integer truncationDimension) { + super.setTruncationDimension(truncationDimension); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeBooleanField("rerankWithOriginalVectors", isRerankWithOriginalVectors()); + jsonWriter.writeNumberField("defaultOversampling", getDefaultOversampling()); + jsonWriter.writeJsonField("rescoringOptions", getRescoringOptions()); + jsonWriter.writeNumberField("truncationDimension", getTruncationDimension()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("scalarQuantizationParameters", this.parameters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScalarQuantizationCompressionConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScalarQuantizationCompressionConfiguration 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 ScalarQuantizationCompressionConfiguration. + */ + @Generated + public static ScalarQuantizationCompressionConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScalarQuantizationCompressionConfiguration deserializedScalarQuantizationCompressionConfiguration + = new ScalarQuantizationCompressionConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedScalarQuantizationCompressionConfiguration.setName(reader.getString()); + } else if ("rerankWithOriginalVectors".equals(fieldName)) { + deserializedScalarQuantizationCompressionConfiguration + .setRerankWithOriginalVectors(reader.getNullable(JsonReader::getBoolean)); + } else if ("defaultOversampling".equals(fieldName)) { + deserializedScalarQuantizationCompressionConfiguration + .setDefaultOversampling(reader.getNullable(JsonReader::getDouble)); + } else if ("rescoringOptions".equals(fieldName)) { + deserializedScalarQuantizationCompressionConfiguration + .setRescoringOptions(RescoringOptions.fromJson(reader)); + } else if ("truncationDimension".equals(fieldName)) { + deserializedScalarQuantizationCompressionConfiguration + .setTruncationDimension(reader.getNullable(JsonReader::getInt)); + } else if ("kind".equals(fieldName)) { + deserializedScalarQuantizationCompressionConfiguration.kind + = VectorSearchCompressionKind.fromString(reader.getString()); + } else if ("scalarQuantizationParameters".equals(fieldName)) { + deserializedScalarQuantizationCompressionConfiguration.parameters + = ScalarQuantizationParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedScalarQuantizationCompressionConfiguration; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScalarQuantizationParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScalarQuantizationParameters.java new file mode 100644 index 000000000000..1155b9c60665 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScalarQuantizationParameters.java @@ -0,0 +1,95 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 the parameters specific to Scalar Quantization. + */ +@Fluent +public final class ScalarQuantizationParameters implements JsonSerializable { + /* + * The quantized data type of compressed vector values. + */ + @Generated + private VectorSearchCompressionTargetDataType quantizedDataType; + + /** + * Creates an instance of ScalarQuantizationParameters class. + */ + @Generated + public ScalarQuantizationParameters() { + } + + /** + * Get the quantizedDataType property: The quantized data type of compressed vector values. + * + * @return the quantizedDataType value. + */ + @Generated + public VectorSearchCompressionTargetDataType getQuantizedDataType() { + return this.quantizedDataType; + } + + /** + * Set the quantizedDataType property: The quantized data type of compressed vector values. + * + * @param quantizedDataType the quantizedDataType value to set. + * @return the ScalarQuantizationParameters object itself. + */ + @Generated + public ScalarQuantizationParameters setQuantizedDataType(VectorSearchCompressionTargetDataType quantizedDataType) { + this.quantizedDataType = quantizedDataType; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("quantizedDataType", + this.quantizedDataType == null ? null : this.quantizedDataType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScalarQuantizationParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScalarQuantizationParameters 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 ScalarQuantizationParameters. + */ + @Generated + public static ScalarQuantizationParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScalarQuantizationParameters deserializedScalarQuantizationParameters = new ScalarQuantizationParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("quantizedDataType".equals(fieldName)) { + deserializedScalarQuantizationParameters.quantizedDataType + = VectorSearchCompressionTargetDataType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedScalarQuantizationParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringFunction.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringFunction.java new file mode 100644 index 000000000000..fa109d072708 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringFunction.java @@ -0,0 +1,212 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 functions that can modify document scores during ranking. + */ +@Fluent +public class ScoringFunction implements JsonSerializable { + /* + * Indicates the type of function to use. Valid values include magnitude, freshness, distance, and tag. The function + * type must be lower case. + */ + @Generated + private String type = "ScoringFunction"; + + /* + * The name of the field used as input to the scoring function. + */ + @Generated + private String fieldName; + + /* + * A multiplier for the raw score. Must be a positive number not equal to 1.0. + */ + @Generated + private double boost; + + /* + * A value indicating how boosting will be interpolated across document scores; defaults to "Linear". + */ + @Generated + private ScoringFunctionInterpolation interpolation; + + /** + * Creates an instance of ScoringFunction class. + */ + @Generated + public ScoringFunction() { + } + + /** + * Get the type property: Indicates the type of function to use. Valid values include magnitude, freshness, + * distance, and tag. The function type must be lower case. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * Get the fieldName property: The name of the field used as input to the scoring function. + * + * @return the fieldName value. + */ + @Generated + public String getFieldName() { + return this.fieldName; + } + + /** + * Set the fieldName property: The name of the field used as input to the scoring function. + * + * @param fieldName the fieldName value to set. + * @return the ScoringFunction object itself. + */ + @Generated + public ScoringFunction setFieldName(String fieldName) { + this.fieldName = fieldName; + return this; + } + + /** + * Get the boost property: A multiplier for the raw score. Must be a positive number not equal to 1.0. + * + * @return the boost value. + */ + @Generated + public double getBoost() { + return this.boost; + } + + /** + * Set the boost property: A multiplier for the raw score. Must be a positive number not equal to 1.0. + * + * @param boost the boost value to set. + * @return the ScoringFunction object itself. + */ + @Generated + public ScoringFunction setBoost(double boost) { + this.boost = boost; + return this; + } + + /** + * Get the interpolation property: A value indicating how boosting will be interpolated across document scores; + * defaults to "Linear". + * + * @return the interpolation value. + */ + @Generated + public ScoringFunctionInterpolation getInterpolation() { + return this.interpolation; + } + + /** + * Set the interpolation property: A value indicating how boosting will be interpolated across document scores; + * defaults to "Linear". + * + * @param interpolation the interpolation value to set. + * @return the ScoringFunction object itself. + */ + @Generated + public ScoringFunction setInterpolation(ScoringFunctionInterpolation interpolation) { + this.interpolation = interpolation; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("fieldName", this.fieldName); + jsonWriter.writeDoubleField("boost", this.boost); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("interpolation", this.interpolation == null ? null : this.interpolation.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScoringFunction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScoringFunction 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 ScoringFunction. + */ + @Generated + public static ScoringFunction 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 jsonFieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(jsonFieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("distance".equals(discriminatorValue)) { + return DistanceScoringFunction.fromJson(readerToUse.reset()); + } else if ("freshness".equals(discriminatorValue)) { + return FreshnessScoringFunction.fromJson(readerToUse.reset()); + } else if ("magnitude".equals(discriminatorValue)) { + return MagnitudeScoringFunction.fromJson(readerToUse.reset()); + } else if ("tag".equals(discriminatorValue)) { + return TagScoringFunction.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static ScoringFunction fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScoringFunction deserializedScoringFunction = new ScoringFunction(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String jsonFieldName = reader.getFieldName(); + reader.nextToken(); + + if ("fieldName".equals(jsonFieldName)) { + deserializedScoringFunction.fieldName = reader.getString(); + } else if ("boost".equals(jsonFieldName)) { + deserializedScoringFunction.boost = reader.getDouble(); + } else if ("type".equals(jsonFieldName)) { + deserializedScoringFunction.type = reader.getString(); + } else if ("interpolation".equals(jsonFieldName)) { + deserializedScoringFunction.interpolation + = ScoringFunctionInterpolation.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedScoringFunction; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringFunctionAggregation.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringFunctionAggregation.java new file mode 100644 index 000000000000..85fbb2034c5d --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringFunctionAggregation.java @@ -0,0 +1,77 @@ +// 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.models; + +/** + * Defines the aggregation function used to combine the results of all the scoring functions in a scoring profile. + */ +public enum ScoringFunctionAggregation { + /** + * Boost scores by the sum of all scoring function results. + */ + SUM("sum"), + + /** + * Boost scores by the average of all scoring function results. + */ + AVERAGE("average"), + + /** + * Boost scores by the minimum of all scoring function results. + */ + MINIMUM("minimum"), + + /** + * Boost scores by the maximum of all scoring function results. + */ + MAXIMUM("maximum"), + + /** + * Boost scores using the first applicable scoring function in the scoring profile. + */ + FIRST_MATCHING("firstMatching"), + + /** + * Boost scores by the product of all scoring function results. + */ + PRODUCT("product"); + + /** + * The actual serialized value for a ScoringFunctionAggregation instance. + */ + private final String value; + + ScoringFunctionAggregation(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ScoringFunctionAggregation instance. + * + * @param value the serialized value to parse. + * @return the parsed ScoringFunctionAggregation object, or null if unable to parse. + */ + public static ScoringFunctionAggregation fromString(String value) { + if (value == null) { + return null; + } + ScoringFunctionAggregation[] items = ScoringFunctionAggregation.values(); + for (ScoringFunctionAggregation item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringFunctionInterpolation.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringFunctionInterpolation.java new file mode 100644 index 000000000000..2b01f6795f5b --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringFunctionInterpolation.java @@ -0,0 +1,69 @@ +// 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.models; + +/** + * Defines the function used to interpolate score boosting across a range of documents. + */ +public enum ScoringFunctionInterpolation { + /** + * Boosts scores by a linearly decreasing amount. This is the default interpolation for scoring functions. + */ + LINEAR("linear"), + + /** + * Boosts scores by a constant factor. + */ + CONSTANT("constant"), + + /** + * Boosts scores by an amount that decreases quadratically. Boosts decrease slowly for higher scores, and more + * quickly as the scores decrease. This interpolation option is not allowed in tag scoring functions. + */ + QUADRATIC("quadratic"), + + /** + * Boosts scores by an amount that decreases logarithmically. Boosts decrease quickly for higher scores, and more + * slowly as the scores decrease. This interpolation option is not allowed in tag scoring functions. + */ + LOGARITHMIC("logarithmic"); + + /** + * The actual serialized value for a ScoringFunctionInterpolation instance. + */ + private final String value; + + ScoringFunctionInterpolation(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ScoringFunctionInterpolation instance. + * + * @param value the serialized value to parse. + * @return the parsed ScoringFunctionInterpolation object, or null if unable to parse. + */ + public static ScoringFunctionInterpolation fromString(String value) { + if (value == null) { + return null; + } + ScoringFunctionInterpolation[] items = ScoringFunctionInterpolation.values(); + for (ScoringFunctionInterpolation item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringProfile.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringProfile.java new file mode 100644 index 000000000000..46f856bb339a --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringProfile.java @@ -0,0 +1,194 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Defines parameters for a search index that influence scoring in search queries. + */ +@Fluent +public final class ScoringProfile implements JsonSerializable { + /* + * The name of the scoring profile. + */ + @Generated + private String name; + + /* + * Parameters that boost scoring based on text matches in certain index fields. + */ + @Generated + private TextWeights textWeights; + + /* + * The collection of functions that influence the scoring of documents. + */ + @Generated + private List functions; + + /* + * A value indicating how the results of individual scoring functions should be combined. Defaults to "Sum". Ignored + * if there are no scoring functions. + */ + @Generated + private ScoringFunctionAggregation functionAggregation; + + /** + * Creates an instance of ScoringProfile class. + */ + @Generated + public ScoringProfile() { + } + + /** + * Get the name property: The name of the scoring profile. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the scoring profile. + * + * @param name the name value to set. + * @return the ScoringProfile object itself. + */ + @Generated + public ScoringProfile setName(String name) { + this.name = name; + return this; + } + + /** + * Get the textWeights property: Parameters that boost scoring based on text matches in certain index fields. + * + * @return the textWeights value. + */ + @Generated + public TextWeights getTextWeights() { + return this.textWeights; + } + + /** + * Set the textWeights property: Parameters that boost scoring based on text matches in certain index fields. + * + * @param textWeights the textWeights value to set. + * @return the ScoringProfile object itself. + */ + @Generated + public ScoringProfile setTextWeights(TextWeights textWeights) { + this.textWeights = textWeights; + return this; + } + + /** + * Get the functions property: The collection of functions that influence the scoring of documents. + * + * @return the functions value. + */ + @Generated + public List getFunctions() { + return this.functions; + } + + /** + * Set the functions property: The collection of functions that influence the scoring of documents. + * + * @param functions the functions value to set. + * @return the ScoringProfile object itself. + */ + @Generated + public ScoringProfile setFunctions(List functions) { + this.functions = functions; + return this; + } + + /** + * Get the functionAggregation property: A value indicating how the results of individual scoring functions should + * be combined. Defaults to "Sum". Ignored if there are no scoring functions. + * + * @return the functionAggregation value. + */ + @Generated + public ScoringFunctionAggregation getFunctionAggregation() { + return this.functionAggregation; + } + + /** + * Set the functionAggregation property: A value indicating how the results of individual scoring functions should + * be combined. Defaults to "Sum". Ignored if there are no scoring functions. + * + * @param functionAggregation the functionAggregation value to set. + * @return the ScoringProfile object itself. + */ + @Generated + public ScoringProfile setFunctionAggregation(ScoringFunctionAggregation functionAggregation) { + this.functionAggregation = functionAggregation; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("text", this.textWeights); + jsonWriter.writeArrayField("functions", this.functions, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("functionAggregation", + this.functionAggregation == null ? null : this.functionAggregation.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScoringProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScoringProfile 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 ScoringProfile. + */ + @Generated + public static ScoringProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScoringProfile deserializedScoringProfile = new ScoringProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedScoringProfile.name = reader.getString(); + } else if ("text".equals(fieldName)) { + deserializedScoringProfile.textWeights = TextWeights.fromJson(reader); + } else if ("functions".equals(fieldName)) { + List functions = reader.readArray(reader1 -> ScoringFunction.fromJson(reader1)); + deserializedScoringProfile.functions = functions; + } else if ("functionAggregation".equals(fieldName)) { + deserializedScoringProfile.functionAggregation + = ScoringFunctionAggregation.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedScoringProfile; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringStatistics.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringStatistics.java new file mode 100644 index 000000000000..19ab60493cc6 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ScoringStatistics.java @@ -0,0 +1,59 @@ +// 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.models; + +/** + * A value that specifies whether we want to calculate scoring statistics (such as document frequency) globally for more + * consistent scoring, or locally, for lower latency. The default is 'local'. Use 'global' to aggregate scoring + * statistics globally before scoring. Using global scoring statistics can increase latency of search queries. + */ +public enum ScoringStatistics { + /** + * The scoring statistics will be calculated locally for lower latency. + */ + LOCAL("local"), + + /** + * The scoring statistics will be calculated globally for more consistent scoring. + */ + GLOBAL("global"); + + /** + * The actual serialized value for a ScoringStatistics instance. + */ + private final String value; + + ScoringStatistics(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ScoringStatistics instance. + * + * @param value the serialized value to parse. + * @return the parsed ScoringStatistics object, or null if unable to parse. + */ + public static ScoringStatistics fromString(String value) { + if (value == null) { + return null; + } + ScoringStatistics[] items = ScoringStatistics.values(); + for (ScoringStatistics item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchAlias.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchAlias.java new file mode 100644 index 000000000000..dee25d5120ca --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchAlias.java @@ -0,0 +1,159 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 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. + */ + @Generated + private String name; + + /* + * The name of the index this alias maps to. Only one index name may be specified. + */ + @Generated + private List indexes; + + /* + * The ETag of the alias. + */ + @Generated + private String eTag; + + /** + * Creates an instance of SearchAlias class. + */ + @Generated + public SearchAlias() { + } + + /** + * Get the name property: The name of the alias. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the alias. + * + * @param name the name value to set. + * @return the SearchAlias object itself. + */ + @Generated + public SearchAlias setName(String name) { + this.name = name; + return this; + } + + /** + * Get the indexes property: The name of the index this alias maps to. Only one index name may be specified. + * + * @return the indexes value. + */ + @Generated + public List getIndexes() { + return this.indexes; + } + + /** + * Set the indexes property: The name of the index this alias maps to. Only one index name may be specified. + * + * @param indexes the indexes value to set. + * @return the SearchAlias object itself. + */ + @Generated + public SearchAlias setIndexes(List indexes) { + this.indexes = indexes; + return this; + } + + /** + * Get the eTag property: The ETag of the alias. + * + * @return the eTag value. + */ + @Generated + 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. + */ + @Generated + public SearchAlias setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + public static SearchAlias fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchAlias deserializedSearchAlias = new SearchAlias(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSearchAlias.name = reader.getString(); + } else if ("indexes".equals(fieldName)) { + List indexes = reader.readArray(reader1 -> reader1.getString()); + deserializedSearchAlias.indexes = indexes; + } else if ("@odata.etag".equals(fieldName)) { + deserializedSearchAlias.eTag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchAlias; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchDocumentsResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchDocumentsResult.java new file mode 100644 index 000000000000..a5ae1d82062d --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchDocumentsResult.java @@ -0,0 +1,291 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Response containing search results from an index. + */ +@Immutable +public final class SearchDocumentsResult implements JsonSerializable { + /* + * The total count of results found by the search operation, or null if the count was not requested. If present, the + * count may be greater than the number of results in this response. This can happen if you use the $top or $skip + * parameters, or if the query can't return all the requested documents in a single response. + */ + @Generated + private Long count; + + /* + * A value indicating the percentage of the index that was included in the query, or null if minimumCoverage was not + * specified in the request. + */ + @Generated + private Double coverage; + + /* + * The facet query results for the search operation, organized as a collection of buckets for each faceted field; + * null if the query did not include any facet expressions. + */ + @Generated + private Map> facets; + + /* + * The answers query results for the search operation; null if the answers query parameter was not specified or set + * to 'none'. + */ + @Generated + private List answers; + + /* + * Debug information that applies to the search results as a whole. + */ + @Generated + private DebugInfo debugInfo; + + /* + * Continuation JSON payload returned when the query can't return all the requested results in a single response. + * You can use this JSON along with @odata.nextLink to formulate another POST Search request to get the next part of + * the search response. + */ + @Generated + private SearchRequest nextPageParameters; + + /* + * The sequence of results returned by the query. + */ + @Generated + private List results; + + /* + * Continuation URL returned when the query can't return all the requested results in a single response. You can use + * this URL to formulate another GET or POST Search request to get the next part of the search response. Make sure + * to use the same verb (GET or POST) as the request that produced this response. + */ + @Generated + private String nextLink; + + /* + * Reason that a partial response was returned for a semantic ranking request. + */ + @Generated + private SemanticErrorReason semanticPartialResponseReason; + + /* + * Type of partial response that was returned for a semantic ranking request. + */ + @Generated + private SemanticSearchResultsType semanticPartialResponseType; + + /* + * Type of query rewrite that was used to retrieve documents. + */ + @Generated + private SemanticQueryRewritesResultType semanticQueryRewritesResultType; + + /** + * Creates an instance of SearchDocumentsResult class. + */ + @Generated + public SearchDocumentsResult() { + } + + /** + * Get the count property: The total count of results found by the search operation, or null if the count was not + * requested. If present, the count may be greater than the number of results in this response. This can happen if + * you use the $top or $skip parameters, or if the query can't return all the requested documents in a single + * response. + * + * @return the count value. + */ + @Generated + public Long getCount() { + return this.count; + } + + /** + * Get the coverage property: A value indicating the percentage of the index that was included in the query, or null + * if minimumCoverage was not specified in the request. + * + * @return the coverage value. + */ + @Generated + public Double getCoverage() { + return this.coverage; + } + + /** + * Get the facets property: The facet query results for the search operation, organized as a collection of buckets + * for each faceted field; null if the query did not include any facet expressions. + * + * @return the facets value. + */ + @Generated + public Map> getFacets() { + return this.facets; + } + + /** + * Get the answers property: The answers query results for the search operation; null if the answers query parameter + * was not specified or set to 'none'. + * + * @return the answers value. + */ + @Generated + public List getAnswers() { + return this.answers; + } + + /** + * Get the debugInfo property: Debug information that applies to the search results as a whole. + * + * @return the debugInfo value. + */ + @Generated + public DebugInfo getDebugInfo() { + return this.debugInfo; + } + + /** + * Get the nextPageParameters property: Continuation JSON payload returned when the query can't return all the + * requested results in a single response. You can use this JSON along with @odata.nextLink to formulate + * another POST Search request to get the next part of the search response. + * + * @return the nextPageParameters value. + */ + @Generated + public SearchRequest getNextPageParameters() { + return this.nextPageParameters; + } + + /** + * Get the results property: The sequence of results returned by the query. + * + * @return the results value. + */ + @Generated + public List getResults() { + return this.results; + } + + /** + * Get the nextLink property: Continuation URL returned when the query can't return all the requested results in a + * single response. You can use this URL to formulate another GET or POST Search request to get the next part of the + * search response. Make sure to use the same verb (GET or POST) as the request that produced this response. + * + * @return the nextLink value. + */ + @Generated + public String getNextLink() { + return this.nextLink; + } + + /** + * Get the semanticPartialResponseReason property: Reason that a partial response was returned for a semantic + * ranking request. + * + * @return the semanticPartialResponseReason value. + */ + @Generated + public SemanticErrorReason getSemanticPartialResponseReason() { + return this.semanticPartialResponseReason; + } + + /** + * Get the semanticPartialResponseType property: Type of partial response that was returned for a semantic ranking + * request. + * + * @return the semanticPartialResponseType value. + */ + @Generated + public SemanticSearchResultsType getSemanticPartialResponseType() { + return this.semanticPartialResponseType; + } + + /** + * Get the semanticQueryRewritesResultType property: Type of query rewrite that was used to retrieve documents. + * + * @return the semanticQueryRewritesResultType value. + */ + @Generated + public SemanticQueryRewritesResultType getSemanticQueryRewritesResultType() { + return this.semanticQueryRewritesResultType; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchDocumentsResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchDocumentsResult 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 SearchDocumentsResult. + */ + @Generated + public static SearchDocumentsResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchDocumentsResult deserializedSearchDocumentsResult = new SearchDocumentsResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List results = reader.readArray(reader1 -> SearchResult.fromJson(reader1)); + deserializedSearchDocumentsResult.results = results; + } else if ("@odata.count".equals(fieldName)) { + deserializedSearchDocumentsResult.count = reader.getNullable(JsonReader::getLong); + } else if ("@search.coverage".equals(fieldName)) { + deserializedSearchDocumentsResult.coverage = reader.getNullable(JsonReader::getDouble); + } else if ("@search.facets".equals(fieldName)) { + Map> facets + = reader.readMap(reader1 -> reader1.readArray(reader2 -> FacetResult.fromJson(reader2))); + deserializedSearchDocumentsResult.facets = facets; + } else if ("@search.answers".equals(fieldName)) { + List answers = reader.readArray(reader1 -> QueryAnswerResult.fromJson(reader1)); + deserializedSearchDocumentsResult.answers = answers; + } else if ("@search.debug".equals(fieldName)) { + deserializedSearchDocumentsResult.debugInfo = DebugInfo.fromJson(reader); + } else if ("@search.nextPageParameters".equals(fieldName)) { + deserializedSearchDocumentsResult.nextPageParameters = SearchRequest.fromJson(reader); + } else if ("@odata.nextLink".equals(fieldName)) { + deserializedSearchDocumentsResult.nextLink = reader.getString(); + } else if ("@search.semanticPartialResponseReason".equals(fieldName)) { + deserializedSearchDocumentsResult.semanticPartialResponseReason + = SemanticErrorReason.fromString(reader.getString()); + } else if ("@search.semanticPartialResponseType".equals(fieldName)) { + deserializedSearchDocumentsResult.semanticPartialResponseType + = SemanticSearchResultsType.fromString(reader.getString()); + } else if ("@search.semanticQueryRewritesResultType".equals(fieldName)) { + deserializedSearchDocumentsResult.semanticQueryRewritesResultType + = SemanticQueryRewritesResultType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchDocumentsResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchField.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchField.java new file mode 100644 index 000000000000..f868583f90cd --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchField.java @@ -0,0 +1,855 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 a field in an index definition, which describes the name, data type, and search behavior of a field. + */ +@Fluent +public final class SearchField implements JsonSerializable { + /* + * The name of the field, which must be unique within the fields collection of the index or parent field. + */ + @Generated + private String name; + + /* + * The data type of the field. + */ + @Generated + private SearchFieldDataType type; + + /* + * A value indicating whether the field uniquely identifies documents in the index. Exactly one top-level field in + * each index must be chosen as the key field and it must be of type Edm.String. Key fields can be used to look up + * documents directly and update or delete specific documents. Default is false for simple fields and null for + * complex fields. + */ + @Generated + private Boolean key; + + /* + * A value indicating whether the field can be returned in a search result. You can disable this option if you want + * to use a field (for example, margin) as a filter, sorting, or scoring mechanism but do not want the field to be + * visible to the end user. This property must be true for key fields, and it must be null for complex fields. This + * property can be changed on existing fields. Enabling this property does not cause any increase in index storage + * requirements. Default is true for simple fields, false for vector fields, and null for complex fields. + */ + @Generated + private Boolean retrievable; + + /* + * An immutable value indicating whether the field will be persisted separately on disk to be returned in a search + * result. You can disable this option if you don't plan to return the field contents in a search response to save + * on storage overhead. This can only be set during index creation and only for vector fields. This property cannot + * be changed for existing fields or set as false for new fields. If this property is set as false, the property + * 'retrievable' must also be set to false. This property must be true or unset for key fields, for new fields, and + * for non-vector fields, and it must be null for complex fields. Disabling this property will reduce index storage + * requirements. The default is true for vector fields. + */ + @Generated + private Boolean stored; + + /* + * A value indicating whether the field is full-text searchable. This means it will undergo analysis such as + * word-breaking during indexing. If you set a searchable field to a value like "sunny day", internally it will be + * split into the individual tokens "sunny" and "day". This enables full-text searches for these terms. Fields of + * type Edm.String or Collection(Edm.String) are searchable by default. This property must be false for simple + * fields of other non-string data types, and it must be null for complex fields. Note: searchable fields consume + * extra space in your index to accommodate additional tokenized versions of the field value for full-text searches. + * If you want to save space in your index and you don't need a field to be included in searches, set searchable to + * false. + */ + @Generated + private Boolean searchable; + + /* + * A value indicating whether to enable the field to be referenced in $filter queries. filterable differs from + * searchable in how strings are handled. Fields of type Edm.String or Collection(Edm.String) that are filterable do + * not undergo word-breaking, so comparisons are for exact matches only. For example, if you set such a field f to + * "sunny day", $filter=f eq 'sunny' will find no matches, but $filter=f eq 'sunny day' will. This property must be + * null for complex fields. Default is true for simple fields and null for complex fields. + */ + @Generated + private Boolean filterable; + + /* + * A value indicating whether to enable the field to be referenced in $orderby expressions. By default, the search + * engine sorts results by score, but in many experiences users will want to sort by fields in the documents. A + * simple field can be sortable only if it is single-valued (it has a single value in the scope of the parent + * document). Simple collection fields cannot be sortable, since they are multi-valued. Simple sub-fields of complex + * collections are also multi-valued, and therefore cannot be sortable. This is true whether it's an immediate + * parent field, or an ancestor field, that's the complex collection. Complex fields cannot be sortable and the + * sortable property must be null for such fields. The default for sortable is true for single-valued simple fields, + * false for multi-valued simple fields, and null for complex fields. + */ + @Generated + private Boolean sortable; + + /* + * A value indicating whether to enable the field to be referenced in facet queries. Typically used in a + * presentation of search results that includes hit count by category (for example, search for digital cameras and + * see hits by brand, by megapixels, by price, and so on). This property must be null for complex fields. Fields of + * type Edm.GeographyPoint or Collection(Edm.GeographyPoint) cannot be facetable. Default is true for all other + * simple fields. + */ + @Generated + private Boolean facetable; + + /* + * A value indicating whether the field should be used as a permission filter. + */ + @Generated + private PermissionFilter permissionFilter; + + /* + * A value indicating whether the field should be used for sensitivity label filtering. This enables document-level + * filtering based on Microsoft Purview sensitivity labels. + */ + @Generated + private Boolean sensitivityLabel; + + /* + * The name of the analyzer to use for the field. This option can be used only with searchable fields and it can't + * be set together with either searchAnalyzer or indexAnalyzer. Once the analyzer is chosen, it cannot be changed + * for the field. Must be null for complex fields. + */ + @Generated + private LexicalAnalyzerName analyzer; + + /* + * The name of the analyzer used at search time for the field. This option can be used only with searchable fields. + * It must be set together with indexAnalyzer and it cannot be set together with the analyzer option. This property + * cannot be set to the name of a language analyzer; use the analyzer property instead if you need a language + * analyzer. This analyzer can be updated on an existing field. Must be null for complex fields. + */ + @Generated + private LexicalAnalyzerName searchAnalyzer; + + /* + * The name of the analyzer used at indexing time for the field. This option can be used only with searchable + * fields. It must be set together with searchAnalyzer and it cannot be set together with the analyzer option. This + * property cannot be set to the name of a language analyzer; use the analyzer property instead if you need a + * language analyzer. Once the analyzer is chosen, it cannot be changed for the field. Must be null for complex + * fields. + */ + @Generated + private LexicalAnalyzerName indexAnalyzer; + + /* + * 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. + */ + @Generated + private LexicalNormalizerName normalizer; + + /* + * The dimensionality of the vector field. + */ + @Generated + private Integer vectorSearchDimensions; + + /* + * The name of the vector search profile that specifies the algorithm and vectorizer to use when searching the + * vector field. + */ + @Generated + private String vectorSearchProfileName; + + /* + * The encoding format to interpret the field contents. + */ + @Generated + private VectorEncodingFormat vectorEncodingFormat; + + /* + * A list of the names of synonym maps to associate with this field. This option can be used only with searchable + * fields. Currently only one synonym map per field is supported. Assigning a synonym map to a field ensures that + * query terms targeting that field are expanded at query-time using the rules in the synonym map. This attribute + * can be changed on existing fields. Must be null or an empty collection for complex fields. + */ + @Generated + private List synonymMaps; + + /* + * A list of sub-fields if this is a field of type Edm.ComplexType or Collection(Edm.ComplexType). Must be null or + * empty for simple fields. + */ + @Generated + private List fields; + + /** + * Creates an instance of SearchField class. + */ + @Generated + public SearchField() { + } + + /** + * Get the name property: The name of the field, which must be unique within the fields collection of the index or + * parent field. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the field, which must be unique within the fields collection of the index or + * parent field. + * + * @param name the name value to set. + * @return the SearchField object itself. + */ + @Generated + public SearchField setName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The data type of the field. + * + * @return the type value. + */ + @Generated + public SearchFieldDataType getType() { + return this.type; + } + + /** + * Set the type property: The data type of the field. + * + * @param type the type value to set. + * @return the SearchField object itself. + */ + @Generated + public SearchField setType(SearchFieldDataType type) { + this.type = type; + return this; + } + + /** + * Get the key property: A value indicating whether the field uniquely identifies documents in the index. Exactly + * one top-level field in each index must be chosen as the key field and it must be of type Edm.String. Key fields + * can be used to look up documents directly and update or delete specific documents. Default is false for simple + * fields and null for complex fields. + * + * @return the key value. + */ + @Generated + public Boolean isKey() { + return this.key; + } + + /** + * Set the key property: A value indicating whether the field uniquely identifies documents in the index. Exactly + * one top-level field in each index must be chosen as the key field and it must be of type Edm.String. Key fields + * can be used to look up documents directly and update or delete specific documents. Default is false for simple + * fields and null for complex fields. + * + * @param key the key value to set. + * @return the SearchField object itself. + */ + @Generated + public SearchField setKey(Boolean key) { + this.key = key; + return this; + } + + /** + * Get the retrievable property: A value indicating whether the field can be returned in a search result. You can + * disable this option if you want to use a field (for example, margin) as a filter, sorting, or scoring mechanism + * but do not want the field to be visible to the end user. This property must be true for key fields, and it must + * be null for complex fields. This property can be changed on existing fields. Enabling this property does not + * cause any increase in index storage requirements. Default is true for simple fields, false for vector fields, and + * null for complex fields. + * + * @return the retrievable value. + */ + @Generated + public Boolean isRetrievable() { + return this.retrievable; + } + + /** + * Set the retrievable property: A value indicating whether the field can be returned in a search result. You can + * disable this option if you want to use a field (for example, margin) as a filter, sorting, or scoring mechanism + * but do not want the field to be visible to the end user. This property must be true for key fields, and it must + * be null for complex fields. This property can be changed on existing fields. Enabling this property does not + * cause any increase in index storage requirements. Default is true for simple fields, false for vector fields, and + * null for complex fields. + * + * @param retrievable the retrievable value to set. + * @return the SearchField object itself. + */ + @Generated + public SearchField setRetrievable(Boolean retrievable) { + this.retrievable = retrievable; + return this; + } + + /** + * Get the stored property: An immutable value indicating whether the field will be persisted separately on disk to + * be returned in a search result. You can disable this option if you don't plan to return the field contents in a + * search response to save on storage overhead. This can only be set during index creation and only for vector + * fields. This property cannot be changed for existing fields or set as false for new fields. If this property is + * set as false, the property 'retrievable' must also be set to false. This property must be true or unset for key + * fields, for new fields, and for non-vector fields, and it must be null for complex fields. Disabling this + * property will reduce index storage requirements. The default is true for vector fields. + * + * @return the stored value. + */ + @Generated + public Boolean isStored() { + return this.stored; + } + + /** + * Set the stored property: An immutable value indicating whether the field will be persisted separately on disk to + * be returned in a search result. You can disable this option if you don't plan to return the field contents in a + * search response to save on storage overhead. This can only be set during index creation and only for vector + * fields. This property cannot be changed for existing fields or set as false for new fields. If this property is + * set as false, the property 'retrievable' must also be set to false. This property must be true or unset for key + * fields, for new fields, and for non-vector fields, and it must be null for complex fields. Disabling this + * property will reduce index storage requirements. The default is true for vector fields. + * + * @param stored the stored value to set. + * @return the SearchField object itself. + */ + @Generated + public SearchField setStored(Boolean stored) { + this.stored = stored; + return this; + } + + /** + * Get the searchable property: A value indicating whether the field is full-text searchable. This means it will + * undergo analysis such as word-breaking during indexing. If you set a searchable field to a value like "sunny + * day", internally it will be split into the individual tokens "sunny" and "day". This enables full-text searches + * for these terms. Fields of type Edm.String or Collection(Edm.String) are searchable by default. This property + * must be false for simple fields of other non-string data types, and it must be null for complex fields. Note: + * searchable fields consume extra space in your index to accommodate additional tokenized versions of the field + * value for full-text searches. If you want to save space in your index and you don't need a field to be included + * in searches, set searchable to false. + * + * @return the searchable value. + */ + @Generated + public Boolean isSearchable() { + return this.searchable; + } + + /** + * Set the searchable property: A value indicating whether the field is full-text searchable. This means it will + * undergo analysis such as word-breaking during indexing. If you set a searchable field to a value like "sunny + * day", internally it will be split into the individual tokens "sunny" and "day". This enables full-text searches + * for these terms. Fields of type Edm.String or Collection(Edm.String) are searchable by default. This property + * must be false for simple fields of other non-string data types, and it must be null for complex fields. Note: + * searchable fields consume extra space in your index to accommodate additional tokenized versions of the field + * value for full-text searches. If you want to save space in your index and you don't need a field to be included + * in searches, set searchable to false. + * + * @param searchable the searchable value to set. + * @return the SearchField object itself. + */ + @Generated + public SearchField setSearchable(Boolean searchable) { + this.searchable = searchable; + return this; + } + + /** + * Get the filterable property: A value indicating whether to enable the field to be referenced in $filter queries. + * filterable differs from searchable in how strings are handled. Fields of type Edm.String or + * Collection(Edm.String) that are filterable do not undergo word-breaking, so comparisons are for exact matches + * only. For example, if you set such a field f to "sunny day", $filter=f eq 'sunny' will find no matches, but + * $filter=f eq 'sunny day' will. This property must be null for complex fields. Default is true for simple fields + * and null for complex fields. + * + * @return the filterable value. + */ + @Generated + public Boolean isFilterable() { + return this.filterable; + } + + /** + * Set the filterable property: A value indicating whether to enable the field to be referenced in $filter queries. + * filterable differs from searchable in how strings are handled. Fields of type Edm.String or + * Collection(Edm.String) that are filterable do not undergo word-breaking, so comparisons are for exact matches + * only. For example, if you set such a field f to "sunny day", $filter=f eq 'sunny' will find no matches, but + * $filter=f eq 'sunny day' will. This property must be null for complex fields. Default is true for simple fields + * and null for complex fields. + * + * @param filterable the filterable value to set. + * @return the SearchField object itself. + */ + @Generated + public SearchField setFilterable(Boolean filterable) { + this.filterable = filterable; + return this; + } + + /** + * Get the sortable property: A value indicating whether to enable the field to be referenced in $orderby + * expressions. By default, the search engine sorts results by score, but in many experiences users will want to + * sort by fields in the documents. A simple field can be sortable only if it is single-valued (it has a single + * value in the scope of the parent document). Simple collection fields cannot be sortable, since they are + * multi-valued. Simple sub-fields of complex collections are also multi-valued, and therefore cannot be sortable. + * This is true whether it's an immediate parent field, or an ancestor field, that's the complex collection. Complex + * fields cannot be sortable and the sortable property must be null for such fields. The default for sortable is + * true for single-valued simple fields, false for multi-valued simple fields, and null for complex fields. + * + * @return the sortable value. + */ + @Generated + public Boolean isSortable() { + return this.sortable; + } + + /** + * Set the sortable property: A value indicating whether to enable the field to be referenced in $orderby + * expressions. By default, the search engine sorts results by score, but in many experiences users will want to + * sort by fields in the documents. A simple field can be sortable only if it is single-valued (it has a single + * value in the scope of the parent document). Simple collection fields cannot be sortable, since they are + * multi-valued. Simple sub-fields of complex collections are also multi-valued, and therefore cannot be sortable. + * This is true whether it's an immediate parent field, or an ancestor field, that's the complex collection. Complex + * fields cannot be sortable and the sortable property must be null for such fields. The default for sortable is + * true for single-valued simple fields, false for multi-valued simple fields, and null for complex fields. + * + * @param sortable the sortable value to set. + * @return the SearchField object itself. + */ + @Generated + public SearchField setSortable(Boolean sortable) { + this.sortable = sortable; + return this; + } + + /** + * Get the facetable property: A value indicating whether to enable the field to be referenced in facet queries. + * Typically used in a presentation of search results that includes hit count by category (for example, search for + * digital cameras and see hits by brand, by megapixels, by price, and so on). This property must be null for + * complex fields. Fields of type Edm.GeographyPoint or Collection(Edm.GeographyPoint) cannot be facetable. Default + * is true for all other simple fields. + * + * @return the facetable value. + */ + @Generated + public Boolean isFacetable() { + return this.facetable; + } + + /** + * Set the facetable property: A value indicating whether to enable the field to be referenced in facet queries. + * Typically used in a presentation of search results that includes hit count by category (for example, search for + * digital cameras and see hits by brand, by megapixels, by price, and so on). This property must be null for + * complex fields. Fields of type Edm.GeographyPoint or Collection(Edm.GeographyPoint) cannot be facetable. Default + * is true for all other simple fields. + * + * @param facetable the facetable value to set. + * @return the SearchField object itself. + */ + @Generated + public SearchField setFacetable(Boolean facetable) { + this.facetable = facetable; + return this; + } + + /** + * Get the permissionFilter property: A value indicating whether the field should be used as a permission filter. + * + * @return the permissionFilter value. + */ + @Generated + public PermissionFilter getPermissionFilter() { + return this.permissionFilter; + } + + /** + * Set the permissionFilter property: A value indicating whether the field should be used as a permission filter. + * + * @param permissionFilter the permissionFilter value to set. + * @return the SearchField object itself. + */ + @Generated + public SearchField setPermissionFilter(PermissionFilter permissionFilter) { + this.permissionFilter = permissionFilter; + return this; + } + + /** + * Get the sensitivityLabel property: A value indicating whether the field should be used for sensitivity label + * filtering. This enables document-level filtering based on Microsoft Purview sensitivity labels. + * + * @return the sensitivityLabel value. + */ + @Generated + public Boolean isSensitivityLabel() { + return this.sensitivityLabel; + } + + /** + * Set the sensitivityLabel property: A value indicating whether the field should be used for sensitivity label + * filtering. This enables document-level filtering based on Microsoft Purview sensitivity labels. + * + * @param sensitivityLabel the sensitivityLabel value to set. + * @return the SearchField object itself. + */ + @Generated + public SearchField setSensitivityLabel(Boolean sensitivityLabel) { + this.sensitivityLabel = sensitivityLabel; + return this; + } + + /** + * Get the analyzer property: The name of the analyzer to use for the field. This option can be used only with + * searchable fields and it can't be set together with either searchAnalyzer or indexAnalyzer. Once the analyzer is + * chosen, it cannot be changed for the field. Must be null for complex fields. + * + * @return the analyzer value. + */ + @Generated + public LexicalAnalyzerName getAnalyzer() { + return this.analyzer; + } + + /** + * Set the analyzer property: The name of the analyzer to use for the field. This option can be used only with + * searchable fields and it can't be set together with either searchAnalyzer or indexAnalyzer. Once the analyzer is + * chosen, it cannot be changed for the field. Must be null for complex fields. + * + * @param analyzer the analyzer value to set. + * @return the SearchField object itself. + */ + @Generated + public SearchField setAnalyzer(LexicalAnalyzerName analyzer) { + this.analyzer = analyzer; + return this; + } + + /** + * Get the searchAnalyzer property: The name of the analyzer used at search time for the field. This option can be + * used only with searchable fields. It must be set together with indexAnalyzer and it cannot be set together with + * the analyzer option. This property cannot be set to the name of a language analyzer; use the analyzer property + * instead if you need a language analyzer. This analyzer can be updated on an existing field. Must be null for + * complex fields. + * + * @return the searchAnalyzer value. + */ + @Generated + public LexicalAnalyzerName getSearchAnalyzer() { + return this.searchAnalyzer; + } + + /** + * Set the searchAnalyzer property: The name of the analyzer used at search time for the field. This option can be + * used only with searchable fields. It must be set together with indexAnalyzer and it cannot be set together with + * the analyzer option. This property cannot be set to the name of a language analyzer; use the analyzer property + * instead if you need a language analyzer. This analyzer can be updated on an existing field. Must be null for + * complex fields. + * + * @param searchAnalyzer the searchAnalyzer value to set. + * @return the SearchField object itself. + */ + @Generated + public SearchField setSearchAnalyzer(LexicalAnalyzerName searchAnalyzer) { + this.searchAnalyzer = searchAnalyzer; + return this; + } + + /** + * Get the indexAnalyzer property: The name of the analyzer used at indexing time for the field. This option can be + * used only with searchable fields. It must be set together with searchAnalyzer and it cannot be set together with + * the analyzer option. This property cannot be set to the name of a language analyzer; use the analyzer property + * instead if you need a language analyzer. Once the analyzer is chosen, it cannot be changed for the field. Must be + * null for complex fields. + * + * @return the indexAnalyzer value. + */ + @Generated + public LexicalAnalyzerName getIndexAnalyzer() { + return this.indexAnalyzer; + } + + /** + * Set the indexAnalyzer property: The name of the analyzer used at indexing time for the field. This option can be + * used only with searchable fields. It must be set together with searchAnalyzer and it cannot be set together with + * the analyzer option. This property cannot be set to the name of a language analyzer; use the analyzer property + * instead if you need a language analyzer. Once the analyzer is chosen, it cannot be changed for the field. Must be + * null for complex fields. + * + * @param indexAnalyzer the indexAnalyzer value to set. + * @return the SearchField object itself. + */ + @Generated + public SearchField setIndexAnalyzer(LexicalAnalyzerName indexAnalyzer) { + this.indexAnalyzer = indexAnalyzer; + 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. + */ + @Generated + 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. + */ + @Generated + public SearchField setNormalizer(LexicalNormalizerName normalizer) { + this.normalizer = normalizer; + return this; + } + + /** + * Get the vectorSearchDimensions property: The dimensionality of the vector field. + * + * @return the vectorSearchDimensions value. + */ + @Generated + public Integer getVectorSearchDimensions() { + return this.vectorSearchDimensions; + } + + /** + * Set the vectorSearchDimensions property: The dimensionality of the vector field. + * + * @param vectorSearchDimensions the vectorSearchDimensions value to set. + * @return the SearchField object itself. + */ + @Generated + public SearchField setVectorSearchDimensions(Integer vectorSearchDimensions) { + this.vectorSearchDimensions = vectorSearchDimensions; + return this; + } + + /** + * Get the vectorSearchProfileName property: The name of the vector search profile that specifies the algorithm and + * vectorizer to use when searching the vector field. + * + * @return the vectorSearchProfileName value. + */ + @Generated + public String getVectorSearchProfileName() { + return this.vectorSearchProfileName; + } + + /** + * Set the vectorSearchProfileName property: The name of the vector search profile that specifies the algorithm and + * vectorizer to use when searching the vector field. + * + * @param vectorSearchProfileName the vectorSearchProfileName value to set. + * @return the SearchField object itself. + */ + @Generated + public SearchField setVectorSearchProfileName(String vectorSearchProfileName) { + this.vectorSearchProfileName = vectorSearchProfileName; + return this; + } + + /** + * Get the vectorEncodingFormat property: The encoding format to interpret the field contents. + * + * @return the vectorEncodingFormat value. + */ + @Generated + public VectorEncodingFormat getVectorEncodingFormat() { + return this.vectorEncodingFormat; + } + + /** + * Set the vectorEncodingFormat property: The encoding format to interpret the field contents. + * + * @param vectorEncodingFormat the vectorEncodingFormat value to set. + * @return the SearchField object itself. + */ + @Generated + public SearchField setVectorEncodingFormat(VectorEncodingFormat vectorEncodingFormat) { + this.vectorEncodingFormat = vectorEncodingFormat; + return this; + } + + /** + * Get the synonymMaps property: A list of the names of synonym maps to associate with this field. This option can + * be used only with searchable fields. Currently only one synonym map per field is supported. Assigning a synonym + * map to a field ensures that query terms targeting that field are expanded at query-time using the rules in the + * synonym map. This attribute can be changed on existing fields. Must be null or an empty collection for complex + * fields. + * + * @return the synonymMaps value. + */ + @Generated + public List getSynonymMaps() { + return this.synonymMaps; + } + + /** + * Set the synonymMaps property: A list of the names of synonym maps to associate with this field. This option can + * be used only with searchable fields. Currently only one synonym map per field is supported. Assigning a synonym + * map to a field ensures that query terms targeting that field are expanded at query-time using the rules in the + * synonym map. This attribute can be changed on existing fields. Must be null or an empty collection for complex + * fields. + * + * @param synonymMaps the synonymMaps value to set. + * @return the SearchField object itself. + */ + @Generated + public SearchField setSynonymMaps(List synonymMaps) { + this.synonymMaps = synonymMaps; + return this; + } + + /** + * Get the fields property: A list of sub-fields if this is a field of type Edm.ComplexType or + * Collection(Edm.ComplexType). Must be null or empty for simple fields. + * + * @return the fields value. + */ + @Generated + public List getFields() { + return this.fields; + } + + /** + * Set the fields property: A list of sub-fields if this is a field of type Edm.ComplexType or + * Collection(Edm.ComplexType). Must be null or empty for simple fields. + * + * @param fields the fields value to set. + * @return the SearchField object itself. + */ + @Generated + public SearchField setFields(List fields) { + this.fields = fields; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeBooleanField("key", this.key); + jsonWriter.writeBooleanField("retrievable", this.retrievable); + jsonWriter.writeBooleanField("stored", this.stored); + jsonWriter.writeBooleanField("searchable", this.searchable); + jsonWriter.writeBooleanField("filterable", this.filterable); + jsonWriter.writeBooleanField("sortable", this.sortable); + jsonWriter.writeBooleanField("facetable", this.facetable); + jsonWriter.writeStringField("permissionFilter", + this.permissionFilter == null ? null : this.permissionFilter.toString()); + jsonWriter.writeBooleanField("sensitivityLabel", this.sensitivityLabel); + jsonWriter.writeStringField("analyzer", this.analyzer == null ? null : this.analyzer.toString()); + jsonWriter.writeStringField("searchAnalyzer", + this.searchAnalyzer == null ? null : this.searchAnalyzer.toString()); + jsonWriter.writeStringField("indexAnalyzer", this.indexAnalyzer == null ? null : this.indexAnalyzer.toString()); + jsonWriter.writeStringField("normalizer", this.normalizer == null ? null : this.normalizer.toString()); + jsonWriter.writeNumberField("dimensions", this.vectorSearchDimensions); + jsonWriter.writeStringField("vectorSearchProfile", this.vectorSearchProfileName); + jsonWriter.writeStringField("vectorEncoding", + this.vectorEncodingFormat == null ? null : this.vectorEncodingFormat.toString()); + jsonWriter.writeArrayField("synonymMaps", this.synonymMaps, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("fields", this.fields, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchField from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchField 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 SearchField. + */ + @Generated + public static SearchField fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchField deserializedSearchField = new SearchField(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSearchField.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSearchField.type = SearchFieldDataType.fromString(reader.getString()); + } else if ("key".equals(fieldName)) { + deserializedSearchField.key = reader.getNullable(JsonReader::getBoolean); + } else if ("retrievable".equals(fieldName)) { + deserializedSearchField.retrievable = reader.getNullable(JsonReader::getBoolean); + } else if ("stored".equals(fieldName)) { + deserializedSearchField.stored = reader.getNullable(JsonReader::getBoolean); + } else if ("searchable".equals(fieldName)) { + deserializedSearchField.searchable = reader.getNullable(JsonReader::getBoolean); + } else if ("filterable".equals(fieldName)) { + deserializedSearchField.filterable = reader.getNullable(JsonReader::getBoolean); + } else if ("sortable".equals(fieldName)) { + deserializedSearchField.sortable = reader.getNullable(JsonReader::getBoolean); + } else if ("facetable".equals(fieldName)) { + deserializedSearchField.facetable = reader.getNullable(JsonReader::getBoolean); + } else if ("permissionFilter".equals(fieldName)) { + deserializedSearchField.permissionFilter = PermissionFilter.fromString(reader.getString()); + } else if ("sensitivityLabel".equals(fieldName)) { + deserializedSearchField.sensitivityLabel = reader.getNullable(JsonReader::getBoolean); + } else if ("analyzer".equals(fieldName)) { + deserializedSearchField.analyzer = LexicalAnalyzerName.fromString(reader.getString()); + } else if ("searchAnalyzer".equals(fieldName)) { + deserializedSearchField.searchAnalyzer = LexicalAnalyzerName.fromString(reader.getString()); + } else if ("indexAnalyzer".equals(fieldName)) { + deserializedSearchField.indexAnalyzer = LexicalAnalyzerName.fromString(reader.getString()); + } else if ("normalizer".equals(fieldName)) { + deserializedSearchField.normalizer = LexicalNormalizerName.fromString(reader.getString()); + } else if ("dimensions".equals(fieldName)) { + deserializedSearchField.vectorSearchDimensions = reader.getNullable(JsonReader::getInt); + } else if ("vectorSearchProfile".equals(fieldName)) { + deserializedSearchField.vectorSearchProfileName = reader.getString(); + } else if ("vectorEncoding".equals(fieldName)) { + deserializedSearchField.vectorEncodingFormat = VectorEncodingFormat.fromString(reader.getString()); + } else if ("synonymMaps".equals(fieldName)) { + List synonymMaps = reader.readArray(reader1 -> reader1.getString()); + deserializedSearchField.synonymMaps = synonymMaps; + } else if ("fields".equals(fieldName)) { + List fields = reader.readArray(reader1 -> SearchField.fromJson(reader1)); + deserializedSearchField.fields = fields; + } else { + reader.skipChildren(); + } + } + + return deserializedSearchField; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchFieldDataType.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchFieldDataType.java new file mode 100644 index 000000000000..82623b9eea5d --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchFieldDataType.java @@ -0,0 +1,126 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines the data type of a field in a search index. + */ +public final class SearchFieldDataType extends ExpandableStringEnum { + /** + * Indicates that a field contains a string. + */ + @Generated + public static final SearchFieldDataType STRING = fromString("Edm.String"); + + /** + * Indicates that a field contains a 32-bit signed integer. + */ + @Generated + public static final SearchFieldDataType INT32 = fromString("Edm.Int32"); + + /** + * Indicates that a field contains a 64-bit signed integer. + */ + @Generated + public static final SearchFieldDataType INT64 = fromString("Edm.Int64"); + + /** + * Indicates that a field contains an IEEE double-precision floating point number. + */ + @Generated + public static final SearchFieldDataType DOUBLE = fromString("Edm.Double"); + + /** + * Indicates that a field contains a Boolean value (true or false). + */ + @Generated + public static final SearchFieldDataType BOOLEAN = fromString("Edm.Boolean"); + + /** + * Indicates that a field contains a date/time value, including timezone information. + */ + @Generated + public static final SearchFieldDataType DATE_TIME_OFFSET = fromString("Edm.DateTimeOffset"); + + /** + * Indicates that a field contains a geo-location in terms of longitude and latitude. + */ + @Generated + public static final SearchFieldDataType GEOGRAPHY_POINT = fromString("Edm.GeographyPoint"); + + /** + * Indicates that a field contains one or more complex objects that in turn have sub-fields of other types. + */ + @Generated + public static final SearchFieldDataType COMPLEX = fromString("Edm.ComplexType"); + + /** + * Indicates that a field contains a single-precision floating point number. This is only valid when used with + * Collection(Edm.Single). + */ + @Generated + public static final SearchFieldDataType SINGLE = fromString("Edm.Single"); + + /** + * Indicates that a field contains a half-precision floating point number. This is only valid when used with + * Collection(Edm.Half). + */ + @Generated + public static final SearchFieldDataType HALF = fromString("Edm.Half"); + + /** + * Indicates that a field contains a 16-bit signed integer. This is only valid when used with Collection(Edm.Int16). + */ + @Generated + public static final SearchFieldDataType INT16 = fromString("Edm.Int16"); + + /** + * Indicates that a field contains a 8-bit signed integer. This is only valid when used with Collection(Edm.SByte). + */ + @Generated + public static final SearchFieldDataType SBYTE = fromString("Edm.SByte"); + + /** + * Indicates that a field contains a 8-bit unsigned integer. This is only valid when used with Collection(Edm.Byte). + */ + @Generated + public static final SearchFieldDataType BYTE = fromString("Edm.Byte"); + + /** + * Creates a new instance of SearchFieldDataType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public SearchFieldDataType() { + } + + /** + * Creates or finds a SearchFieldDataType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SearchFieldDataType. + */ + @Generated + public static SearchFieldDataType fromString(String name) { + return fromString(name, SearchFieldDataType.class); + } + + /** + * Gets known SearchFieldDataType values. + * + * @return known SearchFieldDataType values. + */ + @Generated + public static Collection values() { + return values(SearchFieldDataType.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndex.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndex.java new file mode 100644 index 000000000000..e01de596a614 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndex.java @@ -0,0 +1,699 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 a search index definition, which describes the fields and search behavior of an index. + */ +@Fluent +public final class SearchIndex implements JsonSerializable { + /* + * The name of the index. + */ + @Generated + private String name; + + /* + * The description of the index. + */ + @Generated + private String description; + + /* + * The fields of the index. + */ + @Generated + private List fields; + + /* + * The scoring profiles for the index. + */ + @Generated + private List scoringProfiles; + + /* + * The name of the scoring profile to use if none is specified in the query. If this property is not set and no + * scoring profile is specified in the query, then default scoring (tf-idf) will be used. + */ + @Generated + private String defaultScoringProfile; + + /* + * Options to control Cross-Origin Resource Sharing (CORS) for the index. + */ + @Generated + private CorsOptions corsOptions; + + /* + * The suggesters for the index. + */ + @Generated + private List suggesters; + + /* + * The analyzers for the index. + */ + @Generated + private List analyzers; + + /* + * The tokenizers for the index. + */ + @Generated + private List tokenizers; + + /* + * The token filters for the index. + */ + @Generated + private List tokenFilters; + + /* + * The character filters for the index. + */ + @Generated + private List charFilters; + + /* + * The normalizers for the index. + */ + @Generated + 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 + * decrypt your data. Once you have encrypted your data, it will always remain encrypted. The search service will + * ignore attempts to set this property to null. You can change this property as needed if you want to rotate your + * encryption key; Your data will be unaffected. Encryption with customer-managed keys is not available for free + * search services, and is only available for paid services created on or after January 1, 2019. + */ + @Generated + private SearchResourceEncryptionKey encryptionKey; + + /* + * The type of similarity algorithm to be used when scoring and ranking the documents matching a search query. The + * similarity algorithm can only be defined at index creation time and cannot be modified on existing indexes. If + * null, the ClassicSimilarity algorithm is used. + */ + @Generated + private Similarity similarity; + + /* + * Defines parameters for a search index that influence semantic capabilities. + */ + @Generated + private SemanticSearch semanticSearch; + + /* + * Contains configuration options related to vector search. + */ + @Generated + private VectorSearch vectorSearch; + + /* + * A value indicating whether permission filtering is enabled for the index. + */ + @Generated + private SearchIndexPermissionFilterOption permissionFilterOption; + + /* + * A value indicating whether the index is leveraging Purview-specific features. This property defaults to false and + * cannot be changed after index creation. + */ + @Generated + private Boolean purviewEnabled; + + /* + * The ETag of the index. + */ + @Generated + private String eTag; + + /** + * Creates an instance of SearchIndex class. + */ + @Generated + public SearchIndex() { + } + + /** + * Get the name property: The name of the index. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the index. + * + * @param name the name value to set. + * @return the SearchIndex object itself. + */ + @Generated + public SearchIndex setName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: The description of the index. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description of the index. + * + * @param description the description value to set. + * @return the SearchIndex object itself. + */ + @Generated + public SearchIndex setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the fields property: The fields of the index. + * + * @return the fields value. + */ + @Generated + public List getFields() { + return this.fields; + } + + /** + * Set the fields property: The fields of the index. + * + * @param fields the fields value to set. + * @return the SearchIndex object itself. + */ + @Generated + public SearchIndex setFields(List fields) { + this.fields = fields; + return this; + } + + /** + * Get the scoringProfiles property: The scoring profiles for the index. + * + * @return the scoringProfiles value. + */ + @Generated + public List getScoringProfiles() { + return this.scoringProfiles; + } + + /** + * Set the scoringProfiles property: The scoring profiles for the index. + * + * @param scoringProfiles the scoringProfiles value to set. + * @return the SearchIndex object itself. + */ + @Generated + public SearchIndex setScoringProfiles(List scoringProfiles) { + this.scoringProfiles = scoringProfiles; + return this; + } + + /** + * Get the defaultScoringProfile property: The name of the scoring profile to use if none is specified in the query. + * If this property is not set and no scoring profile is specified in the query, then default scoring (tf-idf) will + * be used. + * + * @return the defaultScoringProfile value. + */ + @Generated + public String getDefaultScoringProfile() { + return this.defaultScoringProfile; + } + + /** + * Set the defaultScoringProfile property: The name of the scoring profile to use if none is specified in the query. + * If this property is not set and no scoring profile is specified in the query, then default scoring (tf-idf) will + * be used. + * + * @param defaultScoringProfile the defaultScoringProfile value to set. + * @return the SearchIndex object itself. + */ + @Generated + public SearchIndex setDefaultScoringProfile(String defaultScoringProfile) { + this.defaultScoringProfile = defaultScoringProfile; + return this; + } + + /** + * Get the corsOptions property: Options to control Cross-Origin Resource Sharing (CORS) for the index. + * + * @return the corsOptions value. + */ + @Generated + public CorsOptions getCorsOptions() { + return this.corsOptions; + } + + /** + * Set the corsOptions property: Options to control Cross-Origin Resource Sharing (CORS) for the index. + * + * @param corsOptions the corsOptions value to set. + * @return the SearchIndex object itself. + */ + @Generated + public SearchIndex setCorsOptions(CorsOptions corsOptions) { + this.corsOptions = corsOptions; + return this; + } + + /** + * Get the suggesters property: The suggesters for the index. + * + * @return the suggesters value. + */ + @Generated + public List getSuggesters() { + return this.suggesters; + } + + /** + * Set the suggesters property: The suggesters for the index. + * + * @param suggesters the suggesters value to set. + * @return the SearchIndex object itself. + */ + @Generated + public SearchIndex setSuggesters(List suggesters) { + this.suggesters = suggesters; + return this; + } + + /** + * Get the analyzers property: The analyzers for the index. + * + * @return the analyzers value. + */ + @Generated + public List getAnalyzers() { + return this.analyzers; + } + + /** + * Set the analyzers property: The analyzers for the index. + * + * @param analyzers the analyzers value to set. + * @return the SearchIndex object itself. + */ + @Generated + public SearchIndex setAnalyzers(List analyzers) { + this.analyzers = analyzers; + return this; + } + + /** + * Get the tokenizers property: The tokenizers for the index. + * + * @return the tokenizers value. + */ + @Generated + public List getTokenizers() { + return this.tokenizers; + } + + /** + * Set the tokenizers property: The tokenizers for the index. + * + * @param tokenizers the tokenizers value to set. + * @return the SearchIndex object itself. + */ + @Generated + public SearchIndex setTokenizers(List tokenizers) { + this.tokenizers = tokenizers; + return this; + } + + /** + * Get the tokenFilters property: The token filters for the index. + * + * @return the tokenFilters value. + */ + @Generated + public List getTokenFilters() { + return this.tokenFilters; + } + + /** + * Set the tokenFilters property: The token filters for the index. + * + * @param tokenFilters the tokenFilters value to set. + * @return the SearchIndex object itself. + */ + @Generated + public SearchIndex setTokenFilters(List tokenFilters) { + this.tokenFilters = tokenFilters; + return this; + } + + /** + * Get the charFilters property: The character filters for the index. + * + * @return the charFilters value. + */ + @Generated + public List getCharFilters() { + return this.charFilters; + } + + /** + * Set the charFilters property: The character filters for the index. + * + * @param charFilters the charFilters value to set. + * @return the SearchIndex object itself. + */ + @Generated + public SearchIndex setCharFilters(List charFilters) { + this.charFilters = charFilters; + return this; + } + + /** + * Get the normalizers property: The normalizers for the index. + * + * @return the normalizers value. + */ + @Generated + 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. + */ + @Generated + 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 + * one, not even Microsoft, can decrypt your data. Once you have encrypted your data, it will always remain + * encrypted. The search service will ignore attempts to set this property to null. You can change this property as + * needed if you want to rotate your encryption key; Your data will be unaffected. Encryption with customer-managed + * keys is not available for free search services, and is only available for paid services created on or after + * January 1, 2019. + * + * @return the encryptionKey value. + */ + @Generated + public SearchResourceEncryptionKey getEncryptionKey() { + return this.encryptionKey; + } + + /** + * Set 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 + * one, not even Microsoft, can decrypt your data. Once you have encrypted your data, it will always remain + * encrypted. The search service will ignore attempts to set this property to null. You can change this property as + * needed if you want to rotate your encryption key; Your data will be unaffected. Encryption with customer-managed + * keys is not available for free search services, and is only available for paid services created on or after + * January 1, 2019. + * + * @param encryptionKey the encryptionKey value to set. + * @return the SearchIndex object itself. + */ + @Generated + public SearchIndex setEncryptionKey(SearchResourceEncryptionKey encryptionKey) { + this.encryptionKey = encryptionKey; + return this; + } + + /** + * Get the similarity property: The type of similarity algorithm to be used when scoring and ranking the documents + * matching a search query. The similarity algorithm can only be defined at index creation time and cannot be + * modified on existing indexes. If null, the ClassicSimilarity algorithm is used. + * + * @return the similarity value. + */ + @Generated + public Similarity getSimilarity() { + return this.similarity; + } + + /** + * Set the similarity property: The type of similarity algorithm to be used when scoring and ranking the documents + * matching a search query. The similarity algorithm can only be defined at index creation time and cannot be + * modified on existing indexes. If null, the ClassicSimilarity algorithm is used. + * + * @param similarity the similarity value to set. + * @return the SearchIndex object itself. + */ + @Generated + public SearchIndex setSimilarity(Similarity similarity) { + this.similarity = similarity; + return this; + } + + /** + * Get the semanticSearch property: Defines parameters for a search index that influence semantic capabilities. + * + * @return the semanticSearch value. + */ + @Generated + public SemanticSearch getSemanticSearch() { + return this.semanticSearch; + } + + /** + * Set the semanticSearch property: Defines parameters for a search index that influence semantic capabilities. + * + * @param semanticSearch the semanticSearch value to set. + * @return the SearchIndex object itself. + */ + @Generated + public SearchIndex setSemanticSearch(SemanticSearch semanticSearch) { + this.semanticSearch = semanticSearch; + return this; + } + + /** + * Get the vectorSearch property: Contains configuration options related to vector search. + * + * @return the vectorSearch value. + */ + @Generated + public VectorSearch getVectorSearch() { + return this.vectorSearch; + } + + /** + * Set the vectorSearch property: Contains configuration options related to vector search. + * + * @param vectorSearch the vectorSearch value to set. + * @return the SearchIndex object itself. + */ + @Generated + public SearchIndex setVectorSearch(VectorSearch vectorSearch) { + this.vectorSearch = vectorSearch; + return this; + } + + /** + * Get the permissionFilterOption property: A value indicating whether permission filtering is enabled for the + * index. + * + * @return the permissionFilterOption value. + */ + @Generated + public SearchIndexPermissionFilterOption getPermissionFilterOption() { + return this.permissionFilterOption; + } + + /** + * Set the permissionFilterOption property: A value indicating whether permission filtering is enabled for the + * index. + * + * @param permissionFilterOption the permissionFilterOption value to set. + * @return the SearchIndex object itself. + */ + @Generated + public SearchIndex setPermissionFilterOption(SearchIndexPermissionFilterOption permissionFilterOption) { + this.permissionFilterOption = permissionFilterOption; + return this; + } + + /** + * Get the purviewEnabled property: A value indicating whether the index is leveraging Purview-specific features. + * This property defaults to false and cannot be changed after index creation. + * + * @return the purviewEnabled value. + */ + @Generated + public Boolean isPurviewEnabled() { + return this.purviewEnabled; + } + + /** + * Set the purviewEnabled property: A value indicating whether the index is leveraging Purview-specific features. + * This property defaults to false and cannot be changed after index creation. + * + * @param purviewEnabled the purviewEnabled value to set. + * @return the SearchIndex object itself. + */ + @Generated + public SearchIndex setPurviewEnabled(Boolean purviewEnabled) { + this.purviewEnabled = purviewEnabled; + return this; + } + + /** + * Get the eTag property: The ETag of the index. + * + * @return the eTag value. + */ + @Generated + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag of the index. + * + * @param eTag the eTag value to set. + * @return the SearchIndex object itself. + */ + @Generated + public SearchIndex setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeArrayField("fields", this.fields, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeArrayField("scoringProfiles", this.scoringProfiles, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("defaultScoringProfile", this.defaultScoringProfile); + jsonWriter.writeJsonField("corsOptions", this.corsOptions); + jsonWriter.writeArrayField("suggesters", this.suggesters, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("analyzers", this.analyzers, (writer, element) -> writer.writeJson(element)); + 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); + jsonWriter.writeJsonField("vectorSearch", this.vectorSearch); + jsonWriter.writeStringField("permissionFilterOption", + this.permissionFilterOption == null ? null : this.permissionFilterOption.toString()); + jsonWriter.writeBooleanField("purviewEnabled", this.purviewEnabled); + jsonWriter.writeStringField("@odata.etag", this.eTag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndex from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndex 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 SearchIndex. + */ + @Generated + public static SearchIndex fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndex deserializedSearchIndex = new SearchIndex(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSearchIndex.name = reader.getString(); + } else if ("fields".equals(fieldName)) { + List fields = reader.readArray(reader1 -> SearchField.fromJson(reader1)); + deserializedSearchIndex.fields = fields; + } else if ("description".equals(fieldName)) { + deserializedSearchIndex.description = reader.getString(); + } else if ("scoringProfiles".equals(fieldName)) { + List scoringProfiles + = reader.readArray(reader1 -> ScoringProfile.fromJson(reader1)); + deserializedSearchIndex.scoringProfiles = scoringProfiles; + } else if ("defaultScoringProfile".equals(fieldName)) { + deserializedSearchIndex.defaultScoringProfile = reader.getString(); + } else if ("corsOptions".equals(fieldName)) { + deserializedSearchIndex.corsOptions = CorsOptions.fromJson(reader); + } else if ("suggesters".equals(fieldName)) { + List suggesters = reader.readArray(reader1 -> Suggester.fromJson(reader1)); + deserializedSearchIndex.suggesters = suggesters; + } else if ("analyzers".equals(fieldName)) { + List analyzers = reader.readArray(reader1 -> LexicalAnalyzer.fromJson(reader1)); + deserializedSearchIndex.analyzers = analyzers; + } else if ("tokenizers".equals(fieldName)) { + List tokenizers = reader.readArray(reader1 -> LexicalTokenizer.fromJson(reader1)); + deserializedSearchIndex.tokenizers = tokenizers; + } else if ("tokenFilters".equals(fieldName)) { + List tokenFilters = reader.readArray(reader1 -> TokenFilter.fromJson(reader1)); + deserializedSearchIndex.tokenFilters = tokenFilters; + } else if ("charFilters".equals(fieldName)) { + List charFilters = reader.readArray(reader1 -> CharFilter.fromJson(reader1)); + deserializedSearchIndex.charFilters = charFilters; + } else if ("normalizers".equals(fieldName)) { + List normalizers + = reader.readArray(reader1 -> LexicalNormalizer.fromJson(reader1)); + deserializedSearchIndex.normalizers = normalizers; + } else if ("encryptionKey".equals(fieldName)) { + deserializedSearchIndex.encryptionKey = SearchResourceEncryptionKey.fromJson(reader); + } else if ("similarity".equals(fieldName)) { + deserializedSearchIndex.similarity = Similarity.fromJson(reader); + } else if ("semantic".equals(fieldName)) { + deserializedSearchIndex.semanticSearch = SemanticSearch.fromJson(reader); + } else if ("vectorSearch".equals(fieldName)) { + deserializedSearchIndex.vectorSearch = VectorSearch.fromJson(reader); + } else if ("permissionFilterOption".equals(fieldName)) { + deserializedSearchIndex.permissionFilterOption + = SearchIndexPermissionFilterOption.fromString(reader.getString()); + } else if ("purviewEnabled".equals(fieldName)) { + deserializedSearchIndex.purviewEnabled = reader.getNullable(JsonReader::getBoolean); + } else if ("@odata.etag".equals(fieldName)) { + deserializedSearchIndex.eTag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndex; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSource.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSource.java new file mode 100644 index 000000000000..65e62e45f6ef --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSource.java @@ -0,0 +1,168 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Knowledge Source targeting a search index. + */ +@Fluent +public final class SearchIndexKnowledgeSource extends KnowledgeSource { + /* + * The type of the knowledge source. + */ + @Generated + private KnowledgeSourceKind kind = KnowledgeSourceKind.SEARCH_INDEX; + + /* + * The parameters for the knowledge source. + */ + @Generated + private SearchIndexKnowledgeSourceParameters searchIndexParameters; + + /** + * Creates an instance of SearchIndexKnowledgeSource class. + */ + @Generated + public SearchIndexKnowledgeSource() { + } + + /** + * Get the kind property: The type of the knowledge source. + * + * @return the kind value. + */ + @Generated + @Override + public KnowledgeSourceKind getKind() { + return this.kind; + } + + /** + * Get the searchIndexParameters property: The parameters for the knowledge source. + * + * @return the searchIndexParameters value. + */ + @Generated + public SearchIndexKnowledgeSourceParameters getSearchIndexParameters() { + return this.searchIndexParameters; + } + + /** + * Set the searchIndexParameters property: The parameters for the knowledge source. + * + * @param searchIndexParameters the searchIndexParameters value to set. + * @return the SearchIndexKnowledgeSource object itself. + */ + @Generated + public SearchIndexKnowledgeSource + setSearchIndexParameters(SearchIndexKnowledgeSourceParameters searchIndexParameters) { + this.searchIndexParameters = searchIndexParameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexKnowledgeSource setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexKnowledgeSource setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexKnowledgeSource setETag(String eTag) { + super.setETag(eTag); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexKnowledgeSource setEncryptionKey(SearchResourceEncryptionKey encryptionKey) { + super.setEncryptionKey(encryptionKey); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("description", getDescription()); + jsonWriter.writeStringField("@odata.etag", getETag()); + jsonWriter.writeJsonField("encryptionKey", getEncryptionKey()); + jsonWriter.writeJsonField("searchIndexParameters", this.searchIndexParameters); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexKnowledgeSource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexKnowledgeSource 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 SearchIndexKnowledgeSource. + */ + @Generated + public static SearchIndexKnowledgeSource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexKnowledgeSource deserializedSearchIndexKnowledgeSource = new SearchIndexKnowledgeSource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSearchIndexKnowledgeSource.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedSearchIndexKnowledgeSource.setDescription(reader.getString()); + } else if ("@odata.etag".equals(fieldName)) { + deserializedSearchIndexKnowledgeSource.setETag(reader.getString()); + } else if ("encryptionKey".equals(fieldName)) { + deserializedSearchIndexKnowledgeSource + .setEncryptionKey(SearchResourceEncryptionKey.fromJson(reader)); + } else if ("searchIndexParameters".equals(fieldName)) { + deserializedSearchIndexKnowledgeSource.searchIndexParameters + = SearchIndexKnowledgeSourceParameters.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedSearchIndexKnowledgeSource.kind = KnowledgeSourceKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexKnowledgeSource; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSourceParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSourceParameters.java new file mode 100644 index 000000000000..6a951871f442 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSourceParameters.java @@ -0,0 +1,199 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Parameters for search index knowledge source. + */ +@Fluent +public final class SearchIndexKnowledgeSourceParameters + implements JsonSerializable { + /* + * The name of the Search index. + */ + @Generated + private String searchIndexName; + + /* + * Used to request additional fields for referenced source data. + */ + @Generated + private List sourceDataFields; + + /* + * Used to restrict which fields to search on the search index. + */ + @Generated + private List searchFields; + + /* + * Used to specify a different semantic configuration on the target search index other than the default one. + */ + @Generated + private String semanticConfigurationName; + + /** + * Creates an instance of SearchIndexKnowledgeSourceParameters class. + */ + @Generated + public SearchIndexKnowledgeSourceParameters() { + } + + /** + * Get the searchIndexName property: The name of the Search index. + * + * @return the searchIndexName value. + */ + @Generated + public String getSearchIndexName() { + return this.searchIndexName; + } + + /** + * Set the searchIndexName property: The name of the Search index. + * + * @param searchIndexName the searchIndexName value to set. + * @return the SearchIndexKnowledgeSourceParameters object itself. + */ + @Generated + public SearchIndexKnowledgeSourceParameters setSearchIndexName(String searchIndexName) { + this.searchIndexName = searchIndexName; + return this; + } + + /** + * Get the sourceDataFields property: Used to request additional fields for referenced source data. + * + * @return the sourceDataFields value. + */ + @Generated + public List getSourceDataFields() { + return this.sourceDataFields; + } + + /** + * Set the sourceDataFields property: Used to request additional fields for referenced source data. + * + * @param sourceDataFields the sourceDataFields value to set. + * @return the SearchIndexKnowledgeSourceParameters object itself. + */ + @Generated + public SearchIndexKnowledgeSourceParameters + setSourceDataFields(List sourceDataFields) { + this.sourceDataFields = sourceDataFields; + return this; + } + + /** + * Get the searchFields property: Used to restrict which fields to search on the search index. + * + * @return the searchFields value. + */ + @Generated + public List getSearchFields() { + return this.searchFields; + } + + /** + * Set the searchFields property: Used to restrict which fields to search on the search index. + * + * @param searchFields the searchFields value to set. + * @return the SearchIndexKnowledgeSourceParameters object itself. + */ + @Generated + public SearchIndexKnowledgeSourceParameters + setSearchFields(List searchFields) { + this.searchFields = searchFields; + return this; + } + + /** + * Get the semanticConfigurationName property: Used to specify a different semantic configuration on the target + * search index other than the default one. + * + * @return the semanticConfigurationName value. + */ + @Generated + public String getSemanticConfigurationName() { + return this.semanticConfigurationName; + } + + /** + * Set the semanticConfigurationName property: Used to specify a different semantic configuration on the target + * search index other than the default one. + * + * @param semanticConfigurationName the semanticConfigurationName value to set. + * @return the SearchIndexKnowledgeSourceParameters object itself. + */ + @Generated + public SearchIndexKnowledgeSourceParameters setSemanticConfigurationName(String semanticConfigurationName) { + this.semanticConfigurationName = semanticConfigurationName; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("searchIndexName", this.searchIndexName); + jsonWriter.writeArrayField("sourceDataFields", this.sourceDataFields, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("searchFields", this.searchFields, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("semanticConfigurationName", this.semanticConfigurationName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexKnowledgeSourceParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexKnowledgeSourceParameters 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 SearchIndexKnowledgeSourceParameters. + */ + @Generated + public static SearchIndexKnowledgeSourceParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexKnowledgeSourceParameters deserializedSearchIndexKnowledgeSourceParameters + = new SearchIndexKnowledgeSourceParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("searchIndexName".equals(fieldName)) { + deserializedSearchIndexKnowledgeSourceParameters.searchIndexName = reader.getString(); + } else if ("sourceDataFields".equals(fieldName)) { + List sourceDataFields = reader.readArray( + reader1 -> SearchIndexKnowledgeSourceParametersSourceDataFieldsItem.fromJson(reader1)); + deserializedSearchIndexKnowledgeSourceParameters.sourceDataFields = sourceDataFields; + } else if ("searchFields".equals(fieldName)) { + List searchFields = reader + .readArray(reader1 -> SearchIndexKnowledgeSourceParametersSearchFieldsItem.fromJson(reader1)); + deserializedSearchIndexKnowledgeSourceParameters.searchFields = searchFields; + } else if ("semanticConfigurationName".equals(fieldName)) { + deserializedSearchIndexKnowledgeSourceParameters.semanticConfigurationName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexKnowledgeSourceParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSourceParametersSearchFieldsItem.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSourceParametersSearchFieldsItem.java new file mode 100644 index 000000000000..afbff09a9d50 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSourceParametersSearchFieldsItem.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 SearchIndexKnowledgeSourceParametersSearchFieldsItem model. + */ +@Fluent +public final class SearchIndexKnowledgeSourceParametersSearchFieldsItem + implements JsonSerializable { + /* + * The name property. + */ + @Generated + private String name; + + /** + * Creates an instance of SearchIndexKnowledgeSourceParametersSearchFieldsItem class. + */ + @Generated + public SearchIndexKnowledgeSourceParametersSearchFieldsItem() { + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the SearchIndexKnowledgeSourceParametersSearchFieldsItem object itself. + */ + @Generated + public SearchIndexKnowledgeSourceParametersSearchFieldsItem setName(String name) { + this.name = name; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexKnowledgeSourceParametersSearchFieldsItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexKnowledgeSourceParametersSearchFieldsItem 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 SearchIndexKnowledgeSourceParametersSearchFieldsItem. + */ + @Generated + public static SearchIndexKnowledgeSourceParametersSearchFieldsItem fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexKnowledgeSourceParametersSearchFieldsItem deserializedSearchIndexKnowledgeSourceParametersSearchFieldsItem + = new SearchIndexKnowledgeSourceParametersSearchFieldsItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSearchIndexKnowledgeSourceParametersSearchFieldsItem.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexKnowledgeSourceParametersSearchFieldsItem; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSourceParametersSourceDataFieldsItem.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSourceParametersSourceDataFieldsItem.java new file mode 100644 index 000000000000..2ed44cd21176 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSourceParametersSourceDataFieldsItem.java @@ -0,0 +1,98 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 SearchIndexKnowledgeSourceParametersSourceDataFieldsItem model. + */ +@Fluent +public final class SearchIndexKnowledgeSourceParametersSourceDataFieldsItem + implements JsonSerializable { + /* + * The name property. + */ + @Generated + private String name; + + /** + * Creates an instance of SearchIndexKnowledgeSourceParametersSourceDataFieldsItem class. + */ + @Generated + public SearchIndexKnowledgeSourceParametersSourceDataFieldsItem() { + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the SearchIndexKnowledgeSourceParametersSourceDataFieldsItem object itself. + */ + @Generated + public SearchIndexKnowledgeSourceParametersSourceDataFieldsItem setName(String name) { + this.name = name; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexKnowledgeSourceParametersSourceDataFieldsItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexKnowledgeSourceParametersSourceDataFieldsItem 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 + * SearchIndexKnowledgeSourceParametersSourceDataFieldsItem. + */ + @Generated + public static SearchIndexKnowledgeSourceParametersSourceDataFieldsItem fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexKnowledgeSourceParametersSourceDataFieldsItem deserializedSearchIndexKnowledgeSourceParametersSourceDataFieldsItem + = new SearchIndexKnowledgeSourceParametersSourceDataFieldsItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSearchIndexKnowledgeSourceParametersSourceDataFieldsItem.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexKnowledgeSourceParametersSourceDataFieldsItem; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSourceParams.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSourceParams.java new file mode 100644 index 000000000000..b9d70f5275c8 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexKnowledgeSourceParams.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specifies runtime parameters for a search index knowledge source. + */ +@Fluent +public final class SearchIndexKnowledgeSourceParams extends KnowledgeSourceParams { + /* + * The type of the knowledge source. + */ + @Generated + private KnowledgeSourceKind kind = KnowledgeSourceKind.SEARCH_INDEX; + + /* + * A filter condition applied to the index (e.g., 'State eq VA'). + */ + @Generated + private String filterAddOn; + + /** + * Creates an instance of SearchIndexKnowledgeSourceParams class. + */ + @Generated + public SearchIndexKnowledgeSourceParams() { + } + + /** + * Get the kind property: The type of the knowledge source. + * + * @return the kind value. + */ + @Generated + @Override + public KnowledgeSourceKind getKind() { + return this.kind; + } + + /** + * Get the filterAddOn property: A filter condition applied to the index (e.g., 'State eq VA'). + * + * @return the filterAddOn value. + */ + @Generated + public String getFilterAddOn() { + return this.filterAddOn; + } + + /** + * Set the filterAddOn property: A filter condition applied to the index (e.g., 'State eq VA'). + * + * @param filterAddOn the filterAddOn value to set. + * @return the SearchIndexKnowledgeSourceParams object itself. + */ + @Generated + public SearchIndexKnowledgeSourceParams setFilterAddOn(String filterAddOn) { + this.filterAddOn = filterAddOn; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexKnowledgeSourceParams setKnowledgeSourceName(String knowledgeSourceName) { + super.setKnowledgeSourceName(knowledgeSourceName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexKnowledgeSourceParams setIncludeReferences(Boolean includeReferences) { + super.setIncludeReferences(includeReferences); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexKnowledgeSourceParams setIncludeReferenceSourceData(Boolean includeReferenceSourceData) { + super.setIncludeReferenceSourceData(includeReferenceSourceData); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexKnowledgeSourceParams setAlwaysQuerySource(Boolean alwaysQuerySource) { + super.setAlwaysQuerySource(alwaysQuerySource); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexKnowledgeSourceParams setRerankerThreshold(Float rerankerThreshold) { + super.setRerankerThreshold(rerankerThreshold); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("knowledgeSourceName", getKnowledgeSourceName()); + jsonWriter.writeBooleanField("includeReferences", isIncludeReferences()); + jsonWriter.writeBooleanField("includeReferenceSourceData", isIncludeReferenceSourceData()); + jsonWriter.writeBooleanField("alwaysQuerySource", isAlwaysQuerySource()); + jsonWriter.writeNumberField("rerankerThreshold", getRerankerThreshold()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("filterAddOn", this.filterAddOn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexKnowledgeSourceParams from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexKnowledgeSourceParams 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 SearchIndexKnowledgeSourceParams. + */ + @Generated + public static SearchIndexKnowledgeSourceParams fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexKnowledgeSourceParams deserializedSearchIndexKnowledgeSourceParams + = new SearchIndexKnowledgeSourceParams(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("knowledgeSourceName".equals(fieldName)) { + deserializedSearchIndexKnowledgeSourceParams.setKnowledgeSourceName(reader.getString()); + } else if ("includeReferences".equals(fieldName)) { + deserializedSearchIndexKnowledgeSourceParams + .setIncludeReferences(reader.getNullable(JsonReader::getBoolean)); + } else if ("includeReferenceSourceData".equals(fieldName)) { + deserializedSearchIndexKnowledgeSourceParams + .setIncludeReferenceSourceData(reader.getNullable(JsonReader::getBoolean)); + } else if ("alwaysQuerySource".equals(fieldName)) { + deserializedSearchIndexKnowledgeSourceParams + .setAlwaysQuerySource(reader.getNullable(JsonReader::getBoolean)); + } else if ("rerankerThreshold".equals(fieldName)) { + deserializedSearchIndexKnowledgeSourceParams + .setRerankerThreshold(reader.getNullable(JsonReader::getFloat)); + } else if ("kind".equals(fieldName)) { + deserializedSearchIndexKnowledgeSourceParams.kind + = KnowledgeSourceKind.fromString(reader.getString()); + } else if ("filterAddOn".equals(fieldName)) { + deserializedSearchIndexKnowledgeSourceParams.filterAddOn = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexKnowledgeSourceParams; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexPermissionFilterOption.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexPermissionFilterOption.java new file mode 100644 index 000000000000..a033afa3cc4c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexPermissionFilterOption.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * A value indicating whether permission filtering is enabled for the index. + */ +public final class SearchIndexPermissionFilterOption extends ExpandableStringEnum { + /** + * Static value enabled for SearchIndexPermissionFilterOption. + */ + @Generated + public static final SearchIndexPermissionFilterOption ENABLED = fromString("enabled"); + + /** + * Static value disabled for SearchIndexPermissionFilterOption. + */ + @Generated + public static final SearchIndexPermissionFilterOption DISABLED = fromString("disabled"); + + /** + * Creates a new instance of SearchIndexPermissionFilterOption value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public SearchIndexPermissionFilterOption() { + } + + /** + * Creates or finds a SearchIndexPermissionFilterOption from its string representation. + * + * @param name a name to look for. + * @return the corresponding SearchIndexPermissionFilterOption. + */ + @Generated + public static SearchIndexPermissionFilterOption fromString(String name) { + return fromString(name, SearchIndexPermissionFilterOption.class); + } + + /** + * Gets known SearchIndexPermissionFilterOption values. + * + * @return known SearchIndexPermissionFilterOption values. + */ + @Generated + public static Collection values() { + return values(SearchIndexPermissionFilterOption.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexer.java new file mode 100644 index 000000000000..feb9adfac77e --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexer.java @@ -0,0 +1,498 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 an indexer. + */ +@Fluent +public final class SearchIndexer implements JsonSerializable { + /* + * The name of the indexer. + */ + @Generated + private String name; + + /* + * The description of the indexer. + */ + @Generated + private String description; + + /* + * The name of the datasource from which this indexer reads data. + */ + @Generated + private String dataSourceName; + + /* + * The name of the skillset executing with this indexer. + */ + @Generated + private String skillsetName; + + /* + * The name of the index to which this indexer writes data. + */ + @Generated + private String targetIndexName; + + /* + * The schedule for this indexer. + */ + @Generated + private IndexingSchedule schedule; + + /* + * Parameters for indexer execution. + */ + @Generated + private IndexingParameters parameters; + + /* + * Defines mappings between fields in the data source and corresponding target fields in the index. + */ + @Generated + private List fieldMappings; + + /* + * Output field mappings are applied after enrichment and immediately before indexing. + */ + @Generated + private List outputFieldMappings; + + /* + * A value indicating whether the indexer is disabled. Default is false. + */ + @Generated + private Boolean isDisabled; + + /* + * The ETag of the indexer. + */ + @Generated + private String eTag; + + /* + * 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 indexer definition (as well as indexer execution status) when you want full + * assurance that no one, not even Microsoft, can decrypt them. Once you have encrypted your indexer definition, it + * will always remain encrypted. The search service will ignore attempts to set this property to null. You can + * change this property as needed if you want to rotate your encryption key; Your indexer definition (and indexer + * execution status) will be unaffected. Encryption with customer-managed keys is not available for free search + * services, and is only available for paid services created on or after January 1, 2019. + */ + @Generated + private SearchResourceEncryptionKey encryptionKey; + + /* + * Adds caching to an enrichment pipeline to allow for incremental modification steps without having to rebuild the + * index every time. + */ + @Generated + private SearchIndexerCache cache; + + /** + * Creates an instance of SearchIndexer class. + */ + @Generated + public SearchIndexer() { + } + + /** + * Get the name property: The name of the indexer. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the indexer. + * + * @param name the name value to set. + * @return the SearchIndexer object itself. + */ + @Generated + public SearchIndexer setName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: The description of the indexer. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description of the indexer. + * + * @param description the description value to set. + * @return the SearchIndexer object itself. + */ + @Generated + public SearchIndexer setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the dataSourceName property: The name of the datasource from which this indexer reads data. + * + * @return the dataSourceName value. + */ + @Generated + public String getDataSourceName() { + return this.dataSourceName; + } + + /** + * Set the dataSourceName property: The name of the datasource from which this indexer reads data. + * + * @param dataSourceName the dataSourceName value to set. + * @return the SearchIndexer object itself. + */ + @Generated + public SearchIndexer setDataSourceName(String dataSourceName) { + this.dataSourceName = dataSourceName; + return this; + } + + /** + * Get the skillsetName property: The name of the skillset executing with this indexer. + * + * @return the skillsetName value. + */ + @Generated + public String getSkillsetName() { + return this.skillsetName; + } + + /** + * Set the skillsetName property: The name of the skillset executing with this indexer. + * + * @param skillsetName the skillsetName value to set. + * @return the SearchIndexer object itself. + */ + @Generated + public SearchIndexer setSkillsetName(String skillsetName) { + this.skillsetName = skillsetName; + return this; + } + + /** + * Get the targetIndexName property: The name of the index to which this indexer writes data. + * + * @return the targetIndexName value. + */ + @Generated + public String getTargetIndexName() { + return this.targetIndexName; + } + + /** + * Set the targetIndexName property: The name of the index to which this indexer writes data. + * + * @param targetIndexName the targetIndexName value to set. + * @return the SearchIndexer object itself. + */ + @Generated + public SearchIndexer setTargetIndexName(String targetIndexName) { + this.targetIndexName = targetIndexName; + return this; + } + + /** + * Get the schedule property: The schedule for this indexer. + * + * @return the schedule value. + */ + @Generated + public IndexingSchedule getSchedule() { + return this.schedule; + } + + /** + * Set the schedule property: The schedule for this indexer. + * + * @param schedule the schedule value to set. + * @return the SearchIndexer object itself. + */ + @Generated + public SearchIndexer setSchedule(IndexingSchedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Get the parameters property: Parameters for indexer execution. + * + * @return the parameters value. + */ + @Generated + public IndexingParameters getParameters() { + return this.parameters; + } + + /** + * Set the parameters property: Parameters for indexer execution. + * + * @param parameters the parameters value to set. + * @return the SearchIndexer object itself. + */ + @Generated + public SearchIndexer setParameters(IndexingParameters parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the fieldMappings property: Defines mappings between fields in the data source and corresponding target + * fields in the index. + * + * @return the fieldMappings value. + */ + @Generated + public List getFieldMappings() { + return this.fieldMappings; + } + + /** + * Set the fieldMappings property: Defines mappings between fields in the data source and corresponding target + * fields in the index. + * + * @param fieldMappings the fieldMappings value to set. + * @return the SearchIndexer object itself. + */ + @Generated + public SearchIndexer setFieldMappings(List fieldMappings) { + this.fieldMappings = fieldMappings; + return this; + } + + /** + * Get the outputFieldMappings property: Output field mappings are applied after enrichment and immediately before + * indexing. + * + * @return the outputFieldMappings value. + */ + @Generated + public List getOutputFieldMappings() { + return this.outputFieldMappings; + } + + /** + * Set the outputFieldMappings property: Output field mappings are applied after enrichment and immediately before + * indexing. + * + * @param outputFieldMappings the outputFieldMappings value to set. + * @return the SearchIndexer object itself. + */ + @Generated + public SearchIndexer setOutputFieldMappings(List outputFieldMappings) { + this.outputFieldMappings = outputFieldMappings; + return this; + } + + /** + * Get the isDisabled property: A value indicating whether the indexer is disabled. Default is false. + * + * @return the isDisabled value. + */ + @Generated + public Boolean isDisabled() { + return this.isDisabled; + } + + /** + * Set the isDisabled property: A value indicating whether the indexer is disabled. Default is false. + * + * @param isDisabled the isDisabled value to set. + * @return the SearchIndexer object itself. + */ + @Generated + public SearchIndexer setIsDisabled(Boolean isDisabled) { + this.isDisabled = isDisabled; + return this; + } + + /** + * Get the eTag property: The ETag of the indexer. + * + * @return the eTag value. + */ + @Generated + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag of the indexer. + * + * @param eTag the eTag value to set. + * @return the SearchIndexer object itself. + */ + @Generated + public SearchIndexer setETag(String eTag) { + this.eTag = eTag; + 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 indexer definition (as well as indexer + * execution status) when you want full assurance that no one, not even Microsoft, can decrypt them. Once you have + * encrypted your indexer definition, it will always remain encrypted. The search service will ignore attempts to + * set this property to null. You can change this property as needed if you want to rotate your encryption key; Your + * indexer definition (and indexer execution status) will be unaffected. Encryption with customer-managed keys is + * not available for free search services, and is only available for paid services created on or after January 1, + * 2019. + * + * @return the encryptionKey value. + */ + @Generated + public SearchResourceEncryptionKey getEncryptionKey() { + return this.encryptionKey; + } + + /** + * Set 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 indexer definition (as well as indexer + * execution status) when you want full assurance that no one, not even Microsoft, can decrypt them. Once you have + * encrypted your indexer definition, it will always remain encrypted. The search service will ignore attempts to + * set this property to null. You can change this property as needed if you want to rotate your encryption key; Your + * indexer definition (and indexer execution status) will be unaffected. Encryption with customer-managed keys is + * not available for free search services, and is only available for paid services created on or after January 1, + * 2019. + * + * @param encryptionKey the encryptionKey value to set. + * @return the SearchIndexer object itself. + */ + @Generated + public SearchIndexer setEncryptionKey(SearchResourceEncryptionKey encryptionKey) { + this.encryptionKey = 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. + */ + @Generated + 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. + */ + @Generated + public SearchIndexer setCache(SearchIndexerCache cache) { + this.cache = cache; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("dataSourceName", this.dataSourceName); + jsonWriter.writeStringField("targetIndexName", this.targetIndexName); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("skillsetName", this.skillsetName); + jsonWriter.writeJsonField("schedule", this.schedule); + jsonWriter.writeJsonField("parameters", this.parameters); + jsonWriter.writeArrayField("fieldMappings", this.fieldMappings, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("outputFieldMappings", this.outputFieldMappings, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeBooleanField("disabled", this.isDisabled); + jsonWriter.writeStringField("@odata.etag", this.eTag); + jsonWriter.writeJsonField("encryptionKey", this.encryptionKey); + jsonWriter.writeJsonField("cache", this.cache); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexer 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 SearchIndexer. + */ + @Generated + public static SearchIndexer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexer deserializedSearchIndexer = new SearchIndexer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSearchIndexer.name = reader.getString(); + } else if ("dataSourceName".equals(fieldName)) { + deserializedSearchIndexer.dataSourceName = reader.getString(); + } else if ("targetIndexName".equals(fieldName)) { + deserializedSearchIndexer.targetIndexName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedSearchIndexer.description = reader.getString(); + } else if ("skillsetName".equals(fieldName)) { + deserializedSearchIndexer.skillsetName = reader.getString(); + } else if ("schedule".equals(fieldName)) { + deserializedSearchIndexer.schedule = IndexingSchedule.fromJson(reader); + } else if ("parameters".equals(fieldName)) { + deserializedSearchIndexer.parameters = IndexingParameters.fromJson(reader); + } else if ("fieldMappings".equals(fieldName)) { + List fieldMappings = reader.readArray(reader1 -> FieldMapping.fromJson(reader1)); + deserializedSearchIndexer.fieldMappings = fieldMappings; + } else if ("outputFieldMappings".equals(fieldName)) { + List outputFieldMappings + = reader.readArray(reader1 -> FieldMapping.fromJson(reader1)); + deserializedSearchIndexer.outputFieldMappings = outputFieldMappings; + } else if ("disabled".equals(fieldName)) { + deserializedSearchIndexer.isDisabled = reader.getNullable(JsonReader::getBoolean); + } else if ("@odata.etag".equals(fieldName)) { + deserializedSearchIndexer.eTag = reader.getString(); + } else if ("encryptionKey".equals(fieldName)) { + deserializedSearchIndexer.encryptionKey = SearchResourceEncryptionKey.fromJson(reader); + } else if ("cache".equals(fieldName)) { + deserializedSearchIndexer.cache = SearchIndexerCache.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerCache.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerCache.java new file mode 100644 index 000000000000..161ad319e437 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerCache.java @@ -0,0 +1,197 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 { + /* + * A guid for the SearchIndexerCache. + */ + @Generated + private String id; + + /* + * The connection string to the storage account where the cache data will be persisted. + */ + @Generated + private String storageConnectionString; + + /* + * Specifies whether incremental reprocessing is enabled. + */ + @Generated + 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. + */ + @Generated + private SearchIndexerDataIdentity identity; + + /** + * Creates an instance of SearchIndexerCache class. + */ + @Generated + public SearchIndexerCache() { + } + + /** + * Get the id property: A guid for the SearchIndexerCache. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Set the id property: A guid for the SearchIndexerCache. + * + * @param id the id value to set. + * @return the SearchIndexerCache object itself. + */ + @Generated + public SearchIndexerCache setId(String id) { + this.id = id; + return this; + } + + /** + * Get the storageConnectionString property: The connection string to the storage account where the cache data will + * be persisted. + * + * @return the storageConnectionString value. + */ + @Generated + 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. + */ + @Generated + public SearchIndexerCache setStorageConnectionString(String storageConnectionString) { + this.storageConnectionString = storageConnectionString; + return this; + } + + /** + * Get the enableReprocessing property: Specifies whether incremental reprocessing is enabled. + * + * @return the enableReprocessing value. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + public SearchIndexerCache setIdentity(SearchIndexerDataIdentity identity) { + this.identity = identity; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + 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. + */ + @Generated + 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 ("id".equals(fieldName)) { + deserializedSearchIndexerCache.id = reader.getString(); + } else 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/search/src/main/java/com/azure/search/models/SearchIndexerDataContainer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataContainer.java new file mode 100644 index 000000000000..3569812dcd37 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataContainer.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents information about the entity (such as Azure SQL table or CosmosDB collection) that will be indexed. + */ +@Fluent +public final class SearchIndexerDataContainer implements JsonSerializable { + /* + * The name of the table or view (for Azure SQL data source) or collection (for CosmosDB data source) that will be + * indexed. + */ + @Generated + private String name; + + /* + * A query that is applied to this data container. The syntax and meaning of this parameter is datasource-specific. + * Not supported by Azure SQL datasources. + */ + @Generated + private String query; + + /** + * Creates an instance of SearchIndexerDataContainer class. + */ + @Generated + public SearchIndexerDataContainer() { + } + + /** + * Get the name property: The name of the table or view (for Azure SQL data source) or collection (for CosmosDB data + * source) that will be indexed. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the table or view (for Azure SQL data source) or collection (for CosmosDB data + * source) that will be indexed. + * + * @param name the name value to set. + * @return the SearchIndexerDataContainer object itself. + */ + @Generated + public SearchIndexerDataContainer setName(String name) { + this.name = name; + return this; + } + + /** + * Get the query property: A query that is applied to this data container. The syntax and meaning of this parameter + * is datasource-specific. Not supported by Azure SQL datasources. + * + * @return the query value. + */ + @Generated + public String getQuery() { + return this.query; + } + + /** + * Set the query property: A query that is applied to this data container. The syntax and meaning of this parameter + * is datasource-specific. Not supported by Azure SQL datasources. + * + * @param query the query value to set. + * @return the SearchIndexerDataContainer object itself. + */ + @Generated + public SearchIndexerDataContainer setQuery(String query) { + this.query = query; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("query", this.query); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerDataContainer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerDataContainer 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 SearchIndexerDataContainer. + */ + @Generated + public static SearchIndexerDataContainer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerDataContainer deserializedSearchIndexerDataContainer = new SearchIndexerDataContainer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSearchIndexerDataContainer.name = reader.getString(); + } else if ("query".equals(fieldName)) { + deserializedSearchIndexerDataContainer.query = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerDataContainer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataIdentity.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataIdentity.java new file mode 100644 index 000000000000..1393c1738481 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataIdentity.java @@ -0,0 +1,109 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Abstract base type for data identities. + */ +@Immutable +public class SearchIndexerDataIdentity implements JsonSerializable { + /* + * A URI fragment specifying the type of identity. + */ + @Generated + private String odataType = "SearchIndexerDataIdentity"; + + /** + * Creates an instance of SearchIndexerDataIdentity class. + */ + @Generated + public SearchIndexerDataIdentity() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of identity. + * + * @return the odataType value. + */ + @Generated + public String getOdataType() { + return this.odataType; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerDataIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerDataIdentity 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 SearchIndexerDataIdentity. + */ + @Generated + public static SearchIndexerDataIdentity 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.DataNoneIdentity".equals(discriminatorValue)) { + return SearchIndexerDataNoneIdentity.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.DataUserAssignedIdentity".equals(discriminatorValue)) { + return SearchIndexerDataUserAssignedIdentity.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static SearchIndexerDataIdentity fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerDataIdentity deserializedSearchIndexerDataIdentity = new SearchIndexerDataIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("@odata.type".equals(fieldName)) { + deserializedSearchIndexerDataIdentity.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerDataIdentity; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataNoneIdentity.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataNoneIdentity.java new file mode 100644 index 000000000000..b0bd745e2580 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataNoneIdentity.java @@ -0,0 +1,82 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Clears the identity property of a datasource. + */ +@Immutable +public final class SearchIndexerDataNoneIdentity extends SearchIndexerDataIdentity { + /* + * A URI fragment specifying the type of identity. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.DataNoneIdentity"; + + /** + * Creates an instance of SearchIndexerDataNoneIdentity class. + */ + @Generated + public SearchIndexerDataNoneIdentity() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of identity. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerDataNoneIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerDataNoneIdentity 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 SearchIndexerDataNoneIdentity. + */ + @Generated + public static SearchIndexerDataNoneIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerDataNoneIdentity deserializedSearchIndexerDataNoneIdentity + = new SearchIndexerDataNoneIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("@odata.type".equals(fieldName)) { + deserializedSearchIndexerDataNoneIdentity.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerDataNoneIdentity; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataSource.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataSource.java new file mode 100644 index 000000000000..0d9ca7cae6f3 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataSource.java @@ -0,0 +1,456 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 a datasource definition, which can be used to configure an indexer. + */ +@Fluent +public final class SearchIndexerDataSource implements JsonSerializable { + /* + * The name of the datasource. + */ + @Generated + private String name; + + /* + * The description of the datasource. + */ + @Generated + private String description; + + /* + * The type of the datasource. + */ + @Generated + private SearchIndexerDataSourceType type; + + /* + * A specific type of the data source, in case the resource is capable of different modalities. For example, + * 'MongoDb' for certain 'cosmosDb' accounts. + */ + @Generated + private String subType; + + /* + * Credentials for the datasource. + */ + @Generated + private DataSourceCredentials credentials; + + /* + * The data container for the datasource. + */ + @Generated + 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. + */ + @Generated + private SearchIndexerDataIdentity identity; + + /* + * Ingestion options with various types of permission data. + */ + @Generated + private List indexerPermissionOptions; + + /* + * The data change detection policy for the datasource. + */ + @Generated + private DataChangeDetectionPolicy dataChangeDetectionPolicy; + + /* + * The data deletion detection policy for the datasource. + */ + @Generated + private DataDeletionDetectionPolicy dataDeletionDetectionPolicy; + + /* + * The ETag of the data source. + */ + @Generated + private String eTag; + + /* + * 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 datasource definition when you want full assurance that no one, not even + * Microsoft, can decrypt your data source definition. Once you have encrypted your data source definition, it will + * always remain encrypted. The search service will ignore attempts to set this property to null. You can change + * this property as needed if you want to rotate your encryption key; Your datasource definition will be unaffected. + * Encryption with customer-managed keys is not available for free search services, and is only available for paid + * services created on or after January 1, 2019. + */ + @Generated + private SearchResourceEncryptionKey encryptionKey; + + /** + * Creates an instance of SearchIndexerDataSource class. + */ + @Generated + public SearchIndexerDataSource() { + } + + /** + * Get the name property: The name of the datasource. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the datasource. + * + * @param name the name value to set. + * @return the SearchIndexerDataSource object itself. + */ + @Generated + public SearchIndexerDataSource setName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: The description of the datasource. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description of the datasource. + * + * @param description the description value to set. + * @return the SearchIndexerDataSource object itself. + */ + @Generated + public SearchIndexerDataSource setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the type property: The type of the datasource. + * + * @return the type value. + */ + @Generated + public SearchIndexerDataSourceType getType() { + return this.type; + } + + /** + * Set the type property: The type of the datasource. + * + * @param type the type value to set. + * @return the SearchIndexerDataSource object itself. + */ + @Generated + public SearchIndexerDataSource setType(SearchIndexerDataSourceType type) { + this.type = type; + return this; + } + + /** + * Get the subType property: A specific type of the data source, in case the resource is capable of different + * modalities. For example, 'MongoDb' for certain 'cosmosDb' accounts. + * + * @return the subType value. + */ + @Generated + public String getSubType() { + return this.subType; + } + + /** + * Get the credentials property: Credentials for the datasource. + * + * @return the credentials value. + */ + @Generated + public DataSourceCredentials getCredentials() { + return this.credentials; + } + + /** + * Set the credentials property: Credentials for the datasource. + * + * @param credentials the credentials value to set. + * @return the SearchIndexerDataSource object itself. + */ + @Generated + public SearchIndexerDataSource setCredentials(DataSourceCredentials credentials) { + this.credentials = credentials; + return this; + } + + /** + * Get the container property: The data container for the datasource. + * + * @return the container value. + */ + @Generated + public SearchIndexerDataContainer getContainer() { + return this.container; + } + + /** + * Set the container property: The data container for the datasource. + * + * @param container the container value to set. + * @return the SearchIndexerDataSource object itself. + */ + @Generated + public SearchIndexerDataSource setContainer(SearchIndexerDataContainer container) { + this.container = container; + 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. + */ + @Generated + 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 SearchIndexerDataSource object itself. + */ + @Generated + public SearchIndexerDataSource setIdentity(SearchIndexerDataIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the indexerPermissionOptions property: Ingestion options with various types of permission data. + * + * @return the indexerPermissionOptions value. + */ + @Generated + public List getIndexerPermissionOptions() { + return this.indexerPermissionOptions; + } + + /** + * Set the indexerPermissionOptions property: Ingestion options with various types of permission data. + * + * @param indexerPermissionOptions the indexerPermissionOptions value to set. + * @return the SearchIndexerDataSource object itself. + */ + @Generated + public SearchIndexerDataSource setIndexerPermissionOptions(List indexerPermissionOptions) { + this.indexerPermissionOptions = indexerPermissionOptions; + return this; + } + + /** + * Get the dataChangeDetectionPolicy property: The data change detection policy for the datasource. + * + * @return the dataChangeDetectionPolicy value. + */ + @Generated + public DataChangeDetectionPolicy getDataChangeDetectionPolicy() { + return this.dataChangeDetectionPolicy; + } + + /** + * Set the dataChangeDetectionPolicy property: The data change detection policy for the datasource. + * + * @param dataChangeDetectionPolicy the dataChangeDetectionPolicy value to set. + * @return the SearchIndexerDataSource object itself. + */ + @Generated + public SearchIndexerDataSource setDataChangeDetectionPolicy(DataChangeDetectionPolicy dataChangeDetectionPolicy) { + this.dataChangeDetectionPolicy = dataChangeDetectionPolicy; + return this; + } + + /** + * Get the dataDeletionDetectionPolicy property: The data deletion detection policy for the datasource. + * + * @return the dataDeletionDetectionPolicy value. + */ + @Generated + public DataDeletionDetectionPolicy getDataDeletionDetectionPolicy() { + return this.dataDeletionDetectionPolicy; + } + + /** + * Set the dataDeletionDetectionPolicy property: The data deletion detection policy for the datasource. + * + * @param dataDeletionDetectionPolicy the dataDeletionDetectionPolicy value to set. + * @return the SearchIndexerDataSource object itself. + */ + @Generated + public SearchIndexerDataSource + setDataDeletionDetectionPolicy(DataDeletionDetectionPolicy dataDeletionDetectionPolicy) { + this.dataDeletionDetectionPolicy = dataDeletionDetectionPolicy; + return this; + } + + /** + * Get the eTag property: The ETag of the data source. + * + * @return the eTag value. + */ + @Generated + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag of the data source. + * + * @param eTag the eTag value to set. + * @return the SearchIndexerDataSource object itself. + */ + @Generated + public SearchIndexerDataSource setETag(String eTag) { + this.eTag = eTag; + 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 datasource definition when you want full + * assurance that no one, not even Microsoft, can decrypt your data source definition. Once you have encrypted your + * data source definition, it will always remain encrypted. The search service will ignore attempts to set this + * property to null. You can change this property as needed if you want to rotate your encryption key; Your + * datasource definition will be unaffected. Encryption with customer-managed keys is not available for free search + * services, and is only available for paid services created on or after January 1, 2019. + * + * @return the encryptionKey value. + */ + @Generated + public SearchResourceEncryptionKey getEncryptionKey() { + return this.encryptionKey; + } + + /** + * Set 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 datasource definition when you want full + * assurance that no one, not even Microsoft, can decrypt your data source definition. Once you have encrypted your + * data source definition, it will always remain encrypted. The search service will ignore attempts to set this + * property to null. You can change this property as needed if you want to rotate your encryption key; Your + * datasource definition will be unaffected. Encryption with customer-managed keys is not available for free search + * services, and is only available for paid services created on or after January 1, 2019. + * + * @param encryptionKey the encryptionKey value to set. + * @return the SearchIndexerDataSource object itself. + */ + @Generated + public SearchIndexerDataSource setEncryptionKey(SearchResourceEncryptionKey encryptionKey) { + this.encryptionKey = encryptionKey; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeJsonField("credentials", this.credentials); + jsonWriter.writeJsonField("container", this.container); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeArrayField("indexerPermissionOptions", this.indexerPermissionOptions, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeJsonField("dataChangeDetectionPolicy", this.dataChangeDetectionPolicy); + jsonWriter.writeJsonField("dataDeletionDetectionPolicy", this.dataDeletionDetectionPolicy); + jsonWriter.writeStringField("@odata.etag", this.eTag); + jsonWriter.writeJsonField("encryptionKey", this.encryptionKey); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerDataSource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerDataSource 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 SearchIndexerDataSource. + */ + @Generated + public static SearchIndexerDataSource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerDataSource deserializedSearchIndexerDataSource = new SearchIndexerDataSource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSearchIndexerDataSource.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSearchIndexerDataSource.type + = SearchIndexerDataSourceType.fromString(reader.getString()); + } else if ("credentials".equals(fieldName)) { + deserializedSearchIndexerDataSource.credentials = DataSourceCredentials.fromJson(reader); + } else if ("container".equals(fieldName)) { + deserializedSearchIndexerDataSource.container = SearchIndexerDataContainer.fromJson(reader); + } else if ("description".equals(fieldName)) { + deserializedSearchIndexerDataSource.description = reader.getString(); + } else if ("subType".equals(fieldName)) { + deserializedSearchIndexerDataSource.subType = reader.getString(); + } else if ("identity".equals(fieldName)) { + deserializedSearchIndexerDataSource.identity = SearchIndexerDataIdentity.fromJson(reader); + } else if ("indexerPermissionOptions".equals(fieldName)) { + List indexerPermissionOptions + = reader.readArray(reader1 -> IndexerPermissionOption.fromString(reader1.getString())); + deserializedSearchIndexerDataSource.indexerPermissionOptions = indexerPermissionOptions; + } else if ("dataChangeDetectionPolicy".equals(fieldName)) { + deserializedSearchIndexerDataSource.dataChangeDetectionPolicy + = DataChangeDetectionPolicy.fromJson(reader); + } else if ("dataDeletionDetectionPolicy".equals(fieldName)) { + deserializedSearchIndexerDataSource.dataDeletionDetectionPolicy + = DataDeletionDetectionPolicy.fromJson(reader); + } else if ("@odata.etag".equals(fieldName)) { + deserializedSearchIndexerDataSource.eTag = reader.getString(); + } else if ("encryptionKey".equals(fieldName)) { + deserializedSearchIndexerDataSource.encryptionKey = SearchResourceEncryptionKey.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerDataSource; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataSourceType.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataSourceType.java new file mode 100644 index 000000000000..8daf6072197a --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataSourceType.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines the type of a datasource. + */ +public final class SearchIndexerDataSourceType extends ExpandableStringEnum { + /** + * Indicates an Azure SQL datasource. + */ + @Generated + public static final SearchIndexerDataSourceType AZURE_SQL = fromString("azuresql"); + + /** + * Indicates a CosmosDB datasource. + */ + @Generated + public static final SearchIndexerDataSourceType COSMOS_DB = fromString("cosmosdb"); + + /** + * Indicates an Azure Blob datasource. + */ + @Generated + public static final SearchIndexerDataSourceType AZURE_BLOB = fromString("azureblob"); + + /** + * Indicates an Azure Table datasource. + */ + @Generated + public static final SearchIndexerDataSourceType AZURE_TABLE = fromString("azuretable"); + + /** + * Indicates a MySql datasource. + */ + @Generated + public static final SearchIndexerDataSourceType MY_SQL = fromString("mysql"); + + /** + * Indicates an ADLS Gen2 datasource. + */ + @Generated + public static final SearchIndexerDataSourceType ADLS_GEN2 = fromString("adlsgen2"); + + /** + * Indicates a Microsoft Fabric OneLake datasource. + */ + @Generated + public static final SearchIndexerDataSourceType ONE_LAKE = fromString("onelake"); + + /** + * Indicates a SharePoint datasource. + */ + @Generated + public static final SearchIndexerDataSourceType SHARE_POINT = fromString("sharepoint"); + + /** + * Creates a new instance of SearchIndexerDataSourceType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public SearchIndexerDataSourceType() { + } + + /** + * Creates or finds a SearchIndexerDataSourceType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SearchIndexerDataSourceType. + */ + @Generated + public static SearchIndexerDataSourceType fromString(String name) { + return fromString(name, SearchIndexerDataSourceType.class); + } + + /** + * Gets known SearchIndexerDataSourceType values. + * + * @return known SearchIndexerDataSourceType values. + */ + @Generated + public static Collection values() { + return values(SearchIndexerDataSourceType.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataUserAssignedIdentity.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataUserAssignedIdentity.java new file mode 100644 index 000000000000..1ea33f067ba9 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerDataUserAssignedIdentity.java @@ -0,0 +1,122 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specifies the identity for a datasource to use. + */ +@Fluent +public final class SearchIndexerDataUserAssignedIdentity extends SearchIndexerDataIdentity { + /* + * A URI fragment specifying the type of identity. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.DataUserAssignedIdentity"; + + /* + * The fully qualified Azure resource Id of a user assigned managed identity typically in the form + * "/subscriptions/12345678-1234-1234-1234-1234567890ab/resourceGroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId" + * that should have been assigned to the search service. + */ + @Generated + private String userAssignedIdentity; + + /** + * Creates an instance of SearchIndexerDataUserAssignedIdentity class. + */ + @Generated + public SearchIndexerDataUserAssignedIdentity() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of identity. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the userAssignedIdentity property: The fully qualified Azure resource Id of a user assigned managed identity + * typically in the form + * "/subscriptions/12345678-1234-1234-1234-1234567890ab/resourceGroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId" + * that should have been assigned to the search service. + * + * @return the userAssignedIdentity value. + */ + @Generated + public String getUserAssignedIdentity() { + return this.userAssignedIdentity; + } + + /** + * Set the userAssignedIdentity property: The fully qualified Azure resource Id of a user assigned managed identity + * typically in the form + * "/subscriptions/12345678-1234-1234-1234-1234567890ab/resourceGroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId" + * that should have been assigned to the search service. + * + * @param userAssignedIdentity the userAssignedIdentity value to set. + * @return the SearchIndexerDataUserAssignedIdentity object itself. + */ + @Generated + public SearchIndexerDataUserAssignedIdentity setUserAssignedIdentity(String userAssignedIdentity) { + this.userAssignedIdentity = userAssignedIdentity; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("userAssignedIdentity", this.userAssignedIdentity); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerDataUserAssignedIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerDataUserAssignedIdentity 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 SearchIndexerDataUserAssignedIdentity. + */ + @Generated + public static SearchIndexerDataUserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerDataUserAssignedIdentity deserializedSearchIndexerDataUserAssignedIdentity + = new SearchIndexerDataUserAssignedIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("userAssignedIdentity".equals(fieldName)) { + deserializedSearchIndexerDataUserAssignedIdentity.userAssignedIdentity = reader.getString(); + } else if ("@odata.type".equals(fieldName)) { + deserializedSearchIndexerDataUserAssignedIdentity.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerDataUserAssignedIdentity; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerError.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerError.java new file mode 100644 index 000000000000..e19424e18280 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerError.java @@ -0,0 +1,179 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Represents an item- or document-level indexing error. + */ +@Immutable +public final class SearchIndexerError implements JsonSerializable { + /* + * The key of the item for which indexing failed. + */ + @Generated + private String key; + + /* + * The message describing the error that occurred while processing the item. + */ + @Generated + private String errorMessage; + + /* + * The status code indicating why the indexing operation failed. Possible values include: 400 for a malformed input + * document, 404 for document not found, 409 for a version conflict, 422 when the index is temporarily unavailable, + * or 503 for when the service is too busy. + */ + @Generated + private int statusCode; + + /* + * The name of the source at which the error originated. For example, this could refer to a particular skill in the + * attached skillset. This may not be always available. + */ + @Generated + private String name; + + /* + * Additional, verbose details about the error to assist in debugging the indexer. This may not be always available. + */ + @Generated + private String details; + + /* + * A link to a troubleshooting guide for these classes of errors. This may not be always available. + */ + @Generated + private String documentationLink; + + /** + * Creates an instance of SearchIndexerError class. + */ + @Generated + public SearchIndexerError() { + } + + /** + * Get the key property: The key of the item for which indexing failed. + * + * @return the key value. + */ + @Generated + public String getKey() { + return this.key; + } + + /** + * Get the errorMessage property: The message describing the error that occurred while processing the item. + * + * @return the errorMessage value. + */ + @Generated + public String getErrorMessage() { + return this.errorMessage; + } + + /** + * Get the statusCode property: The status code indicating why the indexing operation failed. Possible values + * include: 400 for a malformed input document, 404 for document not found, 409 for a version conflict, 422 when the + * index is temporarily unavailable, or 503 for when the service is too busy. + * + * @return the statusCode value. + */ + @Generated + public int getStatusCode() { + return this.statusCode; + } + + /** + * Get the name property: The name of the source at which the error originated. For example, this could refer to a + * particular skill in the attached skillset. This may not be always available. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the details property: Additional, verbose details about the error to assist in debugging the indexer. This + * may not be always available. + * + * @return the details value. + */ + @Generated + public String getDetails() { + return this.details; + } + + /** + * Get the documentationLink property: A link to a troubleshooting guide for these classes of errors. This may not + * be always available. + * + * @return the documentationLink value. + */ + @Generated + public String getDocumentationLink() { + return this.documentationLink; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerError 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 SearchIndexerError. + */ + @Generated + public static SearchIndexerError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerError deserializedSearchIndexerError = new SearchIndexerError(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("errorMessage".equals(fieldName)) { + deserializedSearchIndexerError.errorMessage = reader.getString(); + } else if ("statusCode".equals(fieldName)) { + deserializedSearchIndexerError.statusCode = reader.getInt(); + } else if ("key".equals(fieldName)) { + deserializedSearchIndexerError.key = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSearchIndexerError.name = reader.getString(); + } else if ("details".equals(fieldName)) { + deserializedSearchIndexerError.details = reader.getString(); + } else if ("documentationLink".equals(fieldName)) { + deserializedSearchIndexerError.documentationLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerError; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerIndexProjectionSelector.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerIndexProjectionSelector.java new file mode 100644 index 000000000000..a8097967bae5 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerIndexProjectionSelector.java @@ -0,0 +1,202 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Description for what data to store in the designated search index. + */ +@Fluent +public final class SearchIndexerIndexProjectionSelector + implements JsonSerializable { + /* + * Name of the search index to project to. Must have a key field with the 'keyword' analyzer set. + */ + @Generated + private String targetIndexName; + + /* + * Name of the field in the search index to map the parent document's key value to. Must be a string field that is + * filterable and not the key field. + */ + @Generated + private String parentKeyFieldName; + + /* + * Source context for the projections. Represents the cardinality at which the document will be split into multiple + * sub documents. + */ + @Generated + private String sourceContext; + + /* + * Mappings for the projection, or which source should be mapped to which field in the target index. + */ + @Generated + private List mappings; + + /** + * Creates an instance of SearchIndexerIndexProjectionSelector class. + */ + @Generated + public SearchIndexerIndexProjectionSelector() { + } + + /** + * Get the targetIndexName property: Name of the search index to project to. Must have a key field with the + * 'keyword' analyzer set. + * + * @return the targetIndexName value. + */ + @Generated + public String getTargetIndexName() { + return this.targetIndexName; + } + + /** + * Set the targetIndexName property: Name of the search index to project to. Must have a key field with the + * 'keyword' analyzer set. + * + * @param targetIndexName the targetIndexName value to set. + * @return the SearchIndexerIndexProjectionSelector object itself. + */ + @Generated + public SearchIndexerIndexProjectionSelector setTargetIndexName(String targetIndexName) { + this.targetIndexName = targetIndexName; + return this; + } + + /** + * Get the parentKeyFieldName property: Name of the field in the search index to map the parent document's key value + * to. Must be a string field that is filterable and not the key field. + * + * @return the parentKeyFieldName value. + */ + @Generated + public String getParentKeyFieldName() { + return this.parentKeyFieldName; + } + + /** + * Set the parentKeyFieldName property: Name of the field in the search index to map the parent document's key value + * to. Must be a string field that is filterable and not the key field. + * + * @param parentKeyFieldName the parentKeyFieldName value to set. + * @return the SearchIndexerIndexProjectionSelector object itself. + */ + @Generated + public SearchIndexerIndexProjectionSelector setParentKeyFieldName(String parentKeyFieldName) { + this.parentKeyFieldName = parentKeyFieldName; + return this; + } + + /** + * Get the sourceContext property: Source context for the projections. Represents the cardinality at which the + * document will be split into multiple sub documents. + * + * @return the sourceContext value. + */ + @Generated + public String getSourceContext() { + return this.sourceContext; + } + + /** + * Set the sourceContext property: Source context for the projections. Represents the cardinality at which the + * document will be split into multiple sub documents. + * + * @param sourceContext the sourceContext value to set. + * @return the SearchIndexerIndexProjectionSelector object itself. + */ + @Generated + public SearchIndexerIndexProjectionSelector setSourceContext(String sourceContext) { + this.sourceContext = sourceContext; + return this; + } + + /** + * Get the mappings property: Mappings for the projection, or which source should be mapped to which field in the + * target index. + * + * @return the mappings value. + */ + @Generated + public List getMappings() { + return this.mappings; + } + + /** + * Set the mappings property: Mappings for the projection, or which source should be mapped to which field in the + * target index. + * + * @param mappings the mappings value to set. + * @return the SearchIndexerIndexProjectionSelector object itself. + */ + @Generated + public SearchIndexerIndexProjectionSelector setMappings(List mappings) { + this.mappings = mappings; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("targetIndexName", this.targetIndexName); + jsonWriter.writeStringField("parentKeyFieldName", this.parentKeyFieldName); + jsonWriter.writeStringField("sourceContext", this.sourceContext); + jsonWriter.writeArrayField("mappings", this.mappings, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerIndexProjectionSelector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerIndexProjectionSelector 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 SearchIndexerIndexProjectionSelector. + */ + @Generated + public static SearchIndexerIndexProjectionSelector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerIndexProjectionSelector deserializedSearchIndexerIndexProjectionSelector + = new SearchIndexerIndexProjectionSelector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("targetIndexName".equals(fieldName)) { + deserializedSearchIndexerIndexProjectionSelector.targetIndexName = reader.getString(); + } else if ("parentKeyFieldName".equals(fieldName)) { + deserializedSearchIndexerIndexProjectionSelector.parentKeyFieldName = reader.getString(); + } else if ("sourceContext".equals(fieldName)) { + deserializedSearchIndexerIndexProjectionSelector.sourceContext = reader.getString(); + } else if ("mappings".equals(fieldName)) { + List mappings + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedSearchIndexerIndexProjectionSelector.mappings = mappings; + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerIndexProjectionSelector; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerIndexProjections.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerIndexProjections.java new file mode 100644 index 000000000000..dd7eff1bbc37 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerIndexProjections.java @@ -0,0 +1,133 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Definition of additional projections to secondary search indexes. + */ +@Fluent +public final class SearchIndexerIndexProjections implements JsonSerializable { + /* + * A list of projections to be performed to secondary search indexes. + */ + @Generated + private List selectors; + + /* + * A dictionary of index projection-specific configuration properties. Each name is the name of a specific property. + * Each value must be of a primitive type. + */ + @Generated + private SearchIndexerIndexProjectionsParameters parameters; + + /** + * Creates an instance of SearchIndexerIndexProjections class. + */ + @Generated + public SearchIndexerIndexProjections() { + } + + /** + * Get the selectors property: A list of projections to be performed to secondary search indexes. + * + * @return the selectors value. + */ + @Generated + public List getSelectors() { + return this.selectors; + } + + /** + * Set the selectors property: A list of projections to be performed to secondary search indexes. + * + * @param selectors the selectors value to set. + * @return the SearchIndexerIndexProjections object itself. + */ + @Generated + public SearchIndexerIndexProjections setSelectors(List selectors) { + this.selectors = selectors; + return this; + } + + /** + * Get the parameters property: A dictionary of index projection-specific configuration properties. Each name is the + * name of a specific property. Each value must be of a primitive type. + * + * @return the parameters value. + */ + @Generated + public SearchIndexerIndexProjectionsParameters getParameters() { + return this.parameters; + } + + /** + * Set the parameters property: A dictionary of index projection-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 SearchIndexerIndexProjections object itself. + */ + @Generated + public SearchIndexerIndexProjections setParameters(SearchIndexerIndexProjectionsParameters parameters) { + this.parameters = parameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("selectors", this.selectors, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("parameters", this.parameters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerIndexProjections from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerIndexProjections 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 SearchIndexerIndexProjections. + */ + @Generated + public static SearchIndexerIndexProjections fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerIndexProjections deserializedSearchIndexerIndexProjections + = new SearchIndexerIndexProjections(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("selectors".equals(fieldName)) { + List selectors + = reader.readArray(reader1 -> SearchIndexerIndexProjectionSelector.fromJson(reader1)); + deserializedSearchIndexerIndexProjections.selectors = selectors; + } else if ("parameters".equals(fieldName)) { + deserializedSearchIndexerIndexProjections.parameters + = SearchIndexerIndexProjectionsParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerIndexProjections; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerIndexProjectionsParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerIndexProjectionsParameters.java new file mode 100644 index 000000000000..8563b07c50f4 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerIndexProjectionsParameters.java @@ -0,0 +1,144 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.LinkedHashMap; +import java.util.Map; + +/** + * A dictionary of index projection-specific configuration properties. Each name is the name of a specific property. + * Each value must be of a primitive type. + */ +@Fluent +public final class SearchIndexerIndexProjectionsParameters + implements JsonSerializable { + /* + * Defines behavior of the index projections in relation to the rest of the indexer. + */ + @Generated + private IndexProjectionMode projectionMode; + + /* + * A dictionary of index projection-specific configuration properties. Each name is the name of a specific property. + * Each value must be of a primitive type. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of SearchIndexerIndexProjectionsParameters class. + */ + @Generated + public SearchIndexerIndexProjectionsParameters() { + } + + /** + * Get the projectionMode property: Defines behavior of the index projections in relation to the rest of the + * indexer. + * + * @return the projectionMode value. + */ + @Generated + public IndexProjectionMode getProjectionMode() { + return this.projectionMode; + } + + /** + * Set the projectionMode property: Defines behavior of the index projections in relation to the rest of the + * indexer. + * + * @param projectionMode the projectionMode value to set. + * @return the SearchIndexerIndexProjectionsParameters object itself. + */ + @Generated + public SearchIndexerIndexProjectionsParameters setProjectionMode(IndexProjectionMode projectionMode) { + this.projectionMode = projectionMode; + return this; + } + + /** + * Get the additionalProperties property: A dictionary of index projection-specific configuration properties. Each + * name is the name of a specific property. Each value must be of a primitive type. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: A dictionary of index projection-specific configuration properties. Each + * name is the name of a specific property. Each value must be of a primitive type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the SearchIndexerIndexProjectionsParameters object itself. + */ + @Generated + public SearchIndexerIndexProjectionsParameters setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("projectionMode", + this.projectionMode == null ? null : this.projectionMode.toString()); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerIndexProjectionsParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerIndexProjectionsParameters 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 SearchIndexerIndexProjectionsParameters. + */ + @Generated + public static SearchIndexerIndexProjectionsParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerIndexProjectionsParameters deserializedSearchIndexerIndexProjectionsParameters + = new SearchIndexerIndexProjectionsParameters(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("projectionMode".equals(fieldName)) { + deserializedSearchIndexerIndexProjectionsParameters.projectionMode + = IndexProjectionMode.fromString(reader.getString()); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedSearchIndexerIndexProjectionsParameters.additionalProperties = additionalProperties; + + return deserializedSearchIndexerIndexProjectionsParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStore.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStore.java new file mode 100644 index 000000000000..f9af46cd44ab --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStore.java @@ -0,0 +1,205 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Definition of additional projections to azure blob, table, or files, of enriched data. + */ +@Fluent +public final class SearchIndexerKnowledgeStore implements JsonSerializable { + /* + * The connection string to the storage account projections will be stored in. + */ + @Generated + private String storageConnectionString; + + /* + * A list of additional projections to perform during indexing. + */ + @Generated + private List 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. + */ + @Generated + 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. + */ + @Generated + private SearchIndexerKnowledgeStoreParameters parameters; + + /** + * Creates an instance of SearchIndexerKnowledgeStore class. + */ + @Generated + public SearchIndexerKnowledgeStore() { + } + + /** + * Get the storageConnectionString property: The connection string to the storage account projections will be stored + * in. + * + * @return the storageConnectionString value. + */ + @Generated + public String getStorageConnectionString() { + return this.storageConnectionString; + } + + /** + * Set the storageConnectionString property: The connection string to the storage account projections will be stored + * in. + * + * @param storageConnectionString the storageConnectionString value to set. + * @return the SearchIndexerKnowledgeStore object itself. + */ + @Generated + public SearchIndexerKnowledgeStore setStorageConnectionString(String storageConnectionString) { + this.storageConnectionString = storageConnectionString; + return this; + } + + /** + * Get the projections property: A list of additional projections to perform during indexing. + * + * @return the projections value. + */ + @Generated + public List getProjections() { + return this.projections; + } + + /** + * Set the projections property: A list of additional projections to perform during indexing. + * + * @param projections the projections value to set. + * @return the SearchIndexerKnowledgeStore object itself. + */ + @Generated + public SearchIndexerKnowledgeStore setProjections(List projections) { + this.projections = projections; + return this; + } + + /** + * 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + public SearchIndexerKnowledgeStore setParameters(SearchIndexerKnowledgeStoreParameters parameters) { + this.parameters = parameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + 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(); + } + + /** + * Reads an instance of SearchIndexerKnowledgeStore from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerKnowledgeStore 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 SearchIndexerKnowledgeStore. + */ + @Generated + public static SearchIndexerKnowledgeStore fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerKnowledgeStore deserializedSearchIndexerKnowledgeStore = new SearchIndexerKnowledgeStore(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("storageConnectionString".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStore.storageConnectionString = reader.getString(); + } else if ("projections".equals(fieldName)) { + List projections + = reader.readArray(reader1 -> SearchIndexerKnowledgeStoreProjection.fromJson(reader1)); + deserializedSearchIndexerKnowledgeStore.projections = projections; + } else if ("identity".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStore.identity = SearchIndexerDataIdentity.fromJson(reader); + } else if ("parameters".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStore.parameters + = SearchIndexerKnowledgeStoreParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerKnowledgeStore; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreBlobProjectionSelector.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreBlobProjectionSelector.java new file mode 100644 index 000000000000..4bd09ddb7297 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreBlobProjectionSelector.java @@ -0,0 +1,164 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Abstract class to share properties between concrete selectors. + */ +@Fluent +public class SearchIndexerKnowledgeStoreBlobProjectionSelector extends SearchIndexerKnowledgeStoreProjectionSelector { + /* + * Blob container to store projections in. + */ + @Generated + private String storageContainer; + + /** + * Creates an instance of SearchIndexerKnowledgeStoreBlobProjectionSelector class. + */ + @Generated + public SearchIndexerKnowledgeStoreBlobProjectionSelector() { + } + + /** + * Get the storageContainer property: Blob container to store projections in. + * + * @return the storageContainer value. + */ + @Generated + public String getStorageContainer() { + return this.storageContainer; + } + + /** + * Set the storageContainer property: Blob container to store projections in. + * + * @param storageContainer the storageContainer value to set. + * @return the SearchIndexerKnowledgeStoreBlobProjectionSelector object itself. + */ + @Generated + public SearchIndexerKnowledgeStoreBlobProjectionSelector setStorageContainer(String storageContainer) { + this.storageContainer = storageContainer; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreBlobProjectionSelector setReferenceKeyName(String referenceKeyName) { + super.setReferenceKeyName(referenceKeyName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreBlobProjectionSelector setGeneratedKeyName(String generatedKeyName) { + super.setGeneratedKeyName(generatedKeyName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreBlobProjectionSelector setSource(String source) { + super.setSource(source); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreBlobProjectionSelector setSourceContext(String sourceContext) { + super.setSourceContext(sourceContext); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreBlobProjectionSelector setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("referenceKeyName", getReferenceKeyName()); + jsonWriter.writeStringField("generatedKeyName", getGeneratedKeyName()); + jsonWriter.writeStringField("source", getSource()); + jsonWriter.writeStringField("sourceContext", getSourceContext()); + jsonWriter.writeArrayField("inputs", getInputs(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("storageContainer", this.storageContainer); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerKnowledgeStoreBlobProjectionSelector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerKnowledgeStoreBlobProjectionSelector 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 SearchIndexerKnowledgeStoreBlobProjectionSelector. + */ + @Generated + public static SearchIndexerKnowledgeStoreBlobProjectionSelector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerKnowledgeStoreBlobProjectionSelector deserializedSearchIndexerKnowledgeStoreBlobProjectionSelector + = new SearchIndexerKnowledgeStoreBlobProjectionSelector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("referenceKeyName".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreBlobProjectionSelector + .setReferenceKeyName(reader.getString()); + } else if ("generatedKeyName".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreBlobProjectionSelector + .setGeneratedKeyName(reader.getString()); + } else if ("source".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreBlobProjectionSelector.setSource(reader.getString()); + } else if ("sourceContext".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreBlobProjectionSelector.setSourceContext(reader.getString()); + } else if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedSearchIndexerKnowledgeStoreBlobProjectionSelector.setInputs(inputs); + } else if ("storageContainer".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreBlobProjectionSelector.storageContainer = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerKnowledgeStoreBlobProjectionSelector; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreFileProjectionSelector.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreFileProjectionSelector.java new file mode 100644 index 000000000000..18fb8a43553d --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreFileProjectionSelector.java @@ -0,0 +1,148 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Projection definition for what data to store in Azure Files. + */ +@Fluent +public final class SearchIndexerKnowledgeStoreFileProjectionSelector + extends SearchIndexerKnowledgeStoreBlobProjectionSelector { + /** + * Creates an instance of SearchIndexerKnowledgeStoreFileProjectionSelector class. + */ + @Generated + public SearchIndexerKnowledgeStoreFileProjectionSelector() { + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreFileProjectionSelector setStorageContainer(String storageContainer) { + super.setStorageContainer(storageContainer); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreFileProjectionSelector setReferenceKeyName(String referenceKeyName) { + super.setReferenceKeyName(referenceKeyName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreFileProjectionSelector setGeneratedKeyName(String generatedKeyName) { + super.setGeneratedKeyName(generatedKeyName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreFileProjectionSelector setSource(String source) { + super.setSource(source); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreFileProjectionSelector setSourceContext(String sourceContext) { + super.setSourceContext(sourceContext); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreFileProjectionSelector setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("storageContainer", getStorageContainer()); + jsonWriter.writeStringField("referenceKeyName", getReferenceKeyName()); + jsonWriter.writeStringField("generatedKeyName", getGeneratedKeyName()); + jsonWriter.writeStringField("source", getSource()); + jsonWriter.writeStringField("sourceContext", getSourceContext()); + jsonWriter.writeArrayField("inputs", getInputs(), (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerKnowledgeStoreFileProjectionSelector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerKnowledgeStoreFileProjectionSelector 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 SearchIndexerKnowledgeStoreFileProjectionSelector. + */ + @Generated + public static SearchIndexerKnowledgeStoreFileProjectionSelector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerKnowledgeStoreFileProjectionSelector deserializedSearchIndexerKnowledgeStoreFileProjectionSelector + = new SearchIndexerKnowledgeStoreFileProjectionSelector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("storageContainer".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreFileProjectionSelector + .setStorageContainer(reader.getString()); + } else if ("referenceKeyName".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreFileProjectionSelector + .setReferenceKeyName(reader.getString()); + } else if ("generatedKeyName".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreFileProjectionSelector + .setGeneratedKeyName(reader.getString()); + } else if ("source".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreFileProjectionSelector.setSource(reader.getString()); + } else if ("sourceContext".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreFileProjectionSelector.setSourceContext(reader.getString()); + } else if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedSearchIndexerKnowledgeStoreFileProjectionSelector.setInputs(inputs); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerKnowledgeStoreFileProjectionSelector; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreObjectProjectionSelector.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreObjectProjectionSelector.java new file mode 100644 index 000000000000..9e218577de03 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreObjectProjectionSelector.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Projection definition for what data to store in Azure Blob. + */ +@Fluent +public final class SearchIndexerKnowledgeStoreObjectProjectionSelector + extends SearchIndexerKnowledgeStoreBlobProjectionSelector { + /** + * Creates an instance of SearchIndexerKnowledgeStoreObjectProjectionSelector class. + */ + @Generated + public SearchIndexerKnowledgeStoreObjectProjectionSelector() { + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreObjectProjectionSelector setStorageContainer(String storageContainer) { + super.setStorageContainer(storageContainer); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreObjectProjectionSelector setReferenceKeyName(String referenceKeyName) { + super.setReferenceKeyName(referenceKeyName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreObjectProjectionSelector setGeneratedKeyName(String generatedKeyName) { + super.setGeneratedKeyName(generatedKeyName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreObjectProjectionSelector setSource(String source) { + super.setSource(source); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreObjectProjectionSelector setSourceContext(String sourceContext) { + super.setSourceContext(sourceContext); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreObjectProjectionSelector setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("storageContainer", getStorageContainer()); + jsonWriter.writeStringField("referenceKeyName", getReferenceKeyName()); + jsonWriter.writeStringField("generatedKeyName", getGeneratedKeyName()); + jsonWriter.writeStringField("source", getSource()); + jsonWriter.writeStringField("sourceContext", getSourceContext()); + jsonWriter.writeArrayField("inputs", getInputs(), (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerKnowledgeStoreObjectProjectionSelector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerKnowledgeStoreObjectProjectionSelector 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 SearchIndexerKnowledgeStoreObjectProjectionSelector. + */ + @Generated + public static SearchIndexerKnowledgeStoreObjectProjectionSelector fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerKnowledgeStoreObjectProjectionSelector deserializedSearchIndexerKnowledgeStoreObjectProjectionSelector + = new SearchIndexerKnowledgeStoreObjectProjectionSelector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("storageContainer".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreObjectProjectionSelector + .setStorageContainer(reader.getString()); + } else if ("referenceKeyName".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreObjectProjectionSelector + .setReferenceKeyName(reader.getString()); + } else if ("generatedKeyName".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreObjectProjectionSelector + .setGeneratedKeyName(reader.getString()); + } else if ("source".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreObjectProjectionSelector.setSource(reader.getString()); + } else if ("sourceContext".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreObjectProjectionSelector + .setSourceContext(reader.getString()); + } else if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedSearchIndexerKnowledgeStoreObjectProjectionSelector.setInputs(inputs); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerKnowledgeStoreObjectProjectionSelector; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreParameters.java new file mode 100644 index 000000000000..39081e9d389e --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreParameters.java @@ -0,0 +1,143 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.LinkedHashMap; +import java.util.Map; + +/** + * 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. + */ +@Fluent +public final class SearchIndexerKnowledgeStoreParameters + implements JsonSerializable { + /* + * Whether or not projections should synthesize a generated key name if one isn't already present. + */ + @Generated + private Boolean synthesizeGeneratedKeyName; + + /* + * 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. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of SearchIndexerKnowledgeStoreParameters class. + */ + @Generated + public SearchIndexerKnowledgeStoreParameters() { + } + + /** + * Get the synthesizeGeneratedKeyName property: Whether or not projections should synthesize a generated key name if + * one isn't already present. + * + * @return the synthesizeGeneratedKeyName value. + */ + @Generated + public Boolean isSynthesizeGeneratedKeyName() { + return this.synthesizeGeneratedKeyName; + } + + /** + * Set the synthesizeGeneratedKeyName property: Whether or not projections should synthesize a generated key name if + * one isn't already present. + * + * @param synthesizeGeneratedKeyName the synthesizeGeneratedKeyName value to set. + * @return the SearchIndexerKnowledgeStoreParameters object itself. + */ + @Generated + public SearchIndexerKnowledgeStoreParameters setSynthesizeGeneratedKeyName(Boolean synthesizeGeneratedKeyName) { + this.synthesizeGeneratedKeyName = synthesizeGeneratedKeyName; + return this; + } + + /** + * Get the additionalProperties 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 additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties 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 additionalProperties the additionalProperties value to set. + * @return the SearchIndexerKnowledgeStoreParameters object itself. + */ + @Generated + public SearchIndexerKnowledgeStoreParameters setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("synthesizeGeneratedKeyName", this.synthesizeGeneratedKeyName); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerKnowledgeStoreParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerKnowledgeStoreParameters 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 SearchIndexerKnowledgeStoreParameters. + */ + @Generated + public static SearchIndexerKnowledgeStoreParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerKnowledgeStoreParameters deserializedSearchIndexerKnowledgeStoreParameters + = new SearchIndexerKnowledgeStoreParameters(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("synthesizeGeneratedKeyName".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreParameters.synthesizeGeneratedKeyName + = reader.getNullable(JsonReader::getBoolean); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedSearchIndexerKnowledgeStoreParameters.additionalProperties = additionalProperties; + + return deserializedSearchIndexerKnowledgeStoreParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreProjection.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreProjection.java new file mode 100644 index 000000000000..b666fd482ee8 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreProjection.java @@ -0,0 +1,167 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Container object for various projection selectors. + */ +@Fluent +public final class SearchIndexerKnowledgeStoreProjection + implements JsonSerializable { + /* + * Projections to Azure Table storage. + */ + @Generated + private List tables; + + /* + * Projections to Azure Blob storage. + */ + @Generated + private List objects; + + /* + * Projections to Azure File storage. + */ + @Generated + private List files; + + /** + * Creates an instance of SearchIndexerKnowledgeStoreProjection class. + */ + @Generated + public SearchIndexerKnowledgeStoreProjection() { + } + + /** + * Get the tables property: Projections to Azure Table storage. + * + * @return the tables value. + */ + @Generated + public List getTables() { + return this.tables; + } + + /** + * Set the tables property: Projections to Azure Table storage. + * + * @param tables the tables value to set. + * @return the SearchIndexerKnowledgeStoreProjection object itself. + */ + @Generated + public SearchIndexerKnowledgeStoreProjection + setTables(List tables) { + this.tables = tables; + return this; + } + + /** + * Get the objects property: Projections to Azure Blob storage. + * + * @return the objects value. + */ + @Generated + public List getObjects() { + return this.objects; + } + + /** + * Set the objects property: Projections to Azure Blob storage. + * + * @param objects the objects value to set. + * @return the SearchIndexerKnowledgeStoreProjection object itself. + */ + @Generated + public SearchIndexerKnowledgeStoreProjection + setObjects(List objects) { + this.objects = objects; + return this; + } + + /** + * Get the files property: Projections to Azure File storage. + * + * @return the files value. + */ + @Generated + public List getFiles() { + return this.files; + } + + /** + * Set the files property: Projections to Azure File storage. + * + * @param files the files value to set. + * @return the SearchIndexerKnowledgeStoreProjection object itself. + */ + @Generated + public SearchIndexerKnowledgeStoreProjection + setFiles(List files) { + this.files = files; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("tables", this.tables, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("objects", this.objects, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("files", this.files, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerKnowledgeStoreProjection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerKnowledgeStoreProjection 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 SearchIndexerKnowledgeStoreProjection. + */ + @Generated + public static SearchIndexerKnowledgeStoreProjection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerKnowledgeStoreProjection deserializedSearchIndexerKnowledgeStoreProjection + = new SearchIndexerKnowledgeStoreProjection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tables".equals(fieldName)) { + List tables = reader + .readArray(reader1 -> SearchIndexerKnowledgeStoreTableProjectionSelector.fromJson(reader1)); + deserializedSearchIndexerKnowledgeStoreProjection.tables = tables; + } else if ("objects".equals(fieldName)) { + List objects = reader + .readArray(reader1 -> SearchIndexerKnowledgeStoreObjectProjectionSelector.fromJson(reader1)); + deserializedSearchIndexerKnowledgeStoreProjection.objects = objects; + } else if ("files".equals(fieldName)) { + List files = reader + .readArray(reader1 -> SearchIndexerKnowledgeStoreFileProjectionSelector.fromJson(reader1)); + deserializedSearchIndexerKnowledgeStoreProjection.files = files; + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerKnowledgeStoreProjection; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreProjectionSelector.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreProjectionSelector.java new file mode 100644 index 000000000000..c58e43537730 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreProjectionSelector.java @@ -0,0 +1,222 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Abstract class to share properties between concrete selectors. + */ +@Fluent +public class SearchIndexerKnowledgeStoreProjectionSelector + implements JsonSerializable { + /* + * Name of reference key to different projection. + */ + @Generated + private String referenceKeyName; + + /* + * Name of generated key to store projection under. + */ + @Generated + private String generatedKeyName; + + /* + * Source data to project. + */ + @Generated + private String source; + + /* + * Source context for complex projections. + */ + @Generated + private String sourceContext; + + /* + * Nested inputs for complex projections. + */ + @Generated + private List inputs; + + /** + * Creates an instance of SearchIndexerKnowledgeStoreProjectionSelector class. + */ + @Generated + public SearchIndexerKnowledgeStoreProjectionSelector() { + } + + /** + * Get the referenceKeyName property: Name of reference key to different projection. + * + * @return the referenceKeyName value. + */ + @Generated + public String getReferenceKeyName() { + return this.referenceKeyName; + } + + /** + * Set the referenceKeyName property: Name of reference key to different projection. + * + * @param referenceKeyName the referenceKeyName value to set. + * @return the SearchIndexerKnowledgeStoreProjectionSelector object itself. + */ + @Generated + public SearchIndexerKnowledgeStoreProjectionSelector setReferenceKeyName(String referenceKeyName) { + this.referenceKeyName = referenceKeyName; + return this; + } + + /** + * Get the generatedKeyName property: Name of generated key to store projection under. + * + * @return the generatedKeyName value. + */ + @Generated + public String getGeneratedKeyName() { + return this.generatedKeyName; + } + + /** + * Set the generatedKeyName property: Name of generated key to store projection under. + * + * @param generatedKeyName the generatedKeyName value to set. + * @return the SearchIndexerKnowledgeStoreProjectionSelector object itself. + */ + @Generated + public SearchIndexerKnowledgeStoreProjectionSelector setGeneratedKeyName(String generatedKeyName) { + this.generatedKeyName = generatedKeyName; + return this; + } + + /** + * Get the source property: Source data to project. + * + * @return the source value. + */ + @Generated + public String getSource() { + return this.source; + } + + /** + * Set the source property: Source data to project. + * + * @param source the source value to set. + * @return the SearchIndexerKnowledgeStoreProjectionSelector object itself. + */ + @Generated + public SearchIndexerKnowledgeStoreProjectionSelector setSource(String source) { + this.source = source; + return this; + } + + /** + * Get the sourceContext property: Source context for complex projections. + * + * @return the sourceContext value. + */ + @Generated + public String getSourceContext() { + return this.sourceContext; + } + + /** + * Set the sourceContext property: Source context for complex projections. + * + * @param sourceContext the sourceContext value to set. + * @return the SearchIndexerKnowledgeStoreProjectionSelector object itself. + */ + @Generated + public SearchIndexerKnowledgeStoreProjectionSelector setSourceContext(String sourceContext) { + this.sourceContext = sourceContext; + return this; + } + + /** + * Get the inputs property: Nested inputs for complex projections. + * + * @return the inputs value. + */ + @Generated + public List getInputs() { + return this.inputs; + } + + /** + * Set the inputs property: Nested inputs for complex projections. + * + * @param inputs the inputs value to set. + * @return the SearchIndexerKnowledgeStoreProjectionSelector object itself. + */ + @Generated + public SearchIndexerKnowledgeStoreProjectionSelector setInputs(List inputs) { + this.inputs = inputs; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("referenceKeyName", this.referenceKeyName); + jsonWriter.writeStringField("generatedKeyName", this.generatedKeyName); + jsonWriter.writeStringField("source", this.source); + jsonWriter.writeStringField("sourceContext", this.sourceContext); + jsonWriter.writeArrayField("inputs", this.inputs, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerKnowledgeStoreProjectionSelector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerKnowledgeStoreProjectionSelector 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 SearchIndexerKnowledgeStoreProjectionSelector. + */ + @Generated + public static SearchIndexerKnowledgeStoreProjectionSelector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerKnowledgeStoreProjectionSelector deserializedSearchIndexerKnowledgeStoreProjectionSelector + = new SearchIndexerKnowledgeStoreProjectionSelector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("referenceKeyName".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreProjectionSelector.referenceKeyName = reader.getString(); + } else if ("generatedKeyName".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreProjectionSelector.generatedKeyName = reader.getString(); + } else if ("source".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreProjectionSelector.source = reader.getString(); + } else if ("sourceContext".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreProjectionSelector.sourceContext = reader.getString(); + } else if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedSearchIndexerKnowledgeStoreProjectionSelector.inputs = inputs; + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerKnowledgeStoreProjectionSelector; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreTableProjectionSelector.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreTableProjectionSelector.java new file mode 100644 index 000000000000..87c1a52d874c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerKnowledgeStoreTableProjectionSelector.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Description for what data to store in Azure Tables. + */ +@Fluent +public final class SearchIndexerKnowledgeStoreTableProjectionSelector + extends SearchIndexerKnowledgeStoreProjectionSelector { + /* + * Name of the Azure table to store projected data in. + */ + @Generated + private String tableName; + + /** + * Creates an instance of SearchIndexerKnowledgeStoreTableProjectionSelector class. + */ + @Generated + public SearchIndexerKnowledgeStoreTableProjectionSelector() { + } + + /** + * Get the tableName property: Name of the Azure table to store projected data in. + * + * @return the tableName value. + */ + @Generated + public String getTableName() { + return this.tableName; + } + + /** + * Set the tableName property: Name of the Azure table to store projected data in. + * + * @param tableName the tableName value to set. + * @return the SearchIndexerKnowledgeStoreTableProjectionSelector object itself. + */ + @Generated + public SearchIndexerKnowledgeStoreTableProjectionSelector setTableName(String tableName) { + this.tableName = tableName; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreTableProjectionSelector setReferenceKeyName(String referenceKeyName) { + super.setReferenceKeyName(referenceKeyName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreTableProjectionSelector setGeneratedKeyName(String generatedKeyName) { + super.setGeneratedKeyName(generatedKeyName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreTableProjectionSelector setSource(String source) { + super.setSource(source); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreTableProjectionSelector setSourceContext(String sourceContext) { + super.setSourceContext(sourceContext); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SearchIndexerKnowledgeStoreTableProjectionSelector setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("referenceKeyName", getReferenceKeyName()); + jsonWriter.writeStringField("generatedKeyName", getGeneratedKeyName()); + jsonWriter.writeStringField("source", getSource()); + jsonWriter.writeStringField("sourceContext", getSourceContext()); + jsonWriter.writeArrayField("inputs", getInputs(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("tableName", this.tableName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerKnowledgeStoreTableProjectionSelector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerKnowledgeStoreTableProjectionSelector 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 SearchIndexerKnowledgeStoreTableProjectionSelector. + */ + @Generated + public static SearchIndexerKnowledgeStoreTableProjectionSelector fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerKnowledgeStoreTableProjectionSelector deserializedSearchIndexerKnowledgeStoreTableProjectionSelector + = new SearchIndexerKnowledgeStoreTableProjectionSelector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("referenceKeyName".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreTableProjectionSelector + .setReferenceKeyName(reader.getString()); + } else if ("generatedKeyName".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreTableProjectionSelector + .setGeneratedKeyName(reader.getString()); + } else if ("source".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreTableProjectionSelector.setSource(reader.getString()); + } else if ("sourceContext".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreTableProjectionSelector.setSourceContext(reader.getString()); + } else if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedSearchIndexerKnowledgeStoreTableProjectionSelector.setInputs(inputs); + } else if ("tableName".equals(fieldName)) { + deserializedSearchIndexerKnowledgeStoreTableProjectionSelector.tableName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerKnowledgeStoreTableProjectionSelector; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerLimits.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerLimits.java new file mode 100644 index 000000000000..372857053757 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerLimits.java @@ -0,0 +1,121 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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.time.Duration; + +/** + * The SearchIndexerLimits model. + */ +@Immutable +public final class SearchIndexerLimits implements JsonSerializable { + /* + * The maximum duration that the indexer is permitted to run for one execution. + */ + @Generated + private Duration maxRunTime; + + /* + * The maximum size of a document, in bytes, which will be considered valid for indexing. + */ + @Generated + private Long maxDocumentExtractionSize; + + /* + * The maximum number of characters that will be extracted from a document picked up for indexing. + */ + @Generated + private Long maxDocumentContentCharactersToExtract; + + /** + * Creates an instance of SearchIndexerLimits class. + */ + @Generated + public SearchIndexerLimits() { + } + + /** + * Get the maxRunTime property: The maximum duration that the indexer is permitted to run for one execution. + * + * @return the maxRunTime value. + */ + @Generated + public Duration getMaxRunTime() { + return this.maxRunTime; + } + + /** + * Get the maxDocumentExtractionSize property: The maximum size of a document, in bytes, which will be considered + * valid for indexing. + * + * @return the maxDocumentExtractionSize value. + */ + @Generated + public Long getMaxDocumentExtractionSize() { + return this.maxDocumentExtractionSize; + } + + /** + * Get the maxDocumentContentCharactersToExtract property: The maximum number of characters that will be extracted + * from a document picked up for indexing. + * + * @return the maxDocumentContentCharactersToExtract value. + */ + @Generated + public Long getMaxDocumentContentCharactersToExtract() { + return this.maxDocumentContentCharactersToExtract; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerLimits from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerLimits 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 SearchIndexerLimits. + */ + @Generated + public static SearchIndexerLimits fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerLimits deserializedSearchIndexerLimits = new SearchIndexerLimits(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("maxRunTime".equals(fieldName)) { + deserializedSearchIndexerLimits.maxRunTime + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("maxDocumentExtractionSize".equals(fieldName)) { + deserializedSearchIndexerLimits.maxDocumentExtractionSize = reader.getNullable(JsonReader::getLong); + } else if ("maxDocumentContentCharactersToExtract".equals(fieldName)) { + deserializedSearchIndexerLimits.maxDocumentContentCharactersToExtract + = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerLimits; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerSkill.java new file mode 100644 index 000000000000..419374b01f3f --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerSkill.java @@ -0,0 +1,329 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Base type for skills. + */ +@Fluent +public class SearchIndexerSkill implements JsonSerializable { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "SearchIndexerSkill"; + + /* + * The name of the skill which uniquely identifies it within the skillset. A skill with no name defined will be + * given a default name of its 1-based index in the skills array, prefixed with the character '#'. + */ + @Generated + private String name; + + /* + * The description of the skill which describes the inputs, outputs, and usage of the skill. + */ + @Generated + private String description; + + /* + * Represents the level at which operations take place, such as the document root or document content (for example, + * /document or /document/content). The default is /document. + */ + @Generated + private String context; + + /* + * Inputs of the skills could be a column in the source data set, or the output of an upstream skill. + */ + @Generated + private List inputs; + + /* + * The output of a skill is either a field in a search index, or a value that can be consumed as an input by another + * skill. + */ + @Generated + private List outputs; + + /** + * Creates an instance of SearchIndexerSkill class. + */ + @Generated + public SearchIndexerSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + public String getOdataType() { + return this.odataType; + } + + /** + * Get the name property: The name of the skill which uniquely identifies it within the skillset. A skill with no + * name defined will be given a default name of its 1-based index in the skills array, prefixed with the character + * '#'. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the skill which uniquely identifies it within the skillset. A skill with no + * name defined will be given a default name of its 1-based index in the skills array, prefixed with the character + * '#'. + * + * @param name the name value to set. + * @return the SearchIndexerSkill object itself. + */ + @Generated + public SearchIndexerSkill setName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: The description of the skill which describes the inputs, outputs, and usage of the + * skill. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description of the skill which describes the inputs, outputs, and usage of the + * skill. + * + * @param description the description value to set. + * @return the SearchIndexerSkill object itself. + */ + @Generated + public SearchIndexerSkill setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the context property: Represents the level at which operations take place, such as the document root or + * document content (for example, /document or /document/content). The default is /document. + * + * @return the context value. + */ + @Generated + public String getContext() { + return this.context; + } + + /** + * Set the context property: Represents the level at which operations take place, such as the document root or + * document content (for example, /document or /document/content). The default is /document. + * + * @param context the context value to set. + * @return the SearchIndexerSkill object itself. + */ + @Generated + public SearchIndexerSkill setContext(String context) { + this.context = context; + return this; + } + + /** + * Get the inputs property: Inputs of the skills could be a column in the source data set, or the output of an + * upstream skill. + * + * @return the inputs value. + */ + @Generated + public List getInputs() { + return this.inputs; + } + + /** + * Set the inputs property: Inputs of the skills could be a column in the source data set, or the output of an + * upstream skill. + * + * @param inputs the inputs value to set. + * @return the SearchIndexerSkill object itself. + */ + @Generated + public SearchIndexerSkill setInputs(List inputs) { + this.inputs = inputs; + return this; + } + + /** + * Get the outputs property: The output of a skill is either a field in a search index, or a value that can be + * consumed as an input by another skill. + * + * @return the outputs value. + */ + @Generated + public List getOutputs() { + return this.outputs; + } + + /** + * Set the outputs property: The output of a skill is either a field in a search index, or a value that can be + * consumed as an input by another skill. + * + * @param outputs the outputs value to set. + * @return the SearchIndexerSkill object itself. + */ + @Generated + public SearchIndexerSkill setOutputs(List outputs) { + this.outputs = outputs; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("inputs", this.inputs, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("outputs", this.outputs, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("context", this.context); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerSkill 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 SearchIndexerSkill. + */ + @Generated + public static SearchIndexerSkill 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.Skills.Util.ConditionalSkill".equals(discriminatorValue)) { + return ConditionalSkill.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Text.KeyPhraseExtractionSkill".equals(discriminatorValue)) { + return KeyPhraseExtractionSkill.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Vision.OcrSkill".equals(discriminatorValue)) { + return OcrSkill.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Vision.ImageAnalysisSkill".equals(discriminatorValue)) { + return ImageAnalysisSkill.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Text.LanguageDetectionSkill".equals(discriminatorValue)) { + return LanguageDetectionSkill.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Util.ShaperSkill".equals(discriminatorValue)) { + return ShaperSkill.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Text.MergeSkill".equals(discriminatorValue)) { + return MergeSkill.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Text.EntityRecognitionSkill".equals(discriminatorValue)) { + return EntityRecognitionSkill.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Text.SentimentSkill".equals(discriminatorValue)) { + return SentimentSkill.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Text.V3.SentimentSkill".equals(discriminatorValue)) { + return SentimentSkillV3.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Text.V3.EntityLinkingSkill".equals(discriminatorValue)) { + return EntityLinkingSkill.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Text.V3.EntityRecognitionSkill".equals(discriminatorValue)) { + return EntityRecognitionSkillV3.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Text.PIIDetectionSkill".equals(discriminatorValue)) { + return PIIDetectionSkill.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Text.SplitSkill".equals(discriminatorValue)) { + return SplitSkill.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Text.CustomEntityLookupSkill".equals(discriminatorValue)) { + return CustomEntityLookupSkill.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Text.TranslationSkill".equals(discriminatorValue)) { + return TextTranslationSkill.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Util.DocumentExtractionSkill".equals(discriminatorValue)) { + return DocumentExtractionSkill.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Util.DocumentIntelligenceLayoutSkill".equals(discriminatorValue)) { + return DocumentIntelligenceLayoutSkill.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Custom.WebApiSkill".equals(discriminatorValue)) { + return WebApiSkill.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("#Microsoft.Skills.Custom.ChatCompletionSkill".equals(discriminatorValue)) { + return ChatCompletionSkill.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Skills.Util.ContentUnderstandingSkill".equals(discriminatorValue)) { + return ContentUnderstandingSkill.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 { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static SearchIndexerSkill fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerSkill deserializedSearchIndexerSkill = new SearchIndexerSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedSearchIndexerSkill.inputs = inputs; + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedSearchIndexerSkill.outputs = outputs; + } else if ("@odata.type".equals(fieldName)) { + deserializedSearchIndexerSkill.odataType = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSearchIndexerSkill.name = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedSearchIndexerSkill.description = reader.getString(); + } else if ("context".equals(fieldName)) { + deserializedSearchIndexerSkill.context = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerSkillset.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerSkillset.java new file mode 100644 index 000000000000..98963b5115d7 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerSkillset.java @@ -0,0 +1,334 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * A list of skills. + */ +@Fluent +public final class SearchIndexerSkillset implements JsonSerializable { + /* + * The name of the skillset. + */ + @Generated + private String name; + + /* + * The description of the skillset. + */ + @Generated + private String description; + + /* + * A list of skills in the skillset. + */ + @Generated + private List skills; + + /* + * Details about the Azure AI service to be used when running skills. + */ + @Generated + private CognitiveServicesAccount cognitiveServicesAccount; + + /* + * Definition of additional projections to Azure blob, table, or files, of enriched data. + */ + @Generated + private SearchIndexerKnowledgeStore knowledgeStore; + + /* + * Definition of additional projections to secondary search index(es). + */ + @Generated + private SearchIndexerIndexProjections indexProjections; + + /* + * The ETag of the skillset. + */ + @Generated + private String eTag; + + /* + * 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 skillset definition when you want full assurance that no one, not even + * Microsoft, can decrypt your skillset definition. Once you have encrypted your skillset definition, it will always + * remain encrypted. The search service will ignore attempts to set this property to null. You can change this + * property as needed if you want to rotate your encryption key; Your skillset definition will be unaffected. + * Encryption with customer-managed keys is not available for free search services, and is only available for paid + * services created on or after January 1, 2019. + */ + @Generated + private SearchResourceEncryptionKey encryptionKey; + + /** + * Creates an instance of SearchIndexerSkillset class. + */ + @Generated + public SearchIndexerSkillset() { + } + + /** + * Get the name property: The name of the skillset. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the skillset. + * + * @param name the name value to set. + * @return the SearchIndexerSkillset object itself. + */ + @Generated + public SearchIndexerSkillset setName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: The description of the skillset. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description of the skillset. + * + * @param description the description value to set. + * @return the SearchIndexerSkillset object itself. + */ + @Generated + public SearchIndexerSkillset setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the skills property: A list of skills in the skillset. + * + * @return the skills value. + */ + @Generated + public List getSkills() { + return this.skills; + } + + /** + * Set the skills property: A list of skills in the skillset. + * + * @param skills the skills value to set. + * @return the SearchIndexerSkillset object itself. + */ + @Generated + public SearchIndexerSkillset setSkills(List skills) { + this.skills = skills; + return this; + } + + /** + * Get the cognitiveServicesAccount property: Details about the Azure AI service to be used when running skills. + * + * @return the cognitiveServicesAccount value. + */ + @Generated + public CognitiveServicesAccount getCognitiveServicesAccount() { + return this.cognitiveServicesAccount; + } + + /** + * Set the cognitiveServicesAccount property: Details about the Azure AI service to be used when running skills. + * + * @param cognitiveServicesAccount the cognitiveServicesAccount value to set. + * @return the SearchIndexerSkillset object itself. + */ + @Generated + public SearchIndexerSkillset setCognitiveServicesAccount(CognitiveServicesAccount cognitiveServicesAccount) { + this.cognitiveServicesAccount = cognitiveServicesAccount; + return this; + } + + /** + * Get the knowledgeStore property: Definition of additional projections to Azure blob, table, or files, of enriched + * data. + * + * @return the knowledgeStore value. + */ + @Generated + public SearchIndexerKnowledgeStore getKnowledgeStore() { + return this.knowledgeStore; + } + + /** + * Set the knowledgeStore property: Definition of additional projections to Azure blob, table, or files, of enriched + * data. + * + * @param knowledgeStore the knowledgeStore value to set. + * @return the SearchIndexerSkillset object itself. + */ + @Generated + public SearchIndexerSkillset setKnowledgeStore(SearchIndexerKnowledgeStore knowledgeStore) { + this.knowledgeStore = knowledgeStore; + return this; + } + + /** + * Get the indexProjections property: Definition of additional projections to secondary search index(es). + * + * @return the indexProjections value. + */ + @Generated + public SearchIndexerIndexProjections getIndexProjections() { + return this.indexProjections; + } + + /** + * Set the indexProjections property: Definition of additional projections to secondary search index(es). + * + * @param indexProjections the indexProjections value to set. + * @return the SearchIndexerSkillset object itself. + */ + @Generated + public SearchIndexerSkillset setIndexProjections(SearchIndexerIndexProjections indexProjections) { + this.indexProjections = indexProjections; + return this; + } + + /** + * Get the eTag property: The ETag of the skillset. + * + * @return the eTag value. + */ + @Generated + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag of the skillset. + * + * @param eTag the eTag value to set. + * @return the SearchIndexerSkillset object itself. + */ + @Generated + public SearchIndexerSkillset setETag(String eTag) { + this.eTag = eTag; + 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 skillset definition when you want full + * assurance that no one, not even Microsoft, can decrypt your skillset definition. Once you have encrypted your + * skillset definition, it will always remain encrypted. The search service will ignore attempts to set this + * property to null. You can change this property as needed if you want to rotate your encryption key; Your skillset + * definition will be unaffected. Encryption with customer-managed keys is not available for free search services, + * and is only available for paid services created on or after January 1, 2019. + * + * @return the encryptionKey value. + */ + @Generated + public SearchResourceEncryptionKey getEncryptionKey() { + return this.encryptionKey; + } + + /** + * Set 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 skillset definition when you want full + * assurance that no one, not even Microsoft, can decrypt your skillset definition. Once you have encrypted your + * skillset definition, it will always remain encrypted. The search service will ignore attempts to set this + * property to null. You can change this property as needed if you want to rotate your encryption key; Your skillset + * definition will be unaffected. Encryption with customer-managed keys is not available for free search services, + * and is only available for paid services created on or after January 1, 2019. + * + * @param encryptionKey the encryptionKey value to set. + * @return the SearchIndexerSkillset object itself. + */ + @Generated + public SearchIndexerSkillset setEncryptionKey(SearchResourceEncryptionKey encryptionKey) { + this.encryptionKey = encryptionKey; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeArrayField("skills", this.skills, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeJsonField("cognitiveServices", this.cognitiveServicesAccount); + jsonWriter.writeJsonField("knowledgeStore", this.knowledgeStore); + jsonWriter.writeJsonField("indexProjections", this.indexProjections); + jsonWriter.writeStringField("@odata.etag", this.eTag); + jsonWriter.writeJsonField("encryptionKey", this.encryptionKey); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerSkillset from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerSkillset 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 SearchIndexerSkillset. + */ + @Generated + public static SearchIndexerSkillset fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerSkillset deserializedSearchIndexerSkillset = new SearchIndexerSkillset(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSearchIndexerSkillset.name = reader.getString(); + } else if ("skills".equals(fieldName)) { + List skills = reader.readArray(reader1 -> SearchIndexerSkill.fromJson(reader1)); + deserializedSearchIndexerSkillset.skills = skills; + } else if ("description".equals(fieldName)) { + deserializedSearchIndexerSkillset.description = reader.getString(); + } else if ("cognitiveServices".equals(fieldName)) { + deserializedSearchIndexerSkillset.cognitiveServicesAccount + = CognitiveServicesAccount.fromJson(reader); + } else if ("knowledgeStore".equals(fieldName)) { + deserializedSearchIndexerSkillset.knowledgeStore = SearchIndexerKnowledgeStore.fromJson(reader); + } else if ("indexProjections".equals(fieldName)) { + deserializedSearchIndexerSkillset.indexProjections = SearchIndexerIndexProjections.fromJson(reader); + } else if ("@odata.etag".equals(fieldName)) { + deserializedSearchIndexerSkillset.eTag = reader.getString(); + } else if ("encryptionKey".equals(fieldName)) { + deserializedSearchIndexerSkillset.encryptionKey = SearchResourceEncryptionKey.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerSkillset; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerStatus.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerStatus.java new file mode 100644 index 000000000000..a01141dc1b50 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerStatus.java @@ -0,0 +1,194 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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 the current status and execution history of an indexer. + */ +@Immutable +public final class SearchIndexerStatus implements JsonSerializable { + /* + * The name of the indexer. + */ + @Generated + private String name; + + /* + * Overall indexer status. + */ + @Generated + private IndexerStatus status; + + /* + * Snapshot of the indexer’s cumulative runtime consumption for the service over the current UTC period. + */ + @Generated + private IndexerRuntime runtime; + + /* + * The result of the most recent or an in-progress indexer execution. + */ + @Generated + private IndexerExecutionResult lastResult; + + /* + * History of the recent indexer executions, sorted in reverse chronological order. + */ + @Generated + private List executionHistory; + + /* + * The execution limits for the indexer. + */ + @Generated + private SearchIndexerLimits limits; + + /* + * All of the state that defines and dictates the indexer's current execution. + */ + @Generated + private IndexerCurrentState currentState; + + /** + * Creates an instance of SearchIndexerStatus class. + */ + @Generated + public SearchIndexerStatus() { + } + + /** + * Get the name property: The name of the indexer. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the status property: Overall indexer status. + * + * @return the status value. + */ + @Generated + public IndexerStatus getStatus() { + return this.status; + } + + /** + * Get the runtime property: Snapshot of the indexer’s cumulative runtime consumption for the service over the + * current UTC period. + * + * @return the runtime value. + */ + @Generated + public IndexerRuntime getRuntime() { + return this.runtime; + } + + /** + * Get the lastResult property: The result of the most recent or an in-progress indexer execution. + * + * @return the lastResult value. + */ + @Generated + public IndexerExecutionResult getLastResult() { + return this.lastResult; + } + + /** + * Get the executionHistory property: History of the recent indexer executions, sorted in reverse chronological + * order. + * + * @return the executionHistory value. + */ + @Generated + public List getExecutionHistory() { + return this.executionHistory; + } + + /** + * Get the limits property: The execution limits for the indexer. + * + * @return the limits value. + */ + @Generated + public SearchIndexerLimits getLimits() { + return this.limits; + } + + /** + * Get the currentState property: All of the state that defines and dictates the indexer's current execution. + * + * @return the currentState value. + */ + @Generated + public IndexerCurrentState getCurrentState() { + return this.currentState; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerStatus 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 SearchIndexerStatus. + */ + @Generated + public static SearchIndexerStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerStatus deserializedSearchIndexerStatus = new SearchIndexerStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSearchIndexerStatus.name = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedSearchIndexerStatus.status = IndexerStatus.fromString(reader.getString()); + } else if ("runtime".equals(fieldName)) { + deserializedSearchIndexerStatus.runtime = IndexerRuntime.fromJson(reader); + } else if ("executionHistory".equals(fieldName)) { + List executionHistory + = reader.readArray(reader1 -> IndexerExecutionResult.fromJson(reader1)); + deserializedSearchIndexerStatus.executionHistory = executionHistory; + } else if ("limits".equals(fieldName)) { + deserializedSearchIndexerStatus.limits = SearchIndexerLimits.fromJson(reader); + } else if ("lastResult".equals(fieldName)) { + deserializedSearchIndexerStatus.lastResult = IndexerExecutionResult.fromJson(reader); + } else if ("currentState".equals(fieldName)) { + deserializedSearchIndexerStatus.currentState = IndexerCurrentState.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerStatus; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerWarning.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerWarning.java new file mode 100644 index 000000000000..db40bdcf2bd5 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchIndexerWarning.java @@ -0,0 +1,158 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Represents an item-level warning. + */ +@Immutable +public final class SearchIndexerWarning implements JsonSerializable { + /* + * The key of the item which generated a warning. + */ + @Generated + private String key; + + /* + * The message describing the warning that occurred while processing the item. + */ + @Generated + private String message; + + /* + * The name of the source at which the warning originated. For example, this could refer to a particular skill in + * the attached skillset. This may not be always available. + */ + @Generated + private String name; + + /* + * Additional, verbose details about the warning to assist in debugging the indexer. This may not be always + * available. + */ + @Generated + private String details; + + /* + * A link to a troubleshooting guide for these classes of warnings. This may not be always available. + */ + @Generated + private String documentationLink; + + /** + * Creates an instance of SearchIndexerWarning class. + */ + @Generated + public SearchIndexerWarning() { + } + + /** + * Get the key property: The key of the item which generated a warning. + * + * @return the key value. + */ + @Generated + public String getKey() { + return this.key; + } + + /** + * Get the message property: The message describing the warning that occurred while processing the item. + * + * @return the message value. + */ + @Generated + public String getMessage() { + return this.message; + } + + /** + * Get the name property: The name of the source at which the warning originated. For example, this could refer to a + * particular skill in the attached skillset. This may not be always available. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the details property: Additional, verbose details about the warning to assist in debugging the indexer. This + * may not be always available. + * + * @return the details value. + */ + @Generated + public String getDetails() { + return this.details; + } + + /** + * Get the documentationLink property: A link to a troubleshooting guide for these classes of warnings. This may not + * be always available. + * + * @return the documentationLink value. + */ + @Generated + public String getDocumentationLink() { + return this.documentationLink; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchIndexerWarning from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchIndexerWarning 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 SearchIndexerWarning. + */ + @Generated + public static SearchIndexerWarning fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchIndexerWarning deserializedSearchIndexerWarning = new SearchIndexerWarning(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("message".equals(fieldName)) { + deserializedSearchIndexerWarning.message = reader.getString(); + } else if ("key".equals(fieldName)) { + deserializedSearchIndexerWarning.key = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSearchIndexerWarning.name = reader.getString(); + } else if ("details".equals(fieldName)) { + deserializedSearchIndexerWarning.details = reader.getString(); + } else if ("documentationLink".equals(fieldName)) { + deserializedSearchIndexerWarning.documentationLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchIndexerWarning; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchMode.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchMode.java new file mode 100644 index 000000000000..4a04ffd1a463 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchMode.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.models; + +/** + * Specifies whether any or all of the search terms must be matched in order to count the document as a match. + */ +public enum SearchMode { + /** + * Any of the search terms must be matched in order to count the document as a match. + */ + ANY("any"), + + /** + * All of the search terms must be matched in order to count the document as a match. + */ + ALL("all"); + + /** + * The actual serialized value for a SearchMode instance. + */ + private final String value; + + SearchMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SearchMode instance. + * + * @param value the serialized value to parse. + * @return the parsed SearchMode object, or null if unable to parse. + */ + public static SearchMode fromString(String value) { + if (value == null) { + return null; + } + SearchMode[] items = SearchMode.values(); + for (SearchMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchOptions.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchOptions.java new file mode 100644 index 000000000000..b101a5c2da16 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchOptions.java @@ -0,0 +1,975 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import java.util.List; + +/** + * Parameter group. + */ +@Fluent +public final class SearchOptions { + /* + * A value that specifies whether to fetch the total count of results. Default is false. Setting this value to true + * may have a performance impact. Note that the count returned is an approximation. + */ + @Generated + private Boolean includeTotalResultCount; + + /* + * 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. + */ + @Generated + private List facets; + + /* + * The OData $filter expression to apply to the search query. + */ + @Generated + private String filter; + + /* + * The list of field names to use for hit highlights. Only searchable fields can be used for hit highlighting. + */ + @Generated + private List highlightFields; + + /* + * A string tag that is appended to hit highlights. Must be set with highlightPreTag. Default is </em>. + */ + @Generated + private String highlightPostTag; + + /* + * A string tag that is prepended to hit highlights. Must be set with highlightPostTag. Default is <em>. + */ + @Generated + private String highlightPreTag; + + /* + * A number between 0 and 100 indicating the percentage of the index that must be covered by a search query in order + * for the query to be reported as a success. This parameter can be useful for ensuring search availability even for + * services with only one replica. The default is 100. + */ + @Generated + private Double minimumCoverage; + + /* + * The list of OData $orderby expressions by which to sort the results. Each expression can be either a field name + * or a call to either the geo.distance() or the search.score() functions. Each expression can be followed by asc to + * indicate ascending, and desc to indicate descending. The default is ascending order. Ties will be broken by the + * match scores of documents. If no OrderBy is specified, the default sort order is descending by document match + * score. There can be at most 32 $orderby clauses. + */ + @Generated + private List orderBy; + + /* + * A value that specifies the syntax of the search query. The default is 'simple'. Use 'full' if your query uses the + * Lucene query syntax. + */ + @Generated + private QueryType queryType; + + /* + * The list of parameter values to be used in scoring functions (for example, referencePointParameter) using the + * format name-values. For example, if the scoring profile defines a function with a parameter called 'mylocation' + * the parameter string would be "mylocation--122.2,44.8" (without the quotes). + */ + @Generated + private List scoringParameters; + + /* + * The name of a scoring profile to evaluate match scores for matching documents in order to sort the results. + */ + @Generated + private String scoringProfile; + + /* + * The list of field names to which to scope the full-text search. When using fielded search + * (fieldName:searchExpression) in a full Lucene query, the field names of each fielded search expression take + * precedence over any field names listed in this parameter. + */ + @Generated + private List searchFields; + + /* + * A value that specifies whether any or all of the search terms must be matched in order to count the document as a + * match. + */ + @Generated + private SearchMode searchMode; + + /* + * A value that specifies whether we want to calculate scoring statistics (such as document frequency) globally for + * more consistent scoring, or locally, for lower latency. + */ + @Generated + private ScoringStatistics scoringStatistics; + + /* + * A value to be used to create a sticky session, which can help to get more consistent results. As long as the same + * sessionId is used, a best-effort attempt will be made to target the same replica set. Be wary that reusing the + * same sessionID values repeatedly can interfere with the load balancing of the requests across replicas and + * adversely affect the performance of the search service. The value used as sessionId cannot start with a '_' + * character. + */ + @Generated + private String sessionId; + + /* + * The list of fields to retrieve. If unspecified, all fields marked as retrievable in the schema are included. + */ + @Generated + private List select; + + /* + * The number of search results to skip. This value cannot be greater than 100,000. If you need to scan documents in + * sequence, but cannot use $skip due to this limitation, consider using $orderby on a totally-ordered key and + * $filter with a range query instead. + */ + @Generated + private Integer skip; + + /* + * The number of search results to retrieve. This can be used in conjunction with $skip to implement client-side + * paging of search results. If results are truncated due to server-side paging, the response will include a + * continuation token that can be used to issue another Search request for the next page of results. + */ + @Generated + private Integer top; + + /* + * The name of the semantic configuration that lists which fields should be used for semantic ranking, captions, + * highlights, and answers + */ + @Generated + private String semanticConfiguration; + + /* + * Allows the user to choose whether a semantic call should fail completely, or to return partial results (default). + */ + @Generated + private SemanticErrorMode semanticErrorHandling; + + /* + * Allows the user to set an upper bound on the amount of time it takes for semantic enrichment to finish processing + * before the request fails. + */ + @Generated + private Integer semanticMaxWaitInMilliseconds; + + /* + * This parameter is only valid if the query type is `semantic`. If set, the query returns answers extracted from + * key passages in the highest ranked documents. The number of answers returned can be configured by appending the + * pipe character `|` followed by the `count-` option after the answers parameter value, such as + * `extractive|count-3`. Default count is 1. The confidence threshold can be configured by appending the pipe + * character `|` followed by the `threshold-` option after the answers parameter value, such + * as `extractive|threshold-0.9`. Default threshold is 0.7. The maximum character length of answers can be + * configured by appending the pipe character '|' followed by the 'count-', such + * as 'extractive|maxcharlength-600'. + */ + @Generated + private QueryAnswerType answers; + + /* + * This parameter is only valid if the query type is `semantic`. If set, the query returns captions extracted from + * key passages in the highest ranked documents. When Captions is set to `extractive`, highlighting is enabled by + * default, and can be configured by appending the pipe character `|` followed by the `highlight-` + * option, such as `extractive|highlight-true`. Defaults to `None`. The maximum character length of captions can be + * configured by appending the pipe character '|' followed by the 'count-', such + * as 'extractive|maxcharlength-600'. + */ + @Generated + private QueryCaptionType captions; + + /* + * Allows setting a separate search query that will be solely used for semantic reranking, semantic captions and + * semantic answers. Is useful for scenarios where there is a need to use different queries between the base + * retrieval and ranking phase, and the L2 semantic phase. + */ + @Generated + private String semanticQuery; + + /* + * When QueryRewrites is set to `generative`, the query terms are sent to a generate model which will produce 10 + * (default) rewrites to help increase the recall of the request. The requested count can be configured by appending + * the pipe character `|` followed by the `count-` option, such as `generative|count-3`. + * Defaults to `None`. This parameter is only valid if the query type is `semantic`. + */ + @Generated + private QueryRewritesType queryRewrites; + + /* + * Enables a debugging tool that can be used to further explore your search results. + */ + @Generated + private QueryDebugMode debug; + + /* + * The language of the query. + */ + @Generated + private QueryLanguage queryLanguage; + + /* + * Improve search recall by spell-correcting individual search query terms. + */ + @Generated + private QuerySpellerType speller; + + /* + * The list of field names used for semantic ranking. + */ + @Generated + private List semanticFields; + + /** + * Creates an instance of SearchOptions class. + */ + @Generated + public SearchOptions() { + } + + /** + * Get the includeTotalResultCount property: A value that specifies whether to fetch the total count of results. + * Default is false. Setting this value to true may have a performance impact. Note that the count returned is an + * approximation. + * + * @return the includeTotalResultCount value. + */ + @Generated + public Boolean isIncludeTotalResultCount() { + return this.includeTotalResultCount; + } + + /** + * Set the includeTotalResultCount property: A value that specifies whether to fetch the total count of results. + * Default is false. Setting this value to true may have a performance impact. Note that the count returned is an + * approximation. + * + * @param includeTotalResultCount the includeTotalResultCount value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setIncludeTotalResultCount(Boolean includeTotalResultCount) { + this.includeTotalResultCount = includeTotalResultCount; + return this; + } + + /** + * Get 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. + * + * @return the facets value. + */ + @Generated + public List getFacets() { + return this.facets; + } + + /** + * 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. + * + * @param facets the facets value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setFacets(List facets) { + this.facets = facets; + return this; + } + + /** + * Get the filter property: The OData $filter expression to apply to the search query. + * + * @return the filter value. + */ + @Generated + public String getFilter() { + return this.filter; + } + + /** + * Set the filter property: The OData $filter expression to apply to the search query. + * + * @param filter the filter value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get the highlightFields property: The list of field names to use for hit highlights. Only searchable fields can + * be used for hit highlighting. + * + * @return the highlightFields value. + */ + @Generated + public List getHighlightFields() { + return this.highlightFields; + } + + /** + * Set the highlightFields property: The list of field names to use for hit highlights. Only searchable fields can + * be used for hit highlighting. + * + * @param highlightFields the highlightFields value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setHighlightFields(List highlightFields) { + this.highlightFields = highlightFields; + return this; + } + + /** + * Get the highlightPostTag property: A string tag that is appended to hit highlights. Must be set with + * highlightPreTag. Default is &lt;/em&gt;. + * + * @return the highlightPostTag value. + */ + @Generated + public String getHighlightPostTag() { + return this.highlightPostTag; + } + + /** + * Set the highlightPostTag property: A string tag that is appended to hit highlights. Must be set with + * highlightPreTag. Default is &lt;/em&gt;. + * + * @param highlightPostTag the highlightPostTag value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setHighlightPostTag(String highlightPostTag) { + this.highlightPostTag = highlightPostTag; + return this; + } + + /** + * Get the highlightPreTag property: A string tag that is prepended to hit highlights. Must be set with + * highlightPostTag. Default is &lt;em&gt;. + * + * @return the highlightPreTag value. + */ + @Generated + public String getHighlightPreTag() { + return this.highlightPreTag; + } + + /** + * Set the highlightPreTag property: A string tag that is prepended to hit highlights. Must be set with + * highlightPostTag. Default is &lt;em&gt;. + * + * @param highlightPreTag the highlightPreTag value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setHighlightPreTag(String highlightPreTag) { + this.highlightPreTag = highlightPreTag; + return this; + } + + /** + * Get the minimumCoverage property: A number between 0 and 100 indicating the percentage of the index that must be + * covered by a search query in order for the query to be reported as a success. This parameter can be useful for + * ensuring search availability even for services with only one replica. The default is 100. + * + * @return the minimumCoverage value. + */ + @Generated + public Double getMinimumCoverage() { + return this.minimumCoverage; + } + + /** + * Set the minimumCoverage property: A number between 0 and 100 indicating the percentage of the index that must be + * covered by a search query in order for the query to be reported as a success. This parameter can be useful for + * ensuring search availability even for services with only one replica. The default is 100. + * + * @param minimumCoverage the minimumCoverage value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setMinimumCoverage(Double minimumCoverage) { + this.minimumCoverage = minimumCoverage; + return this; + } + + /** + * Get the orderBy property: The list of OData $orderby expressions by which to sort the results. Each expression + * can be either a field name or a call to either the geo.distance() or the search.score() functions. Each + * expression can be followed by asc to indicate ascending, and desc to indicate descending. The default is + * ascending order. Ties will be broken by the match scores of documents. If no OrderBy is specified, the default + * sort order is descending by document match score. There can be at most 32 $orderby clauses. + * + * @return the orderBy value. + */ + @Generated + public List getOrderBy() { + return this.orderBy; + } + + /** + * Set the orderBy property: The list of OData $orderby expressions by which to sort the results. Each expression + * can be either a field name or a call to either the geo.distance() or the search.score() functions. Each + * expression can be followed by asc to indicate ascending, and desc to indicate descending. The default is + * ascending order. Ties will be broken by the match scores of documents. If no OrderBy is specified, the default + * sort order is descending by document match score. There can be at most 32 $orderby clauses. + * + * @param orderBy the orderBy value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setOrderBy(List orderBy) { + this.orderBy = orderBy; + return this; + } + + /** + * Get the queryType property: A value that specifies the syntax of the search query. The default is 'simple'. Use + * 'full' if your query uses the Lucene query syntax. + * + * @return the queryType value. + */ + @Generated + public QueryType getQueryType() { + return this.queryType; + } + + /** + * Set the queryType property: A value that specifies the syntax of the search query. The default is 'simple'. Use + * 'full' if your query uses the Lucene query syntax. + * + * @param queryType the queryType value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setQueryType(QueryType queryType) { + this.queryType = queryType; + return this; + } + + /** + * Get the scoringParameters property: The list of parameter values to be used in scoring functions (for example, + * referencePointParameter) using the format name-values. For example, if the scoring profile defines a function + * with a parameter called 'mylocation' the parameter string would be "mylocation--122.2,44.8" (without the quotes). + * + * @return the scoringParameters value. + */ + @Generated + public List getScoringParameters() { + return this.scoringParameters; + } + + /** + * Set the scoringParameters property: The list of parameter values to be used in scoring functions (for example, + * referencePointParameter) using the format name-values. For example, if the scoring profile defines a function + * with a parameter called 'mylocation' the parameter string would be "mylocation--122.2,44.8" (without the quotes). + * + * @param scoringParameters the scoringParameters value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setScoringParameters(List scoringParameters) { + this.scoringParameters = scoringParameters; + return this; + } + + /** + * Get the scoringProfile property: The name of a scoring profile to evaluate match scores for matching documents in + * order to sort the results. + * + * @return the scoringProfile value. + */ + @Generated + public String getScoringProfile() { + return this.scoringProfile; + } + + /** + * Set the scoringProfile property: The name of a scoring profile to evaluate match scores for matching documents in + * order to sort the results. + * + * @param scoringProfile the scoringProfile value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setScoringProfile(String scoringProfile) { + this.scoringProfile = scoringProfile; + return this; + } + + /** + * Get the searchFields property: The list of field names to which to scope the full-text search. When using fielded + * search (fieldName:searchExpression) in a full Lucene query, the field names of each fielded search expression + * take precedence over any field names listed in this parameter. + * + * @return the searchFields value. + */ + @Generated + public List getSearchFields() { + return this.searchFields; + } + + /** + * Set the searchFields property: The list of field names to which to scope the full-text search. When using fielded + * search (fieldName:searchExpression) in a full Lucene query, the field names of each fielded search expression + * take precedence over any field names listed in this parameter. + * + * @param searchFields the searchFields value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setSearchFields(List searchFields) { + this.searchFields = searchFields; + return this; + } + + /** + * Get the searchMode property: A value that specifies whether any or all of the search terms must be matched in + * order to count the document as a match. + * + * @return the searchMode value. + */ + @Generated + public SearchMode getSearchMode() { + return this.searchMode; + } + + /** + * Set the searchMode property: A value that specifies whether any or all of the search terms must be matched in + * order to count the document as a match. + * + * @param searchMode the searchMode value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setSearchMode(SearchMode searchMode) { + this.searchMode = searchMode; + return this; + } + + /** + * Get the scoringStatistics property: A value that specifies whether we want to calculate scoring statistics (such + * as document frequency) globally for more consistent scoring, or locally, for lower latency. + * + * @return the scoringStatistics value. + */ + @Generated + public ScoringStatistics getScoringStatistics() { + return this.scoringStatistics; + } + + /** + * Set the scoringStatistics property: A value that specifies whether we want to calculate scoring statistics (such + * as document frequency) globally for more consistent scoring, or locally, for lower latency. + * + * @param scoringStatistics the scoringStatistics value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setScoringStatistics(ScoringStatistics scoringStatistics) { + this.scoringStatistics = scoringStatistics; + return this; + } + + /** + * Get the sessionId property: A value to be used to create a sticky session, which can help to get more consistent + * results. As long as the same sessionId is used, a best-effort attempt will be made to target the same replica + * set. Be wary that reusing the same sessionID values repeatedly can interfere with the load balancing of the + * requests across replicas and adversely affect the performance of the search service. The value used as sessionId + * cannot start with a '_' character. + * + * @return the sessionId value. + */ + @Generated + public String getSessionId() { + return this.sessionId; + } + + /** + * Set the sessionId property: A value to be used to create a sticky session, which can help to get more consistent + * results. As long as the same sessionId is used, a best-effort attempt will be made to target the same replica + * set. Be wary that reusing the same sessionID values repeatedly can interfere with the load balancing of the + * requests across replicas and adversely affect the performance of the search service. The value used as sessionId + * cannot start with a '_' character. + * + * @param sessionId the sessionId value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + + /** + * Get the select property: The list of fields to retrieve. If unspecified, all fields marked as retrievable in the + * schema are included. + * + * @return the select value. + */ + @Generated + public List getSelect() { + return this.select; + } + + /** + * Set the select property: The list of fields to retrieve. If unspecified, all fields marked as retrievable in the + * schema are included. + * + * @param select the select value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setSelect(List select) { + this.select = select; + return this; + } + + /** + * Get the skip property: The number of search results to skip. This value cannot be greater than 100,000. If you + * need to scan documents in sequence, but cannot use $skip due to this limitation, consider using $orderby on a + * totally-ordered key and $filter with a range query instead. + * + * @return the skip value. + */ + @Generated + public Integer getSkip() { + return this.skip; + } + + /** + * Set the skip property: The number of search results to skip. This value cannot be greater than 100,000. If you + * need to scan documents in sequence, but cannot use $skip due to this limitation, consider using $orderby on a + * totally-ordered key and $filter with a range query instead. + * + * @param skip the skip value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setSkip(Integer skip) { + this.skip = skip; + return this; + } + + /** + * Get the top property: The number of search results to retrieve. This can be used in conjunction with $skip to + * implement client-side paging of search results. If results are truncated due to server-side paging, the response + * will include a continuation token that can be used to issue another Search request for the next page of results. + * + * @return the top value. + */ + @Generated + public Integer getTop() { + return this.top; + } + + /** + * Set the top property: The number of search results to retrieve. This can be used in conjunction with $skip to + * implement client-side paging of search results. If results are truncated due to server-side paging, the response + * will include a continuation token that can be used to issue another Search request for the next page of results. + * + * @param top the top value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setTop(Integer top) { + this.top = top; + return this; + } + + /** + * Get the semanticConfiguration property: The name of the semantic configuration that lists which fields should be + * used for semantic ranking, captions, highlights, and answers. + * + * @return the semanticConfiguration value. + */ + @Generated + public String getSemanticConfiguration() { + return this.semanticConfiguration; + } + + /** + * Set the semanticConfiguration property: The name of the semantic configuration that lists which fields should be + * used for semantic ranking, captions, highlights, and answers. + * + * @param semanticConfiguration the semanticConfiguration value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setSemanticConfiguration(String semanticConfiguration) { + this.semanticConfiguration = semanticConfiguration; + return this; + } + + /** + * Get the semanticErrorHandling property: Allows the user to choose whether a semantic call should fail completely, + * or to return partial results (default). + * + * @return the semanticErrorHandling value. + */ + @Generated + public SemanticErrorMode getSemanticErrorHandling() { + return this.semanticErrorHandling; + } + + /** + * Set the semanticErrorHandling property: Allows the user to choose whether a semantic call should fail completely, + * or to return partial results (default). + * + * @param semanticErrorHandling the semanticErrorHandling value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setSemanticErrorHandling(SemanticErrorMode semanticErrorHandling) { + this.semanticErrorHandling = semanticErrorHandling; + return this; + } + + /** + * Get the semanticMaxWaitInMilliseconds property: Allows the user to set an upper bound on the amount of time it + * takes for semantic enrichment to finish processing before the request fails. + * + * @return the semanticMaxWaitInMilliseconds value. + */ + @Generated + public Integer getSemanticMaxWaitInMilliseconds() { + return this.semanticMaxWaitInMilliseconds; + } + + /** + * Set the semanticMaxWaitInMilliseconds property: Allows the user to set an upper bound on the amount of time it + * takes for semantic enrichment to finish processing before the request fails. + * + * @param semanticMaxWaitInMilliseconds the semanticMaxWaitInMilliseconds value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setSemanticMaxWaitInMilliseconds(Integer semanticMaxWaitInMilliseconds) { + this.semanticMaxWaitInMilliseconds = semanticMaxWaitInMilliseconds; + return this; + } + + /** + * Get the answers property: This parameter is only valid if the query type is `semantic`. If set, the query returns + * answers extracted from key passages in the highest ranked documents. The number of answers returned can be + * configured by appending the pipe character `|` followed by the `count-<number of answers>` option after the + * answers parameter value, such as `extractive|count-3`. Default count is 1. The confidence threshold can be + * configured by appending the pipe character `|` followed by the `threshold-<confidence threshold>` option + * after the answers parameter value, such as `extractive|threshold-0.9`. Default threshold is 0.7. The maximum + * character length of answers can be configured by appending the pipe character '|' followed by the + * 'count-<number of maximum character length>', such as 'extractive|maxcharlength-600'. + * + * @return the answers value. + */ + @Generated + public QueryAnswerType getAnswers() { + return this.answers; + } + + /** + * Set the answers property: This parameter is only valid if the query type is `semantic`. If set, the query returns + * answers extracted from key passages in the highest ranked documents. The number of answers returned can be + * configured by appending the pipe character `|` followed by the `count-<number of answers>` option after the + * answers parameter value, such as `extractive|count-3`. Default count is 1. The confidence threshold can be + * configured by appending the pipe character `|` followed by the `threshold-<confidence threshold>` option + * after the answers parameter value, such as `extractive|threshold-0.9`. Default threshold is 0.7. The maximum + * character length of answers can be configured by appending the pipe character '|' followed by the + * 'count-<number of maximum character length>', such as 'extractive|maxcharlength-600'. + * + * @param answers the answers value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setAnswers(QueryAnswerType answers) { + this.answers = answers; + return this; + } + + /** + * Get the captions property: This parameter is only valid if the query type is `semantic`. If set, the query + * returns captions extracted from key passages in the highest ranked documents. When Captions is set to + * `extractive`, highlighting is enabled by default, and can be configured by appending the pipe character `|` + * followed by the `highlight-<true/false>` option, such as `extractive|highlight-true`. Defaults to `None`. + * The maximum character length of captions can be configured by appending the pipe character '|' followed by the + * 'count-<number of maximum character length>', such as 'extractive|maxcharlength-600'. + * + * @return the captions value. + */ + @Generated + public QueryCaptionType getCaptions() { + return this.captions; + } + + /** + * Set the captions property: This parameter is only valid if the query type is `semantic`. If set, the query + * returns captions extracted from key passages in the highest ranked documents. When Captions is set to + * `extractive`, highlighting is enabled by default, and can be configured by appending the pipe character `|` + * followed by the `highlight-<true/false>` option, such as `extractive|highlight-true`. Defaults to `None`. + * The maximum character length of captions can be configured by appending the pipe character '|' followed by the + * 'count-<number of maximum character length>', such as 'extractive|maxcharlength-600'. + * + * @param captions the captions value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setCaptions(QueryCaptionType captions) { + this.captions = captions; + return this; + } + + /** + * Get the semanticQuery property: Allows setting a separate search query that will be solely used for semantic + * reranking, semantic captions and semantic answers. Is useful for scenarios where there is a need to use different + * queries between the base retrieval and ranking phase, and the L2 semantic phase. + * + * @return the semanticQuery value. + */ + @Generated + public String getSemanticQuery() { + return this.semanticQuery; + } + + /** + * Set the semanticQuery property: Allows setting a separate search query that will be solely used for semantic + * reranking, semantic captions and semantic answers. Is useful for scenarios where there is a need to use different + * queries between the base retrieval and ranking phase, and the L2 semantic phase. + * + * @param semanticQuery the semanticQuery value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setSemanticQuery(String semanticQuery) { + this.semanticQuery = semanticQuery; + return this; + } + + /** + * Get the queryRewrites property: When QueryRewrites is set to `generative`, the query terms are sent to a generate + * model which will produce 10 (default) rewrites to help increase the recall of the request. The requested count + * can be configured by appending the pipe character `|` followed by the `count-<number of rewrites>` option, + * such as `generative|count-3`. Defaults to `None`. This parameter is only valid if the query type is `semantic`. + * + * @return the queryRewrites value. + */ + @Generated + public QueryRewritesType getQueryRewrites() { + return this.queryRewrites; + } + + /** + * Set the queryRewrites property: When QueryRewrites is set to `generative`, the query terms are sent to a generate + * model which will produce 10 (default) rewrites to help increase the recall of the request. The requested count + * can be configured by appending the pipe character `|` followed by the `count-<number of rewrites>` option, + * such as `generative|count-3`. Defaults to `None`. This parameter is only valid if the query type is `semantic`. + * + * @param queryRewrites the queryRewrites value to set. + * @return the SearchOptions object itself. + */ + @Generated + public SearchOptions setQueryRewrites(QueryRewritesType queryRewrites) { + this.queryRewrites = queryRewrites; + return this; + } + + /** + * Get the debug property: Enables a debugging tool that can be used to further explore your search results. + * + * @return the debug value. + */ + @Generated + 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. + */ + @Generated + public SearchOptions setDebug(QueryDebugMode debug) { + this.debug = debug; + return this; + } + + /** + * Get the queryLanguage property: The language of the query. + * + * @return the queryLanguage value. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + public SearchOptions setSemanticFields(List semanticFields) { + this.semanticFields = semanticFields; + return this; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchRequest.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchRequest.java new file mode 100644 index 000000000000..5208d50bbbf9 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchRequest.java @@ -0,0 +1,1208 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Parameters for filtering, sorting, faceting, paging, and other search query behaviors. + */ +@Fluent +public final class SearchRequest implements JsonSerializable { + /* + * A value that specifies whether to fetch the total count of results. Default is false. Setting this value to true + * may have a performance impact. Note that the count returned is an approximation. + */ + @Generated + private Boolean includeTotalResultCount; + + /* + * 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. + */ + @Generated + private List facets; + + /* + * The OData $filter expression to apply to the search query. + */ + @Generated + private String filter; + + /* + * The comma-separated list of field names to use for hit highlights. Only searchable fields can be used for hit + * highlighting. + */ + @Generated + private String highlightFields; + + /* + * A string tag that is appended to hit highlights. Must be set with highlightPreTag. Default is </em>. + */ + @Generated + private String highlightPostTag; + + /* + * A string tag that is prepended to hit highlights. Must be set with highlightPostTag. Default is <em>. + */ + @Generated + private String highlightPreTag; + + /* + * A number between 0 and 100 indicating the percentage of the index that must be covered by a search query in order + * for the query to be reported as a success. This parameter can be useful for ensuring search availability even for + * services with only one replica. The default is 100. + */ + @Generated + private Double minimumCoverage; + + /* + * The comma-separated list of OData $orderby expressions by which to sort the results. Each expression can be + * either a field name or a call to either the geo.distance() or the search.score() functions. Each expression can + * be followed by asc to indicate ascending, or desc to indicate descending. The default is ascending order. Ties + * will be broken by the match scores of documents. If no $orderby is specified, the default sort order is + * descending by document match score. There can be at most 32 $orderby clauses. + */ + @Generated + private String orderBy; + + /* + * A value that specifies the syntax of the search query. The default is 'simple'. Use 'full' if your query uses the + * Lucene query syntax. + */ + @Generated + private QueryType queryType; + + /* + * A value that specifies whether we want to calculate scoring statistics (such as document frequency) globally for + * more consistent scoring, or locally, for lower latency. The default is 'local'. Use 'global' to aggregate scoring + * statistics globally before scoring. Using global scoring statistics can increase latency of search queries. + */ + @Generated + private ScoringStatistics scoringStatistics; + + /* + * A value to be used to create a sticky session, which can help getting more consistent results. As long as the + * same sessionId is used, a best-effort attempt will be made to target the same replica set. Be wary that reusing + * the same sessionID values repeatedly can interfere with the load balancing of the requests across replicas and + * adversely affect the performance of the search service. The value used as sessionId cannot start with a '_' + * character. + */ + @Generated + private String sessionId; + + /* + * The list of parameter values to be used in scoring functions (for example, referencePointParameter) using the + * format name-values. For example, if the scoring profile defines a function with a parameter called 'mylocation' + * the parameter string would be "mylocation--122.2,44.8" (without the quotes). + */ + @Generated + private List scoringParameters; + + /* + * The name of a scoring profile to evaluate match scores for matching documents in order to sort the results. + */ + @Generated + private String scoringProfile; + + /* + * Enables a debugging tool that can be used to further explore your reranked results. + */ + @Generated + private QueryDebugMode debug; + + /* + * A full-text search query expression; Use "*" or omit this parameter to match all documents. + */ + @Generated + private String searchText; + + /* + * The comma-separated list of field names to which to scope the full-text search. When using fielded search + * (fieldName:searchExpression) in a full Lucene query, the field names of each fielded search expression take + * precedence over any field names listed in this parameter. + */ + @Generated + private String searchFields; + + /* + * A value that specifies whether any or all of the search terms must be matched in order to count the document as a + * match. + */ + @Generated + private SearchMode searchMode; + + /* + * A value that specifies the language of the search query. + */ + @Generated + private QueryLanguage queryLanguage; + + /* + * A value that specified the type of the speller to use to spell-correct individual search query terms. + */ + @Generated + private QuerySpellerType speller; + + /* + * The comma-separated list of fields to retrieve. If unspecified, all fields marked as retrievable in the schema + * are included. + */ + @Generated + private String select; + + /* + * The number of search results to skip. This value cannot be greater than 100,000. If you need to scan documents in + * sequence, but cannot use skip due to this limitation, consider using orderby on a totally-ordered key and filter + * with a range query instead. + */ + @Generated + private Integer skip; + + /* + * The number of search results to retrieve. This can be used in conjunction with $skip to implement client-side + * paging of search results. If results are truncated due to server-side paging, the response will include a + * continuation token that can be used to issue another Search request for the next page of results. + */ + @Generated + private Integer top; + + /* + * The name of a semantic configuration that will be used when processing documents for queries of type semantic. + */ + @Generated + private String semanticConfiguration; + + /* + * Allows the user to choose whether a semantic call should fail completely (default / current behavior), or to + * return partial results. + */ + @Generated + private SemanticErrorMode semanticErrorHandling; + + /* + * Allows the user to set an upper bound on the amount of time it takes for semantic enrichment to finish processing + * before the request fails. + */ + @Generated + private Integer semanticMaxWaitInMilliseconds; + + /* + * Allows setting a separate search query that will be solely used for semantic reranking, semantic captions and + * semantic answers. Is useful for scenarios where there is a need to use different queries between the base + * retrieval and ranking phase, and the L2 semantic phase. + */ + @Generated + private String semanticQuery; + + /* + * A value that specifies whether answers should be returned as part of the search response. + */ + @Generated + private QueryAnswerType answers; + + /* + * A value that specifies whether captions should be returned as part of the search response. + */ + @Generated + private QueryCaptionType captions; + + /* + * A value that specifies whether query rewrites should be generated to augment the search query. + */ + @Generated + private QueryRewritesType queryRewrites; + + /* + * The comma-separated list of field names used for semantic ranking. + */ + @Generated + private String semanticFields; + + /* + * The query parameters for vector and hybrid search queries. + */ + @Generated + private List vectorQueries; + + /* + * Determines whether or not filters are applied before or after the vector search is performed. Default is + * 'preFilter' for new indexes. + */ + @Generated + private VectorFilterMode vectorFilterMode; + + /* + * The query parameters to configure hybrid search behaviors. + */ + @Generated + private HybridSearch hybridSearch; + + /** + * Creates an instance of SearchRequest class. + */ + @Generated + public SearchRequest() { + } + + /** + * Get the includeTotalResultCount property: A value that specifies whether to fetch the total count of results. + * Default is false. Setting this value to true may have a performance impact. Note that the count returned is an + * approximation. + * + * @return the includeTotalResultCount value. + */ + @Generated + public Boolean isIncludeTotalResultCount() { + return this.includeTotalResultCount; + } + + /** + * Set the includeTotalResultCount property: A value that specifies whether to fetch the total count of results. + * Default is false. Setting this value to true may have a performance impact. Note that the count returned is an + * approximation. + * + * @param includeTotalResultCount the includeTotalResultCount value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setIncludeTotalResultCount(Boolean includeTotalResultCount) { + this.includeTotalResultCount = includeTotalResultCount; + return this; + } + + /** + * Get 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. + * + * @return the facets value. + */ + @Generated + public List getFacets() { + return this.facets; + } + + /** + * 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. + * + * @param facets the facets value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setFacets(List facets) { + this.facets = facets; + return this; + } + + /** + * Get the filter property: The OData $filter expression to apply to the search query. + * + * @return the filter value. + */ + @Generated + public String getFilter() { + return this.filter; + } + + /** + * Set the filter property: The OData $filter expression to apply to the search query. + * + * @param filter the filter value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get the highlightFields property: The comma-separated list of field names to use for hit highlights. Only + * searchable fields can be used for hit highlighting. + * + * @return the highlightFields value. + */ + @Generated + public String getHighlightFields() { + return this.highlightFields; + } + + /** + * Set the highlightFields property: The comma-separated list of field names to use for hit highlights. Only + * searchable fields can be used for hit highlighting. + * + * @param highlightFields the highlightFields value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setHighlightFields(String highlightFields) { + this.highlightFields = highlightFields; + return this; + } + + /** + * Get the highlightPostTag property: A string tag that is appended to hit highlights. Must be set with + * highlightPreTag. Default is &lt;/em&gt;. + * + * @return the highlightPostTag value. + */ + @Generated + public String getHighlightPostTag() { + return this.highlightPostTag; + } + + /** + * Set the highlightPostTag property: A string tag that is appended to hit highlights. Must be set with + * highlightPreTag. Default is &lt;/em&gt;. + * + * @param highlightPostTag the highlightPostTag value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setHighlightPostTag(String highlightPostTag) { + this.highlightPostTag = highlightPostTag; + return this; + } + + /** + * Get the highlightPreTag property: A string tag that is prepended to hit highlights. Must be set with + * highlightPostTag. Default is &lt;em&gt;. + * + * @return the highlightPreTag value. + */ + @Generated + public String getHighlightPreTag() { + return this.highlightPreTag; + } + + /** + * Set the highlightPreTag property: A string tag that is prepended to hit highlights. Must be set with + * highlightPostTag. Default is &lt;em&gt;. + * + * @param highlightPreTag the highlightPreTag value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setHighlightPreTag(String highlightPreTag) { + this.highlightPreTag = highlightPreTag; + return this; + } + + /** + * Get the minimumCoverage property: A number between 0 and 100 indicating the percentage of the index that must be + * covered by a search query in order for the query to be reported as a success. This parameter can be useful for + * ensuring search availability even for services with only one replica. The default is 100. + * + * @return the minimumCoverage value. + */ + @Generated + public Double getMinimumCoverage() { + return this.minimumCoverage; + } + + /** + * Set the minimumCoverage property: A number between 0 and 100 indicating the percentage of the index that must be + * covered by a search query in order for the query to be reported as a success. This parameter can be useful for + * ensuring search availability even for services with only one replica. The default is 100. + * + * @param minimumCoverage the minimumCoverage value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setMinimumCoverage(Double minimumCoverage) { + this.minimumCoverage = minimumCoverage; + return this; + } + + /** + * Get the orderBy property: The comma-separated list of OData $orderby expressions by which to sort the results. + * Each expression can be either a field name or a call to either the geo.distance() or the search.score() + * functions. Each expression can be followed by asc to indicate ascending, or desc to indicate descending. The + * default is ascending order. Ties will be broken by the match scores of documents. If no $orderby is specified, + * the default sort order is descending by document match score. There can be at most 32 $orderby clauses. + * + * @return the orderBy value. + */ + @Generated + public String getOrderBy() { + return this.orderBy; + } + + /** + * Set the orderBy property: The comma-separated list of OData $orderby expressions by which to sort the results. + * Each expression can be either a field name or a call to either the geo.distance() or the search.score() + * functions. Each expression can be followed by asc to indicate ascending, or desc to indicate descending. The + * default is ascending order. Ties will be broken by the match scores of documents. If no $orderby is specified, + * the default sort order is descending by document match score. There can be at most 32 $orderby clauses. + * + * @param orderBy the orderBy value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + /** + * Get the queryType property: A value that specifies the syntax of the search query. The default is 'simple'. Use + * 'full' if your query uses the Lucene query syntax. + * + * @return the queryType value. + */ + @Generated + public QueryType getQueryType() { + return this.queryType; + } + + /** + * Set the queryType property: A value that specifies the syntax of the search query. The default is 'simple'. Use + * 'full' if your query uses the Lucene query syntax. + * + * @param queryType the queryType value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setQueryType(QueryType queryType) { + this.queryType = queryType; + return this; + } + + /** + * Get the scoringStatistics property: A value that specifies whether we want to calculate scoring statistics (such + * as document frequency) globally for more consistent scoring, or locally, for lower latency. The default is + * 'local'. Use 'global' to aggregate scoring statistics globally before scoring. Using global scoring statistics + * can increase latency of search queries. + * + * @return the scoringStatistics value. + */ + @Generated + public ScoringStatistics getScoringStatistics() { + return this.scoringStatistics; + } + + /** + * Set the scoringStatistics property: A value that specifies whether we want to calculate scoring statistics (such + * as document frequency) globally for more consistent scoring, or locally, for lower latency. The default is + * 'local'. Use 'global' to aggregate scoring statistics globally before scoring. Using global scoring statistics + * can increase latency of search queries. + * + * @param scoringStatistics the scoringStatistics value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setScoringStatistics(ScoringStatistics scoringStatistics) { + this.scoringStatistics = scoringStatistics; + return this; + } + + /** + * Get the sessionId property: A value to be used to create a sticky session, which can help getting more consistent + * results. As long as the same sessionId is used, a best-effort attempt will be made to target the same replica + * set. Be wary that reusing the same sessionID values repeatedly can interfere with the load balancing of the + * requests across replicas and adversely affect the performance of the search service. The value used as sessionId + * cannot start with a '_' character. + * + * @return the sessionId value. + */ + @Generated + public String getSessionId() { + return this.sessionId; + } + + /** + * Set the sessionId property: A value to be used to create a sticky session, which can help getting more consistent + * results. As long as the same sessionId is used, a best-effort attempt will be made to target the same replica + * set. Be wary that reusing the same sessionID values repeatedly can interfere with the load balancing of the + * requests across replicas and adversely affect the performance of the search service. The value used as sessionId + * cannot start with a '_' character. + * + * @param sessionId the sessionId value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + + /** + * Get the scoringParameters property: The list of parameter values to be used in scoring functions (for example, + * referencePointParameter) using the format name-values. For example, if the scoring profile defines a function + * with a parameter called 'mylocation' the parameter string would be "mylocation--122.2,44.8" (without the quotes). + * + * @return the scoringParameters value. + */ + @Generated + public List getScoringParameters() { + return this.scoringParameters; + } + + /** + * Set the scoringParameters property: The list of parameter values to be used in scoring functions (for example, + * referencePointParameter) using the format name-values. For example, if the scoring profile defines a function + * with a parameter called 'mylocation' the parameter string would be "mylocation--122.2,44.8" (without the quotes). + * + * @param scoringParameters the scoringParameters value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setScoringParameters(List scoringParameters) { + this.scoringParameters = scoringParameters; + return this; + } + + /** + * Get the scoringProfile property: The name of a scoring profile to evaluate match scores for matching documents in + * order to sort the results. + * + * @return the scoringProfile value. + */ + @Generated + public String getScoringProfile() { + return this.scoringProfile; + } + + /** + * Set the scoringProfile property: The name of a scoring profile to evaluate match scores for matching documents in + * order to sort the results. + * + * @param scoringProfile the scoringProfile value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setScoringProfile(String scoringProfile) { + this.scoringProfile = 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. + */ + @Generated + 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. + */ + @Generated + 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. + * + * @return the searchText value. + */ + @Generated + public String getSearchText() { + return this.searchText; + } + + /** + * Set the searchText property: A full-text search query expression; Use "*" or omit this parameter to match all + * documents. + * + * @param searchText the searchText value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setSearchText(String searchText) { + this.searchText = searchText; + return this; + } + + /** + * Get the searchFields property: The comma-separated list of field names to which to scope the full-text search. + * When using fielded search (fieldName:searchExpression) in a full Lucene query, the field names of each fielded + * search expression take precedence over any field names listed in this parameter. + * + * @return the searchFields value. + */ + @Generated + public String getSearchFields() { + return this.searchFields; + } + + /** + * Set the searchFields property: The comma-separated list of field names to which to scope the full-text search. + * When using fielded search (fieldName:searchExpression) in a full Lucene query, the field names of each fielded + * search expression take precedence over any field names listed in this parameter. + * + * @param searchFields the searchFields value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setSearchFields(String searchFields) { + this.searchFields = searchFields; + return this; + } + + /** + * Get the searchMode property: A value that specifies whether any or all of the search terms must be matched in + * order to count the document as a match. + * + * @return the searchMode value. + */ + @Generated + public SearchMode getSearchMode() { + return this.searchMode; + } + + /** + * Set the searchMode property: A value that specifies whether any or all of the search terms must be matched in + * order to count the document as a match. + * + * @param searchMode the searchMode value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setSearchMode(SearchMode searchMode) { + this.searchMode = searchMode; + return this; + } + + /** + * Get the queryLanguage property: A value that specifies the language of the search query. + * + * @return the queryLanguage value. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + * + * @return the select value. + */ + @Generated + public String getSelect() { + return this.select; + } + + /** + * Set the select property: The comma-separated list of fields to retrieve. If unspecified, all fields marked as + * retrievable in the schema are included. + * + * @param select the select value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setSelect(String select) { + this.select = select; + return this; + } + + /** + * Get the skip property: The number of search results to skip. This value cannot be greater than 100,000. If you + * need to scan documents in sequence, but cannot use skip due to this limitation, consider using orderby on a + * totally-ordered key and filter with a range query instead. + * + * @return the skip value. + */ + @Generated + public Integer getSkip() { + return this.skip; + } + + /** + * Set the skip property: The number of search results to skip. This value cannot be greater than 100,000. If you + * need to scan documents in sequence, but cannot use skip due to this limitation, consider using orderby on a + * totally-ordered key and filter with a range query instead. + * + * @param skip the skip value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setSkip(Integer skip) { + this.skip = skip; + return this; + } + + /** + * Get the top property: The number of search results to retrieve. This can be used in conjunction with $skip to + * implement client-side paging of search results. If results are truncated due to server-side paging, the response + * will include a continuation token that can be used to issue another Search request for the next page of results. + * + * @return the top value. + */ + @Generated + public Integer getTop() { + return this.top; + } + + /** + * Set the top property: The number of search results to retrieve. This can be used in conjunction with $skip to + * implement client-side paging of search results. If results are truncated due to server-side paging, the response + * will include a continuation token that can be used to issue another Search request for the next page of results. + * + * @param top the top value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setTop(Integer top) { + this.top = top; + return this; + } + + /** + * Get the semanticConfiguration property: The name of a semantic configuration that will be used when processing + * documents for queries of type semantic. + * + * @return the semanticConfiguration value. + */ + @Generated + public String getSemanticConfiguration() { + return this.semanticConfiguration; + } + + /** + * Set the semanticConfiguration property: The name of a semantic configuration that will be used when processing + * documents for queries of type semantic. + * + * @param semanticConfiguration the semanticConfiguration value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setSemanticConfiguration(String semanticConfiguration) { + this.semanticConfiguration = semanticConfiguration; + return this; + } + + /** + * Get the semanticErrorHandling property: Allows the user to choose whether a semantic call should fail completely + * (default / current behavior), or to return partial results. + * + * @return the semanticErrorHandling value. + */ + @Generated + public SemanticErrorMode getSemanticErrorHandling() { + return this.semanticErrorHandling; + } + + /** + * Set the semanticErrorHandling property: Allows the user to choose whether a semantic call should fail completely + * (default / current behavior), or to return partial results. + * + * @param semanticErrorHandling the semanticErrorHandling value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setSemanticErrorHandling(SemanticErrorMode semanticErrorHandling) { + this.semanticErrorHandling = semanticErrorHandling; + return this; + } + + /** + * Get the semanticMaxWaitInMilliseconds property: Allows the user to set an upper bound on the amount of time it + * takes for semantic enrichment to finish processing before the request fails. + * + * @return the semanticMaxWaitInMilliseconds value. + */ + @Generated + public Integer getSemanticMaxWaitInMilliseconds() { + return this.semanticMaxWaitInMilliseconds; + } + + /** + * Set the semanticMaxWaitInMilliseconds property: Allows the user to set an upper bound on the amount of time it + * takes for semantic enrichment to finish processing before the request fails. + * + * @param semanticMaxWaitInMilliseconds the semanticMaxWaitInMilliseconds value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setSemanticMaxWaitInMilliseconds(Integer semanticMaxWaitInMilliseconds) { + this.semanticMaxWaitInMilliseconds = semanticMaxWaitInMilliseconds; + return this; + } + + /** + * Get the semanticQuery property: Allows setting a separate search query that will be solely used for semantic + * reranking, semantic captions and semantic answers. Is useful for scenarios where there is a need to use different + * queries between the base retrieval and ranking phase, and the L2 semantic phase. + * + * @return the semanticQuery value. + */ + @Generated + public String getSemanticQuery() { + return this.semanticQuery; + } + + /** + * Set the semanticQuery property: Allows setting a separate search query that will be solely used for semantic + * reranking, semantic captions and semantic answers. Is useful for scenarios where there is a need to use different + * queries between the base retrieval and ranking phase, and the L2 semantic phase. + * + * @param semanticQuery the semanticQuery value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setSemanticQuery(String semanticQuery) { + this.semanticQuery = semanticQuery; + return this; + } + + /** + * Get the answers property: A value that specifies whether answers should be returned as part of the search + * response. + * + * @return the answers value. + */ + @Generated + public QueryAnswerType getAnswers() { + return this.answers; + } + + /** + * Set the answers property: A value that specifies whether answers should be returned as part of the search + * response. + * + * @param answers the answers value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setAnswers(QueryAnswerType answers) { + this.answers = answers; + return this; + } + + /** + * Get the captions property: A value that specifies whether captions should be returned as part of the search + * response. + * + * @return the captions value. + */ + @Generated + public QueryCaptionType getCaptions() { + return this.captions; + } + + /** + * Set the captions property: A value that specifies whether captions should be returned as part of the search + * response. + * + * @param captions the captions value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setCaptions(QueryCaptionType captions) { + this.captions = captions; + return this; + } + + /** + * Get the queryRewrites property: A value that specifies whether query rewrites should be generated to augment the + * search query. + * + * @return the queryRewrites value. + */ + @Generated + public QueryRewritesType getQueryRewrites() { + return this.queryRewrites; + } + + /** + * Set the queryRewrites property: A value that specifies whether query rewrites should be generated to augment the + * search query. + * + * @param queryRewrites the queryRewrites value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setQueryRewrites(QueryRewritesType queryRewrites) { + this.queryRewrites = queryRewrites; + return this; + } + + /** + * Get the semanticFields property: The comma-separated list of field names used for semantic ranking. + * + * @return the semanticFields value. + */ + @Generated + 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. + */ + @Generated + public SearchRequest setSemanticFields(String semanticFields) { + this.semanticFields = semanticFields; + return this; + } + + /** + * Get the vectorQueries property: The query parameters for vector and hybrid search queries. + * + * @return the vectorQueries value. + */ + @Generated + public List getVectorQueries() { + return this.vectorQueries; + } + + /** + * Set the vectorQueries property: The query parameters for vector and hybrid search queries. + * + * @param vectorQueries the vectorQueries value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setVectorQueries(List vectorQueries) { + this.vectorQueries = vectorQueries; + return this; + } + + /** + * Get the vectorFilterMode property: Determines whether or not filters are applied before or after the vector + * search is performed. Default is 'preFilter' for new indexes. + * + * @return the vectorFilterMode value. + */ + @Generated + public VectorFilterMode getVectorFilterMode() { + return this.vectorFilterMode; + } + + /** + * Set the vectorFilterMode property: Determines whether or not filters are applied before or after the vector + * search is performed. Default is 'preFilter' for new indexes. + * + * @param vectorFilterMode the vectorFilterMode value to set. + * @return the SearchRequest object itself. + */ + @Generated + public SearchRequest setVectorFilterMode(VectorFilterMode vectorFilterMode) { + this.vectorFilterMode = vectorFilterMode; + return this; + } + + /** + * Get the hybridSearch property: The query parameters to configure hybrid search behaviors. + * + * @return the hybridSearch value. + */ + @Generated + 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. + */ + @Generated + public SearchRequest setHybridSearch(HybridSearch hybridSearch) { + this.hybridSearch = hybridSearch; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("count", this.includeTotalResultCount); + jsonWriter.writeArrayField("facets", this.facets, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("filter", this.filter); + jsonWriter.writeStringField("highlight", this.highlightFields); + jsonWriter.writeStringField("highlightPostTag", this.highlightPostTag); + jsonWriter.writeStringField("highlightPreTag", this.highlightPreTag); + jsonWriter.writeNumberField("minimumCoverage", this.minimumCoverage); + jsonWriter.writeStringField("orderby", this.orderBy); + jsonWriter.writeStringField("queryType", this.queryType == null ? null : this.queryType.toString()); + jsonWriter.writeStringField("scoringStatistics", + this.scoringStatistics == null ? null : this.scoringStatistics.toString()); + jsonWriter.writeStringField("sessionId", this.sessionId); + 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); + jsonWriter.writeStringField("semanticConfiguration", this.semanticConfiguration); + jsonWriter.writeStringField("semanticErrorHandling", + this.semanticErrorHandling == null ? null : this.semanticErrorHandling.toString()); + jsonWriter.writeNumberField("semanticMaxWaitInMilliseconds", this.semanticMaxWaitInMilliseconds); + jsonWriter.writeStringField("semanticQuery", this.semanticQuery); + jsonWriter.writeStringField("answers", this.answers == null ? null : this.answers.toString()); + jsonWriter.writeStringField("captions", this.captions == null ? null : this.captions.toString()); + jsonWriter.writeStringField("queryRewrites", this.queryRewrites == null ? null : this.queryRewrites.toString()); + 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(); + } + + /** + * Reads an instance of SearchRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchRequest 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 SearchRequest. + */ + @Generated + public static SearchRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchRequest deserializedSearchRequest = new SearchRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("count".equals(fieldName)) { + deserializedSearchRequest.includeTotalResultCount = reader.getNullable(JsonReader::getBoolean); + } else if ("facets".equals(fieldName)) { + List facets = reader.readArray(reader1 -> reader1.getString()); + deserializedSearchRequest.facets = facets; + } else if ("filter".equals(fieldName)) { + deserializedSearchRequest.filter = reader.getString(); + } else if ("highlight".equals(fieldName)) { + deserializedSearchRequest.highlightFields = reader.getString(); + } else if ("highlightPostTag".equals(fieldName)) { + deserializedSearchRequest.highlightPostTag = reader.getString(); + } else if ("highlightPreTag".equals(fieldName)) { + deserializedSearchRequest.highlightPreTag = reader.getString(); + } else if ("minimumCoverage".equals(fieldName)) { + deserializedSearchRequest.minimumCoverage = reader.getNullable(JsonReader::getDouble); + } else if ("orderby".equals(fieldName)) { + deserializedSearchRequest.orderBy = reader.getString(); + } else if ("queryType".equals(fieldName)) { + deserializedSearchRequest.queryType = QueryType.fromString(reader.getString()); + } else if ("scoringStatistics".equals(fieldName)) { + deserializedSearchRequest.scoringStatistics = ScoringStatistics.fromString(reader.getString()); + } else if ("sessionId".equals(fieldName)) { + deserializedSearchRequest.sessionId = reader.getString(); + } else if ("scoringParameters".equals(fieldName)) { + List scoringParameters = reader.readArray(reader1 -> reader1.getString()); + 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)) { + deserializedSearchRequest.skip = reader.getNullable(JsonReader::getInt); + } else if ("top".equals(fieldName)) { + deserializedSearchRequest.top = reader.getNullable(JsonReader::getInt); + } else if ("semanticConfiguration".equals(fieldName)) { + deserializedSearchRequest.semanticConfiguration = reader.getString(); + } else if ("semanticErrorHandling".equals(fieldName)) { + deserializedSearchRequest.semanticErrorHandling = SemanticErrorMode.fromString(reader.getString()); + } else if ("semanticMaxWaitInMilliseconds".equals(fieldName)) { + deserializedSearchRequest.semanticMaxWaitInMilliseconds = reader.getNullable(JsonReader::getInt); + } else if ("semanticQuery".equals(fieldName)) { + deserializedSearchRequest.semanticQuery = reader.getString(); + } else if ("answers".equals(fieldName)) { + deserializedSearchRequest.answers = QueryAnswerType.fromString(reader.getString()); + } else if ("captions".equals(fieldName)) { + deserializedSearchRequest.captions = QueryCaptionType.fromString(reader.getString()); + } else if ("queryRewrites".equals(fieldName)) { + deserializedSearchRequest.queryRewrites = QueryRewritesType.fromString(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(); + } + } + + return deserializedSearchRequest; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchResourceEncryptionKey.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchResourceEncryptionKey.java new file mode 100644 index 000000000000..cc46013c84ac --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchResourceEncryptionKey.java @@ -0,0 +1,235 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 customer-managed encryption key in Azure Key Vault. Keys that you create and manage can be used to encrypt or + * decrypt data-at-rest, such as indexes and synonym maps. + */ +@Fluent +public final class SearchResourceEncryptionKey implements JsonSerializable { + /* + * The name of your Azure Key Vault key to be used to encrypt your data at rest. + */ + @Generated + private String keyName; + + /* + * The version of your Azure Key Vault key to be used to encrypt your data at rest. + */ + @Generated + private String keyVersion; + + /* + * The URI of your Azure Key Vault, also referred to as DNS name, that contains the key to be used to encrypt your + * data at rest. An example URI might be `https://my-keyvault-name.vault.azure.net`. + */ + @Generated + private String vaultUri; + + /* + * Optional Azure Active Directory credentials used for accessing your Azure Key Vault. Not required if using + * managed identity instead. + */ + @Generated + private AzureActiveDirectoryApplicationCredentials accessCredentials; + + /* + * An explicit managed identity to use for this encryption key. If not specified and the access credentials property + * is null, the system-assigned managed identity is used. On update to the resource, if the explicit identity is + * unspecified, it remains unchanged. If "none" is specified, the value of this property is cleared. + */ + @Generated + private SearchIndexerDataIdentity identity; + + /** + * Creates an instance of SearchResourceEncryptionKey class. + */ + @Generated + public SearchResourceEncryptionKey() { + } + + /** + * Get the keyName property: The name of your Azure Key Vault key to be used to encrypt your data at rest. + * + * @return the keyName value. + */ + @Generated + public String getKeyName() { + return this.keyName; + } + + /** + * Set the keyName property: The name of your Azure Key Vault key to be used to encrypt your data at rest. + * + * @param keyName the keyName value to set. + * @return the SearchResourceEncryptionKey object itself. + */ + @Generated + public SearchResourceEncryptionKey setKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get the keyVersion property: The version of your Azure Key Vault key to be used to encrypt your data at rest. + * + * @return the keyVersion value. + */ + @Generated + public String getKeyVersion() { + return this.keyVersion; + } + + /** + * Set the keyVersion property: The version of your Azure Key Vault key to be used to encrypt your data at rest. + * + * @param keyVersion the keyVersion value to set. + * @return the SearchResourceEncryptionKey object itself. + */ + @Generated + public SearchResourceEncryptionKey setKeyVersion(String keyVersion) { + this.keyVersion = keyVersion; + return this; + } + + /** + * Get the vaultUri property: The URI of your Azure Key Vault, also referred to as DNS name, that contains the key + * to be used to encrypt your data at rest. An example URI might be `https://my-keyvault-name.vault.azure.net`. + * + * @return the vaultUri value. + */ + @Generated + public String getVaultUri() { + return this.vaultUri; + } + + /** + * Set the vaultUri property: The URI of your Azure Key Vault, also referred to as DNS name, that contains the key + * to be used to encrypt your data at rest. An example URI might be `https://my-keyvault-name.vault.azure.net`. + * + * @param vaultUri the vaultUri value to set. + * @return the SearchResourceEncryptionKey object itself. + */ + @Generated + public SearchResourceEncryptionKey setVaultUri(String vaultUri) { + this.vaultUri = vaultUri; + return this; + } + + /** + * Get the accessCredentials property: Optional Azure Active Directory credentials used for accessing your Azure Key + * Vault. Not required if using managed identity instead. + * + * @return the accessCredentials value. + */ + @Generated + public AzureActiveDirectoryApplicationCredentials getAccessCredentials() { + return this.accessCredentials; + } + + /** + * Set the accessCredentials property: Optional Azure Active Directory credentials used for accessing your Azure Key + * Vault. Not required if using managed identity instead. + * + * @param accessCredentials the accessCredentials value to set. + * @return the SearchResourceEncryptionKey object itself. + */ + @Generated + public SearchResourceEncryptionKey + setAccessCredentials(AzureActiveDirectoryApplicationCredentials accessCredentials) { + this.accessCredentials = accessCredentials; + return this; + } + + /** + * Get the identity property: An explicit managed identity to use for this encryption key. If not specified and the + * access credentials property is null, the system-assigned managed identity is used. On update to the resource, if + * the explicit identity is unspecified, it remains unchanged. If "none" is specified, the value of this property is + * cleared. + * + * @return the identity value. + */ + @Generated + public SearchIndexerDataIdentity getIdentity() { + return this.identity; + } + + /** + * Set the identity property: An explicit managed identity to use for this encryption key. If not specified and the + * access credentials property is null, the system-assigned managed identity is used. On update to the resource, if + * the explicit identity is unspecified, it remains unchanged. If "none" is specified, the value of this property is + * cleared. + * + * @param identity the identity value to set. + * @return the SearchResourceEncryptionKey object itself. + */ + @Generated + public SearchResourceEncryptionKey setIdentity(SearchIndexerDataIdentity identity) { + this.identity = identity; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("keyVaultKeyName", this.keyName); + jsonWriter.writeStringField("keyVaultUri", this.vaultUri); + jsonWriter.writeStringField("keyVaultKeyVersion", this.keyVersion); + jsonWriter.writeJsonField("accessCredentials", this.accessCredentials); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchResourceEncryptionKey from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchResourceEncryptionKey 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 SearchResourceEncryptionKey. + */ + @Generated + public static SearchResourceEncryptionKey fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchResourceEncryptionKey deserializedSearchResourceEncryptionKey = new SearchResourceEncryptionKey(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keyVaultKeyName".equals(fieldName)) { + deserializedSearchResourceEncryptionKey.keyName = reader.getString(); + } else if ("keyVaultUri".equals(fieldName)) { + deserializedSearchResourceEncryptionKey.vaultUri = reader.getString(); + } else if ("keyVaultKeyVersion".equals(fieldName)) { + deserializedSearchResourceEncryptionKey.keyVersion = reader.getString(); + } else if ("accessCredentials".equals(fieldName)) { + deserializedSearchResourceEncryptionKey.accessCredentials + = AzureActiveDirectoryApplicationCredentials.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedSearchResourceEncryptionKey.identity = SearchIndexerDataIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchResourceEncryptionKey; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchResult.java new file mode 100644 index 000000000000..5a3e38382d6b --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchResult.java @@ -0,0 +1,229 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * Contains a document found by a search query, plus associated metadata. + */ +@Fluent +public final class SearchResult implements JsonSerializable { + /* + * The relevance score of the document compared to other documents returned by the query. + */ + @Generated + private double score; + + /* + * The relevance score computed by the semantic ranker for the top search results. Search results are sorted by the + * RerankerScore first and then by the Score. RerankerScore is only returned for queries of type 'semantic'. + */ + @Generated + private Double rerankerScore; + + /* + * The relevance score computed by boosting the Reranker Score. Search results are sorted by the + * RerankerScore/RerankerBoostedScore based on useScoringProfileBoostedRanking in the Semantic Config. + * RerankerBoostedScore is only returned for queries of type 'semantic' + */ + @Generated + private Double rerankerBoostedScore; + + /* + * Text fragments from the document that indicate the matching search terms, organized by each applicable field; + * null if hit highlighting was not enabled for the query. + */ + @Generated + private Map> highlights; + + /* + * Captions are the most representative passages from the document relatively to the search query. They are often + * used as document summary. Captions are only returned for queries of type 'semantic'. + */ + @Generated + private List captions; + + /* + * Contains debugging information that can be used to further explore your search results. + */ + @Generated + private DocumentDebugInfo documentDebugInfo; + + /* + * Contains a document found by a search query, plus associated metadata. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of SearchResult class. + */ + @Generated + public SearchResult() { + } + + /** + * Get the score property: The relevance score of the document compared to other documents returned by the query. + * + * @return the score value. + */ + @Generated + public double getScore() { + return this.score; + } + + /** + * Get the rerankerScore property: The relevance score computed by the semantic ranker for the top search results. + * Search results are sorted by the RerankerScore first and then by the Score. RerankerScore is only returned for + * queries of type 'semantic'. + * + * @return the rerankerScore value. + */ + @Generated + public Double getRerankerScore() { + return this.rerankerScore; + } + + /** + * Get the rerankerBoostedScore property: The relevance score computed by boosting the Reranker Score. Search + * results are sorted by the RerankerScore/RerankerBoostedScore based on useScoringProfileBoostedRanking in the + * Semantic Config. RerankerBoostedScore is only returned for queries of type 'semantic'. + * + * @return the rerankerBoostedScore value. + */ + @Generated + public Double getRerankerBoostedScore() { + return this.rerankerBoostedScore; + } + + /** + * Get the highlights property: Text fragments from the document that indicate the matching search terms, organized + * by each applicable field; null if hit highlighting was not enabled for the query. + * + * @return the highlights value. + */ + @Generated + public Map> getHighlights() { + return this.highlights; + } + + /** + * Get the captions property: Captions are the most representative passages from the document relatively to the + * search query. They are often used as document summary. Captions are only returned for queries of type 'semantic'. + * + * @return the captions value. + */ + @Generated + 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. + */ + @Generated + public DocumentDebugInfo getDocumentDebugInfo() { + return this.documentDebugInfo; + } + + /** + * Get the additionalProperties property: Contains a document found by a search query, plus associated metadata. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: Contains a document found by a search query, plus associated metadata. + * + * @param additionalProperties the additionalProperties value to set. + * @return the SearchResult object itself. + */ + @Generated + public SearchResult setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchResult 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 SearchResult. + */ + @Generated + public static SearchResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchResult deserializedSearchResult = new SearchResult(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("@search.score".equals(fieldName)) { + deserializedSearchResult.score = reader.getDouble(); + } else if ("@search.rerankerScore".equals(fieldName)) { + deserializedSearchResult.rerankerScore = reader.getNullable(JsonReader::getDouble); + } else if ("@search.rerankerBoostedScore".equals(fieldName)) { + deserializedSearchResult.rerankerBoostedScore = reader.getNullable(JsonReader::getDouble); + } else if ("@search.highlights".equals(fieldName)) { + Map> highlights + = reader.readMap(reader1 -> reader1.readArray(reader2 -> reader2.getString())); + deserializedSearchResult.highlights = highlights; + } else if ("@search.captions".equals(fieldName)) { + List captions + = reader.readArray(reader1 -> QueryCaptionResult.fromJson(reader1)); + deserializedSearchResult.captions = captions; + } else if ("@search.documentDebugInfo".equals(fieldName)) { + deserializedSearchResult.documentDebugInfo = DocumentDebugInfo.fromJson(reader); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedSearchResult.additionalProperties = additionalProperties; + + return deserializedSearchResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchScoreThreshold.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchScoreThreshold.java new file mode 100644 index 000000000000..eb15139e81ea --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SearchScoreThreshold.java @@ -0,0 +1,120 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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. + */ +@Fluent +public final class SearchScoreThreshold extends VectorThreshold { + /* + * The kind of threshold used to filter vector queries + */ + @Generated + 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. + */ + @Generated + private double value; + + /** + * Creates an instance of SearchScoreThreshold class. + */ + @Generated + public SearchScoreThreshold() { + } + + /** + * Get the kind property: The kind of threshold used to filter vector queries. + * + * @return the kind value. + */ + @Generated + @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 value. + */ + @Generated + public double getValue() { + return this.value; + } + + /** + * Set 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. + * + * @param value the value value to set. + * @return the SearchScoreThreshold object itself. + */ + @Generated + public SearchScoreThreshold setValue(double value) { + this.value = value; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + public static SearchScoreThreshold fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SearchScoreThreshold deserializedSearchScoreThreshold = new SearchScoreThreshold(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + deserializedSearchScoreThreshold.value = reader.getDouble(); + } else if ("kind".equals(fieldName)) { + deserializedSearchScoreThreshold.kind = VectorThresholdKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSearchScoreThreshold; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticConfiguration.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticConfiguration.java new file mode 100644 index 000000000000..b1754617c879 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticConfiguration.java @@ -0,0 +1,195 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines a specific configuration to be used in the context of semantic capabilities. + */ +@Fluent +public final class SemanticConfiguration implements JsonSerializable { + /* + * The name of the semantic configuration. + */ + @Generated + private String name; + + /* + * Describes the title, content, and keyword fields to be used for semantic ranking, captions, highlights, and + * answers. At least one of the three sub properties (titleField, prioritizedKeywordsFields and + * prioritizedContentFields) need to be set. + */ + @Generated + private SemanticPrioritizedFields prioritizedFields; + + /* + * Specifies the score type to be used for the sort order of the search results. + */ + @Generated + private RankingOrder rankingOrder; + + /* + * Determines which semantic or query rewrite models to use during model flighting/upgrades. + */ + @Generated + private Boolean flightingOptIn; + + /** + * Creates an instance of SemanticConfiguration class. + */ + @Generated + public SemanticConfiguration() { + } + + /** + * Get the name property: The name of the semantic configuration. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the semantic configuration. + * + * @param name the name value to set. + * @return the SemanticConfiguration object itself. + */ + @Generated + public SemanticConfiguration setName(String name) { + this.name = name; + return this; + } + + /** + * Get the prioritizedFields property: Describes the title, content, and keyword fields to be used for semantic + * ranking, captions, highlights, and answers. At least one of the three sub properties (titleField, + * prioritizedKeywordsFields and prioritizedContentFields) need to be set. + * + * @return the prioritizedFields value. + */ + @Generated + public SemanticPrioritizedFields getPrioritizedFields() { + return this.prioritizedFields; + } + + /** + * Set the prioritizedFields property: Describes the title, content, and keyword fields to be used for semantic + * ranking, captions, highlights, and answers. At least one of the three sub properties (titleField, + * prioritizedKeywordsFields and prioritizedContentFields) need to be set. + * + * @param prioritizedFields the prioritizedFields value to set. + * @return the SemanticConfiguration object itself. + */ + @Generated + public SemanticConfiguration setPrioritizedFields(SemanticPrioritizedFields prioritizedFields) { + this.prioritizedFields = prioritizedFields; + return this; + } + + /** + * Get the rankingOrder property: Specifies the score type to be used for the sort order of the search results. + * + * @return the rankingOrder value. + */ + @Generated + public RankingOrder getRankingOrder() { + return this.rankingOrder; + } + + /** + * Set the rankingOrder property: Specifies the score type to be used for the sort order of the search results. + * + * @param rankingOrder the rankingOrder value to set. + * @return the SemanticConfiguration object itself. + */ + @Generated + public SemanticConfiguration setRankingOrder(RankingOrder rankingOrder) { + this.rankingOrder = rankingOrder; + return this; + } + + /** + * Get the flightingOptIn property: Determines which semantic or query rewrite models to use during model + * flighting/upgrades. + * + * @return the flightingOptIn value. + */ + @Generated + public Boolean isFlightingOptIn() { + return this.flightingOptIn; + } + + /** + * Set the flightingOptIn property: Determines which semantic or query rewrite models to use during model + * flighting/upgrades. + * + * @param flightingOptIn the flightingOptIn value to set. + * @return the SemanticConfiguration object itself. + */ + @Generated + public SemanticConfiguration setFlightingOptIn(Boolean flightingOptIn) { + this.flightingOptIn = flightingOptIn; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("prioritizedFields", this.prioritizedFields); + jsonWriter.writeStringField("rankingOrder", this.rankingOrder == null ? null : this.rankingOrder.toString()); + jsonWriter.writeBooleanField("flightingOptIn", this.flightingOptIn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SemanticConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SemanticConfiguration 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 SemanticConfiguration. + */ + @Generated + public static SemanticConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SemanticConfiguration deserializedSemanticConfiguration = new SemanticConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSemanticConfiguration.name = reader.getString(); + } else if ("prioritizedFields".equals(fieldName)) { + deserializedSemanticConfiguration.prioritizedFields = SemanticPrioritizedFields.fromJson(reader); + } else if ("rankingOrder".equals(fieldName)) { + deserializedSemanticConfiguration.rankingOrder = RankingOrder.fromString(reader.getString()); + } else if ("flightingOptIn".equals(fieldName)) { + deserializedSemanticConfiguration.flightingOptIn = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedSemanticConfiguration; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticDebugInfo.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticDebugInfo.java new file mode 100644 index 000000000000..177ea7c01e2b --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticDebugInfo.java @@ -0,0 +1,142 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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 + */ + @Generated + private QueryResultDocumentSemanticField titleField; + + /* + * The content fields that were sent to the semantic enrichment process, as well as how they were used + */ + @Generated + private List contentFields; + + /* + * The keyword fields that were sent to the semantic enrichment process, as well as how they were used + */ + @Generated + private List keywordFields; + + /* + * The raw concatenated strings that were sent to the semantic enrichment process. + */ + @Generated + private QueryResultDocumentRerankerInput rerankerInput; + + /** + * Creates an instance of SemanticDebugInfo class. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + public QueryResultDocumentRerankerInput getRerankerInput() { + return this.rerankerInput; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + 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/search/src/main/java/com/azure/search/models/SemanticErrorMode.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticErrorMode.java new file mode 100644 index 000000000000..4f2d50f4a63e --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticErrorMode.java @@ -0,0 +1,60 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Allows the user to choose whether a semantic call should fail completely, or to return partial results. + */ +public final class SemanticErrorMode extends ExpandableStringEnum { + /** + * If the semantic processing fails, partial results still return. The definition of partial results depends on what + * semantic step failed and what was the reason for failure. + */ + @Generated + public static final SemanticErrorMode PARTIAL = fromString("partial"); + + /** + * If there is an exception during the semantic processing step, the query will fail and return the appropriate HTTP + * code depending on the error. + */ + @Generated + public static final SemanticErrorMode FAIL = fromString("fail"); + + /** + * Creates a new instance of SemanticErrorMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public SemanticErrorMode() { + } + + /** + * Creates or finds a SemanticErrorMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding SemanticErrorMode. + */ + @Generated + public static SemanticErrorMode fromString(String name) { + return fromString(name, SemanticErrorMode.class); + } + + /** + * Gets known SemanticErrorMode values. + * + * @return known SemanticErrorMode values. + */ + @Generated + public static Collection values() { + return values(SemanticErrorMode.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticErrorReason.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticErrorReason.java new file mode 100644 index 000000000000..f3dac3b2c699 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticErrorReason.java @@ -0,0 +1,65 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Reason that a partial response was returned for a semantic ranking request. + */ +public final class SemanticErrorReason extends ExpandableStringEnum { + /** + * If `semanticMaxWaitInMilliseconds` was set and the semantic processing duration exceeded that value. Only the + * base results were returned. + */ + @Generated + public static final SemanticErrorReason MAX_WAIT_EXCEEDED = fromString("maxWaitExceeded"); + + /** + * The request was throttled. Only the base results were returned. + */ + @Generated + public static final SemanticErrorReason CAPACITY_OVERLOADED = fromString("capacityOverloaded"); + + /** + * At least one step of the semantic process failed. + */ + @Generated + public static final SemanticErrorReason TRANSIENT = fromString("transient"); + + /** + * Creates a new instance of SemanticErrorReason value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public SemanticErrorReason() { + } + + /** + * Creates or finds a SemanticErrorReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding SemanticErrorReason. + */ + @Generated + public static SemanticErrorReason fromString(String name) { + return fromString(name, SemanticErrorReason.class); + } + + /** + * Gets known SemanticErrorReason values. + * + * @return known SemanticErrorReason values. + */ + @Generated + public static Collection values() { + return values(SemanticErrorReason.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticField.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticField.java new file mode 100644 index 000000000000..2b1a200150ac --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticField.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 field that is used as part of the semantic configuration. + */ +@Fluent +public final class SemanticField implements JsonSerializable { + /* + * The fieldName property. + */ + @Generated + private String fieldName; + + /** + * Creates an instance of SemanticField class. + */ + @Generated + public SemanticField() { + } + + /** + * Get the fieldName property: The fieldName property. + * + * @return the fieldName value. + */ + @Generated + public String getFieldName() { + return this.fieldName; + } + + /** + * Set the fieldName property: The fieldName property. + * + * @param fieldName the fieldName value to set. + * @return the SemanticField object itself. + */ + @Generated + public SemanticField setFieldName(String fieldName) { + this.fieldName = fieldName; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("fieldName", this.fieldName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SemanticField from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SemanticField 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 SemanticField. + */ + @Generated + public static SemanticField fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SemanticField deserializedSemanticField = new SemanticField(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String jsonFieldName = reader.getFieldName(); + reader.nextToken(); + + if ("fieldName".equals(jsonFieldName)) { + deserializedSemanticField.fieldName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSemanticField; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticFieldState.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticFieldState.java new file mode 100644 index 000000000000..6584ebadd6be --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticFieldState.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.models; + +import com.azure.core.annotation.Generated; +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. + */ + @Generated + public static final SemanticFieldState USED = fromString("used"); + + /** + * The field was not used for semantic enrichment. + */ + @Generated + public static final SemanticFieldState UNUSED = fromString("unused"); + + /** + * The field was partially used for semantic enrichment. + */ + @Generated + public static final SemanticFieldState PARTIAL = fromString("partial"); + + /** + * Creates a new instance of SemanticFieldState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public SemanticFieldState() { + } + + /** + * Creates or finds a SemanticFieldState from its string representation. + * + * @param name a name to look for. + * @return the corresponding SemanticFieldState. + */ + @Generated + public static SemanticFieldState fromString(String name) { + return fromString(name, SemanticFieldState.class); + } + + /** + * Gets known SemanticFieldState values. + * + * @return known SemanticFieldState values. + */ + @Generated + public static Collection values() { + return values(SemanticFieldState.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticPrioritizedFields.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticPrioritizedFields.java new file mode 100644 index 000000000000..b3d2d23bea9e --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticPrioritizedFields.java @@ -0,0 +1,179 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Describes the title, content, and keywords fields to be used for semantic ranking, captions, highlights, and answers. + */ +@Fluent +public final class SemanticPrioritizedFields implements JsonSerializable { + /* + * Defines the title field to be used for semantic ranking, captions, highlights, and answers. If you don't have a + * title field in your index, leave this blank. + */ + @Generated + private SemanticField titleField; + + /* + * Defines the content fields to be used for semantic ranking, captions, highlights, and answers. For the best + * result, the selected fields should contain text in natural language form. The order of the fields in the array + * represents their priority. Fields with lower priority may get truncated if the content is long. + */ + @Generated + private List contentFields; + + /* + * Defines the keyword fields to be used for semantic ranking, captions, highlights, and answers. For the best + * result, the selected fields should contain a list of keywords. The order of the fields in the array represents + * their priority. Fields with lower priority may get truncated if the content is long. + */ + @Generated + private List keywordsFields; + + /** + * Creates an instance of SemanticPrioritizedFields class. + */ + @Generated + public SemanticPrioritizedFields() { + } + + /** + * Get the titleField property: Defines the title field to be used for semantic ranking, captions, highlights, and + * answers. If you don't have a title field in your index, leave this blank. + * + * @return the titleField value. + */ + @Generated + public SemanticField getTitleField() { + return this.titleField; + } + + /** + * Set the titleField property: Defines the title field to be used for semantic ranking, captions, highlights, and + * answers. If you don't have a title field in your index, leave this blank. + * + * @param titleField the titleField value to set. + * @return the SemanticPrioritizedFields object itself. + */ + @Generated + public SemanticPrioritizedFields setTitleField(SemanticField titleField) { + this.titleField = titleField; + return this; + } + + /** + * Get the contentFields property: Defines the content fields to be used for semantic ranking, captions, highlights, + * and answers. For the best result, the selected fields should contain text in natural language form. The order of + * the fields in the array represents their priority. Fields with lower priority may get truncated if the content is + * long. + * + * @return the contentFields value. + */ + @Generated + public List getContentFields() { + return this.contentFields; + } + + /** + * Set the contentFields property: Defines the content fields to be used for semantic ranking, captions, highlights, + * and answers. For the best result, the selected fields should contain text in natural language form. The order of + * the fields in the array represents their priority. Fields with lower priority may get truncated if the content is + * long. + * + * @param contentFields the contentFields value to set. + * @return the SemanticPrioritizedFields object itself. + */ + @Generated + public SemanticPrioritizedFields setContentFields(List contentFields) { + this.contentFields = contentFields; + return this; + } + + /** + * Get the keywordsFields property: Defines the keyword fields to be used for semantic ranking, captions, + * highlights, and answers. For the best result, the selected fields should contain a list of keywords. The order of + * the fields in the array represents their priority. Fields with lower priority may get truncated if the content is + * long. + * + * @return the keywordsFields value. + */ + @Generated + public List getKeywordsFields() { + return this.keywordsFields; + } + + /** + * Set the keywordsFields property: Defines the keyword fields to be used for semantic ranking, captions, + * highlights, and answers. For the best result, the selected fields should contain a list of keywords. The order of + * the fields in the array represents their priority. Fields with lower priority may get truncated if the content is + * long. + * + * @param keywordsFields the keywordsFields value to set. + * @return the SemanticPrioritizedFields object itself. + */ + @Generated + public SemanticPrioritizedFields setKeywordsFields(List keywordsFields) { + this.keywordsFields = keywordsFields; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("titleField", this.titleField); + jsonWriter.writeArrayField("prioritizedContentFields", this.contentFields, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("prioritizedKeywordsFields", this.keywordsFields, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SemanticPrioritizedFields from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SemanticPrioritizedFields 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 SemanticPrioritizedFields. + */ + @Generated + public static SemanticPrioritizedFields fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SemanticPrioritizedFields deserializedSemanticPrioritizedFields = new SemanticPrioritizedFields(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("titleField".equals(fieldName)) { + deserializedSemanticPrioritizedFields.titleField = SemanticField.fromJson(reader); + } else if ("prioritizedContentFields".equals(fieldName)) { + List contentFields = reader.readArray(reader1 -> SemanticField.fromJson(reader1)); + deserializedSemanticPrioritizedFields.contentFields = contentFields; + } else if ("prioritizedKeywordsFields".equals(fieldName)) { + List keywordsFields = reader.readArray(reader1 -> SemanticField.fromJson(reader1)); + deserializedSemanticPrioritizedFields.keywordsFields = keywordsFields; + } else { + reader.skipChildren(); + } + } + + return deserializedSemanticPrioritizedFields; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticQueryRewritesResultType.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticQueryRewritesResultType.java new file mode 100644 index 000000000000..d83d48bd56db --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticQueryRewritesResultType.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of query rewrite that was used for this request. + */ +public final class SemanticQueryRewritesResultType extends ExpandableStringEnum { + /** + * Query rewrites were not successfully generated for this request. Only the original query was used to retrieve the + * results. + */ + @Generated + public static final SemanticQueryRewritesResultType ORIGINAL_QUERY_ONLY = fromString("originalQueryOnly"); + + /** + * Creates a new instance of SemanticQueryRewritesResultType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public SemanticQueryRewritesResultType() { + } + + /** + * Creates or finds a SemanticQueryRewritesResultType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SemanticQueryRewritesResultType. + */ + @Generated + public static SemanticQueryRewritesResultType fromString(String name) { + return fromString(name, SemanticQueryRewritesResultType.class); + } + + /** + * Gets known SemanticQueryRewritesResultType values. + * + * @return known SemanticQueryRewritesResultType values. + */ + @Generated + public static Collection values() { + return values(SemanticQueryRewritesResultType.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticSearch.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticSearch.java new file mode 100644 index 000000000000..dcc547d3ce09 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticSearch.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Defines parameters for a search index that influence semantic capabilities. + */ +@Fluent +public final class SemanticSearch implements JsonSerializable { + /* + * Allows you to set the name of a default semantic configuration in your index, making it optional to pass it on as + * a query parameter every time. + */ + @Generated + private String defaultConfigurationName; + + /* + * The semantic configurations for the index. + */ + @Generated + private List configurations; + + /** + * Creates an instance of SemanticSearch class. + */ + @Generated + public SemanticSearch() { + } + + /** + * Get the defaultConfigurationName property: Allows you to set the name of a default semantic configuration in your + * index, making it optional to pass it on as a query parameter every time. + * + * @return the defaultConfigurationName value. + */ + @Generated + public String getDefaultConfigurationName() { + return this.defaultConfigurationName; + } + + /** + * Set the defaultConfigurationName property: Allows you to set the name of a default semantic configuration in your + * index, making it optional to pass it on as a query parameter every time. + * + * @param defaultConfigurationName the defaultConfigurationName value to set. + * @return the SemanticSearch object itself. + */ + @Generated + public SemanticSearch setDefaultConfigurationName(String defaultConfigurationName) { + this.defaultConfigurationName = defaultConfigurationName; + return this; + } + + /** + * Get the configurations property: The semantic configurations for the index. + * + * @return the configurations value. + */ + @Generated + public List getConfigurations() { + return this.configurations; + } + + /** + * Set the configurations property: The semantic configurations for the index. + * + * @param configurations the configurations value to set. + * @return the SemanticSearch object itself. + */ + @Generated + public SemanticSearch setConfigurations(List configurations) { + this.configurations = configurations; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("defaultConfiguration", this.defaultConfigurationName); + jsonWriter.writeArrayField("configurations", this.configurations, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SemanticSearch from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SemanticSearch 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 SemanticSearch. + */ + @Generated + public static SemanticSearch fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SemanticSearch deserializedSemanticSearch = new SemanticSearch(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("defaultConfiguration".equals(fieldName)) { + deserializedSemanticSearch.defaultConfigurationName = reader.getString(); + } else if ("configurations".equals(fieldName)) { + List configurations + = reader.readArray(reader1 -> SemanticConfiguration.fromJson(reader1)); + deserializedSemanticSearch.configurations = configurations; + } else { + reader.skipChildren(); + } + } + + return deserializedSemanticSearch; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticSearchResultsType.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticSearchResultsType.java new file mode 100644 index 000000000000..ddfc221a337f --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SemanticSearchResultsType.java @@ -0,0 +1,59 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of partial response that was returned for a semantic ranking request. + */ +public final class SemanticSearchResultsType extends ExpandableStringEnum { + /** + * Results without any semantic enrichment or reranking. + */ + @Generated + public static final SemanticSearchResultsType BASE_RESULTS = fromString("baseResults"); + + /** + * Results have been reranked with the reranker model and will include semantic captions. They will not include any + * answers, answers highlights or caption highlights. + */ + @Generated + public static final SemanticSearchResultsType RERANKED_RESULTS = fromString("rerankedResults"); + + /** + * Creates a new instance of SemanticSearchResultsType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public SemanticSearchResultsType() { + } + + /** + * Creates or finds a SemanticSearchResultsType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SemanticSearchResultsType. + */ + @Generated + public static SemanticSearchResultsType fromString(String name) { + return fromString(name, SemanticSearchResultsType.class); + } + + /** + * Gets known SemanticSearchResultsType values. + * + * @return known SemanticSearchResultsType values. + */ + @Generated + public static Collection values() { + return values(SemanticSearchResultsType.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SentimentSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SentimentSkill.java new file mode 100644 index 000000000000..241fe70092f6 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SentimentSkill.java @@ -0,0 +1,185 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * This skill is deprecated. Use the V3.SentimentSkill instead. + */ +@Fluent +public final class SentimentSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Text.SentimentSkill"; + + /* + * A value indicating which language code to use. Default is `en`. + */ + @Generated + private SentimentSkillLanguage defaultLanguageCode; + + /** + * Creates an instance of SentimentSkill class. + */ + @Generated + public SentimentSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @return the defaultLanguageCode value. + */ + @Generated + public SentimentSkillLanguage getDefaultLanguageCode() { + return this.defaultLanguageCode; + } + + /** + * Set the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @param defaultLanguageCode the defaultLanguageCode value to set. + * @return the SentimentSkill object itself. + */ + @Generated + public SentimentSkill setDefaultLanguageCode(SentimentSkillLanguage defaultLanguageCode) { + this.defaultLanguageCode = defaultLanguageCode; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SentimentSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SentimentSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SentimentSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SentimentSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SentimentSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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("defaultLanguageCode", + this.defaultLanguageCode == null ? null : this.defaultLanguageCode.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SentimentSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SentimentSkill 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 SentimentSkill. + */ + @Generated + public static SentimentSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SentimentSkill deserializedSentimentSkill = new SentimentSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedSentimentSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedSentimentSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedSentimentSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedSentimentSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedSentimentSkill.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedSentimentSkill.odataType = reader.getString(); + } else if ("defaultLanguageCode".equals(fieldName)) { + deserializedSentimentSkill.defaultLanguageCode + = SentimentSkillLanguage.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSentimentSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SentimentSkillLanguage.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SentimentSkillLanguage.java new file mode 100644 index 000000000000..f51ef79fcf35 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SentimentSkillLanguage.java @@ -0,0 +1,136 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Deprecated. The language codes supported for input text by SentimentSkill. + */ +public final class SentimentSkillLanguage extends ExpandableStringEnum { + /** + * Danish. + */ + @Generated + public static final SentimentSkillLanguage DA = fromString("da"); + + /** + * Dutch. + */ + @Generated + public static final SentimentSkillLanguage NL = fromString("nl"); + + /** + * English. + */ + @Generated + public static final SentimentSkillLanguage EN = fromString("en"); + + /** + * Finnish. + */ + @Generated + public static final SentimentSkillLanguage FI = fromString("fi"); + + /** + * French. + */ + @Generated + public static final SentimentSkillLanguage FR = fromString("fr"); + + /** + * German. + */ + @Generated + public static final SentimentSkillLanguage DE = fromString("de"); + + /** + * Greek. + */ + @Generated + public static final SentimentSkillLanguage EL = fromString("el"); + + /** + * Italian. + */ + @Generated + public static final SentimentSkillLanguage IT = fromString("it"); + + /** + * Norwegian (Bokmaal). + */ + @Generated + public static final SentimentSkillLanguage NO = fromString("no"); + + /** + * Polish. + */ + @Generated + public static final SentimentSkillLanguage PL = fromString("pl"); + + /** + * Portuguese (Portugal). + */ + @Generated + public static final SentimentSkillLanguage PT_PT = fromString("pt-PT"); + + /** + * Russian. + */ + @Generated + public static final SentimentSkillLanguage RU = fromString("ru"); + + /** + * Spanish. + */ + @Generated + public static final SentimentSkillLanguage ES = fromString("es"); + + /** + * Swedish. + */ + @Generated + public static final SentimentSkillLanguage SV = fromString("sv"); + + /** + * Turkish. + */ + @Generated + public static final SentimentSkillLanguage TR = fromString("tr"); + + /** + * Creates a new instance of SentimentSkillLanguage value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public SentimentSkillLanguage() { + } + + /** + * Creates or finds a SentimentSkillLanguage from its string representation. + * + * @param name a name to look for. + * @return the corresponding SentimentSkillLanguage. + */ + @Generated + public static SentimentSkillLanguage fromString(String name) { + return fromString(name, SentimentSkillLanguage.class); + } + + /** + * Gets known SentimentSkillLanguage values. + * + * @return known SentimentSkillLanguage values. + */ + @Generated + public static Collection values() { + return values(SentimentSkillLanguage.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SentimentSkillV3.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SentimentSkillV3.java new file mode 100644 index 000000000000..6052ce4e5d26 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SentimentSkillV3.java @@ -0,0 +1,257 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Using the Text Analytics API, evaluates unstructured text and for each record, provides sentiment labels (such as + * "negative", "neutral" and "positive") based on the highest confidence score found by the service at a sentence and + * document-level. + */ +@Fluent +public final class SentimentSkillV3 extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Text.V3.SentimentSkill"; + + /* + * A value indicating which language code to use. Default is `en`. + */ + @Generated + private String defaultLanguageCode; + + /* + * If set to true, the skill output will include information from Text Analytics for opinion mining, namely targets + * (nouns or verbs) and their associated assessment (adjective) in the text. Default is false. + */ + @Generated + private Boolean includeOpinionMining; + + /* + * The version of the model to use when calling the Text Analytics service. It will default to the latest available + * when not specified. We recommend you do not specify this value unless absolutely necessary. + */ + @Generated + private String modelVersion; + + /** + * Creates an instance of SentimentSkillV3 class. + */ + @Generated + public SentimentSkillV3() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @return the defaultLanguageCode value. + */ + @Generated + public String getDefaultLanguageCode() { + return this.defaultLanguageCode; + } + + /** + * Set the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @param defaultLanguageCode the defaultLanguageCode value to set. + * @return the SentimentSkillV3 object itself. + */ + @Generated + public SentimentSkillV3 setDefaultLanguageCode(String defaultLanguageCode) { + this.defaultLanguageCode = defaultLanguageCode; + return this; + } + + /** + * Get the includeOpinionMining property: If set to true, the skill output will include information from Text + * Analytics for opinion mining, namely targets (nouns or verbs) and their associated assessment (adjective) in the + * text. Default is false. + * + * @return the includeOpinionMining value. + */ + @Generated + public Boolean isIncludeOpinionMining() { + return this.includeOpinionMining; + } + + /** + * Set the includeOpinionMining property: If set to true, the skill output will include information from Text + * Analytics for opinion mining, namely targets (nouns or verbs) and their associated assessment (adjective) in the + * text. Default is false. + * + * @param includeOpinionMining the includeOpinionMining value to set. + * @return the SentimentSkillV3 object itself. + */ + @Generated + public SentimentSkillV3 setIncludeOpinionMining(Boolean includeOpinionMining) { + this.includeOpinionMining = includeOpinionMining; + return this; + } + + /** + * Get the modelVersion property: The version of the model to use when calling the Text Analytics service. It will + * default to the latest available when not specified. We recommend you do not specify this value unless absolutely + * necessary. + * + * @return the modelVersion value. + */ + @Generated + public String getModelVersion() { + return this.modelVersion; + } + + /** + * Set the modelVersion property: The version of the model to use when calling the Text Analytics service. It will + * default to the latest available when not specified. We recommend you do not specify this value unless absolutely + * necessary. + * + * @param modelVersion the modelVersion value to set. + * @return the SentimentSkillV3 object itself. + */ + @Generated + public SentimentSkillV3 setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SentimentSkillV3 setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SentimentSkillV3 setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SentimentSkillV3 setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SentimentSkillV3 setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SentimentSkillV3 setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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("defaultLanguageCode", this.defaultLanguageCode); + jsonWriter.writeBooleanField("includeOpinionMining", this.includeOpinionMining); + jsonWriter.writeStringField("modelVersion", this.modelVersion); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SentimentSkillV3 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SentimentSkillV3 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 SentimentSkillV3. + */ + @Generated + public static SentimentSkillV3 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SentimentSkillV3 deserializedSentimentSkillV3 = new SentimentSkillV3(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedSentimentSkillV3.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedSentimentSkillV3.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedSentimentSkillV3.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedSentimentSkillV3.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedSentimentSkillV3.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedSentimentSkillV3.odataType = reader.getString(); + } else if ("defaultLanguageCode".equals(fieldName)) { + deserializedSentimentSkillV3.defaultLanguageCode = reader.getString(); + } else if ("includeOpinionMining".equals(fieldName)) { + deserializedSentimentSkillV3.includeOpinionMining = reader.getNullable(JsonReader::getBoolean); + } else if ("modelVersion".equals(fieldName)) { + deserializedSentimentSkillV3.modelVersion = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSentimentSkillV3; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ServiceCounters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ServiceCounters.java new file mode 100644 index 000000000000..a5f22ca0c8d5 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ServiceCounters.java @@ -0,0 +1,344 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents service-level resource counters and quotas. + */ +@Fluent +public final class ServiceCounters implements JsonSerializable { + /* + * Total number of aliases. + */ + @Generated + private ResourceCounter aliasCounter; + + /* + * Total number of documents across all indexes in the service. + */ + @Generated + private ResourceCounter documentCounter; + + /* + * Total number of indexes. + */ + @Generated + private ResourceCounter indexCounter; + + /* + * Total number of indexers. + */ + @Generated + private ResourceCounter indexerCounter; + + /* + * Total number of data sources. + */ + @Generated + private ResourceCounter dataSourceCounter; + + /* + * Total size of used storage in bytes. + */ + @Generated + private ResourceCounter storageSizeCounter; + + /* + * Total number of synonym maps. + */ + @Generated + private ResourceCounter synonymMapCounter; + + /* + * Total number of skillsets. + */ + @Generated + private ResourceCounter skillsetCounter; + + /* + * Total memory consumption of all vector indexes within the service, in bytes. + */ + @Generated + private ResourceCounter vectorIndexSizeCounter; + + /** + * Creates an instance of ServiceCounters class. + */ + @Generated + public ServiceCounters() { + } + + /** + * Get the aliasCounter property: Total number of aliases. + * + * @return the aliasCounter value. + */ + @Generated + public ResourceCounter getAliasCounter() { + return this.aliasCounter; + } + + /** + * Set the aliasCounter property: Total number of aliases. + * + * @param aliasCounter the aliasCounter value to set. + * @return the ServiceCounters object itself. + */ + @Generated + public ServiceCounters setAliasCounter(ResourceCounter aliasCounter) { + this.aliasCounter = aliasCounter; + return this; + } + + /** + * Get the documentCounter property: Total number of documents across all indexes in the service. + * + * @return the documentCounter value. + */ + @Generated + public ResourceCounter getDocumentCounter() { + return this.documentCounter; + } + + /** + * Set the documentCounter property: Total number of documents across all indexes in the service. + * + * @param documentCounter the documentCounter value to set. + * @return the ServiceCounters object itself. + */ + @Generated + public ServiceCounters setDocumentCounter(ResourceCounter documentCounter) { + this.documentCounter = documentCounter; + return this; + } + + /** + * Get the indexCounter property: Total number of indexes. + * + * @return the indexCounter value. + */ + @Generated + public ResourceCounter getIndexCounter() { + return this.indexCounter; + } + + /** + * Set the indexCounter property: Total number of indexes. + * + * @param indexCounter the indexCounter value to set. + * @return the ServiceCounters object itself. + */ + @Generated + public ServiceCounters setIndexCounter(ResourceCounter indexCounter) { + this.indexCounter = indexCounter; + return this; + } + + /** + * Get the indexerCounter property: Total number of indexers. + * + * @return the indexerCounter value. + */ + @Generated + public ResourceCounter getIndexerCounter() { + return this.indexerCounter; + } + + /** + * Set the indexerCounter property: Total number of indexers. + * + * @param indexerCounter the indexerCounter value to set. + * @return the ServiceCounters object itself. + */ + @Generated + public ServiceCounters setIndexerCounter(ResourceCounter indexerCounter) { + this.indexerCounter = indexerCounter; + return this; + } + + /** + * Get the dataSourceCounter property: Total number of data sources. + * + * @return the dataSourceCounter value. + */ + @Generated + public ResourceCounter getDataSourceCounter() { + return this.dataSourceCounter; + } + + /** + * Set the dataSourceCounter property: Total number of data sources. + * + * @param dataSourceCounter the dataSourceCounter value to set. + * @return the ServiceCounters object itself. + */ + @Generated + public ServiceCounters setDataSourceCounter(ResourceCounter dataSourceCounter) { + this.dataSourceCounter = dataSourceCounter; + return this; + } + + /** + * Get the storageSizeCounter property: Total size of used storage in bytes. + * + * @return the storageSizeCounter value. + */ + @Generated + public ResourceCounter getStorageSizeCounter() { + return this.storageSizeCounter; + } + + /** + * Set the storageSizeCounter property: Total size of used storage in bytes. + * + * @param storageSizeCounter the storageSizeCounter value to set. + * @return the ServiceCounters object itself. + */ + @Generated + public ServiceCounters setStorageSizeCounter(ResourceCounter storageSizeCounter) { + this.storageSizeCounter = storageSizeCounter; + return this; + } + + /** + * Get the synonymMapCounter property: Total number of synonym maps. + * + * @return the synonymMapCounter value. + */ + @Generated + public ResourceCounter getSynonymMapCounter() { + return this.synonymMapCounter; + } + + /** + * Set the synonymMapCounter property: Total number of synonym maps. + * + * @param synonymMapCounter the synonymMapCounter value to set. + * @return the ServiceCounters object itself. + */ + @Generated + public ServiceCounters setSynonymMapCounter(ResourceCounter synonymMapCounter) { + this.synonymMapCounter = synonymMapCounter; + return this; + } + + /** + * Get the skillsetCounter property: Total number of skillsets. + * + * @return the skillsetCounter value. + */ + @Generated + public ResourceCounter getSkillsetCounter() { + return this.skillsetCounter; + } + + /** + * Set the skillsetCounter property: Total number of skillsets. + * + * @param skillsetCounter the skillsetCounter value to set. + * @return the ServiceCounters object itself. + */ + @Generated + public ServiceCounters setSkillsetCounter(ResourceCounter skillsetCounter) { + this.skillsetCounter = skillsetCounter; + return this; + } + + /** + * Get the vectorIndexSizeCounter property: Total memory consumption of all vector indexes within the service, in + * bytes. + * + * @return the vectorIndexSizeCounter value. + */ + @Generated + public ResourceCounter getVectorIndexSizeCounter() { + return this.vectorIndexSizeCounter; + } + + /** + * Set the vectorIndexSizeCounter property: Total memory consumption of all vector indexes within the service, in + * bytes. + * + * @param vectorIndexSizeCounter the vectorIndexSizeCounter value to set. + * @return the ServiceCounters object itself. + */ + @Generated + public ServiceCounters setVectorIndexSizeCounter(ResourceCounter vectorIndexSizeCounter) { + this.vectorIndexSizeCounter = vectorIndexSizeCounter; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("aliasesCount", this.aliasCounter); + jsonWriter.writeJsonField("documentCount", this.documentCounter); + jsonWriter.writeJsonField("indexesCount", this.indexCounter); + jsonWriter.writeJsonField("indexersCount", this.indexerCounter); + jsonWriter.writeJsonField("dataSourcesCount", this.dataSourceCounter); + jsonWriter.writeJsonField("storageSize", this.storageSizeCounter); + jsonWriter.writeJsonField("synonymMaps", this.synonymMapCounter); + jsonWriter.writeJsonField("skillsetCount", this.skillsetCounter); + jsonWriter.writeJsonField("vectorIndexSize", this.vectorIndexSizeCounter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServiceCounters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServiceCounters 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 ServiceCounters. + */ + @Generated + public static ServiceCounters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServiceCounters deserializedServiceCounters = new ServiceCounters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("aliasesCount".equals(fieldName)) { + deserializedServiceCounters.aliasCounter = ResourceCounter.fromJson(reader); + } else if ("documentCount".equals(fieldName)) { + deserializedServiceCounters.documentCounter = ResourceCounter.fromJson(reader); + } else if ("indexesCount".equals(fieldName)) { + deserializedServiceCounters.indexCounter = ResourceCounter.fromJson(reader); + } else if ("indexersCount".equals(fieldName)) { + deserializedServiceCounters.indexerCounter = ResourceCounter.fromJson(reader); + } else if ("dataSourcesCount".equals(fieldName)) { + deserializedServiceCounters.dataSourceCounter = ResourceCounter.fromJson(reader); + } else if ("storageSize".equals(fieldName)) { + deserializedServiceCounters.storageSizeCounter = ResourceCounter.fromJson(reader); + } else if ("synonymMaps".equals(fieldName)) { + deserializedServiceCounters.synonymMapCounter = ResourceCounter.fromJson(reader); + } else if ("skillsetCount".equals(fieldName)) { + deserializedServiceCounters.skillsetCounter = ResourceCounter.fromJson(reader); + } else if ("vectorIndexSize".equals(fieldName)) { + deserializedServiceCounters.vectorIndexSizeCounter = ResourceCounter.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedServiceCounters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ServiceIndexersRuntime.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ServiceIndexersRuntime.java new file mode 100644 index 000000000000..5ac63c030c1b --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ServiceIndexersRuntime.java @@ -0,0 +1,200 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Represents service level indexers runtime information. + */ +@Fluent +public final class ServiceIndexersRuntime implements JsonSerializable { + /* + * Cumulative runtime of all indexers in the service from the beginningTime to endingTime, in seconds. + */ + @Generated + private long usedSeconds; + + /* + * Cumulative runtime remaining for all indexers in the service from the beginningTime to endingTime, in seconds. + */ + @Generated + private Long remainingSeconds; + + /* + * Beginning UTC time of the 24-hour period considered for indexer runtime usage (inclusive). + */ + @Generated + private OffsetDateTime beginningTime; + + /* + * End UTC time of the 24-hour period considered for indexer runtime usage (inclusive). + */ + @Generated + private OffsetDateTime endingTime; + + /** + * Creates an instance of ServiceIndexersRuntime class. + */ + @Generated + public ServiceIndexersRuntime() { + } + + /** + * Get the usedSeconds property: Cumulative runtime of all indexers in the service from the beginningTime to + * endingTime, in seconds. + * + * @return the usedSeconds value. + */ + @Generated + public long getUsedSeconds() { + return this.usedSeconds; + } + + /** + * Set the usedSeconds property: Cumulative runtime of all indexers in the service from the beginningTime to + * endingTime, in seconds. + * + * @param usedSeconds the usedSeconds value to set. + * @return the ServiceIndexersRuntime object itself. + */ + @Generated + public ServiceIndexersRuntime setUsedSeconds(long usedSeconds) { + this.usedSeconds = usedSeconds; + return this; + } + + /** + * Get the remainingSeconds property: Cumulative runtime remaining for all indexers in the service from the + * beginningTime to endingTime, in seconds. + * + * @return the remainingSeconds value. + */ + @Generated + public Long getRemainingSeconds() { + return this.remainingSeconds; + } + + /** + * Set the remainingSeconds property: Cumulative runtime remaining for all indexers in the service from the + * beginningTime to endingTime, in seconds. + * + * @param remainingSeconds the remainingSeconds value to set. + * @return the ServiceIndexersRuntime object itself. + */ + @Generated + public ServiceIndexersRuntime setRemainingSeconds(Long remainingSeconds) { + this.remainingSeconds = remainingSeconds; + return this; + } + + /** + * Get the beginningTime property: Beginning UTC time of the 24-hour period considered for indexer runtime usage + * (inclusive). + * + * @return the beginningTime value. + */ + @Generated + public OffsetDateTime getBeginningTime() { + return this.beginningTime; + } + + /** + * Set the beginningTime property: Beginning UTC time of the 24-hour period considered for indexer runtime usage + * (inclusive). + * + * @param beginningTime the beginningTime value to set. + * @return the ServiceIndexersRuntime object itself. + */ + @Generated + public ServiceIndexersRuntime setBeginningTime(OffsetDateTime beginningTime) { + this.beginningTime = beginningTime; + return this; + } + + /** + * Get the endingTime property: End UTC time of the 24-hour period considered for indexer runtime usage (inclusive). + * + * @return the endingTime value. + */ + @Generated + public OffsetDateTime getEndingTime() { + return this.endingTime; + } + + /** + * Set the endingTime property: End UTC time of the 24-hour period considered for indexer runtime usage (inclusive). + * + * @param endingTime the endingTime value to set. + * @return the ServiceIndexersRuntime object itself. + */ + @Generated + public ServiceIndexersRuntime setEndingTime(OffsetDateTime endingTime) { + this.endingTime = endingTime; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeLongField("usedSeconds", this.usedSeconds); + jsonWriter.writeStringField("beginningTime", + this.beginningTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.beginningTime)); + jsonWriter.writeStringField("endingTime", + this.endingTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endingTime)); + jsonWriter.writeNumberField("remainingSeconds", this.remainingSeconds); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServiceIndexersRuntime from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServiceIndexersRuntime 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 ServiceIndexersRuntime. + */ + @Generated + public static ServiceIndexersRuntime fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServiceIndexersRuntime deserializedServiceIndexersRuntime = new ServiceIndexersRuntime(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("usedSeconds".equals(fieldName)) { + deserializedServiceIndexersRuntime.usedSeconds = reader.getLong(); + } else if ("beginningTime".equals(fieldName)) { + deserializedServiceIndexersRuntime.beginningTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endingTime".equals(fieldName)) { + deserializedServiceIndexersRuntime.endingTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("remainingSeconds".equals(fieldName)) { + deserializedServiceIndexersRuntime.remainingSeconds = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedServiceIndexersRuntime; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ServiceLimits.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ServiceLimits.java new file mode 100644 index 000000000000..0c56b71d0fc9 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ServiceLimits.java @@ -0,0 +1,262 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents various service level limits. + */ +@Fluent +public final class ServiceLimits implements JsonSerializable { + /* + * The maximum allowed fields per index. + */ + @Generated + private Integer maxFieldsPerIndex; + + /* + * The maximum depth which you can nest sub-fields in an index, including the top-level complex field. For example, + * a/b/c has a nesting depth of 3. + */ + @Generated + private Integer maxFieldNestingDepthPerIndex; + + /* + * The maximum number of fields of type Collection(Edm.ComplexType) allowed in an index. + */ + @Generated + private Integer maxComplexCollectionFieldsPerIndex; + + /* + * The maximum number of objects in complex collections allowed per document. + */ + @Generated + private Integer maxComplexObjectsInCollectionsPerDocument; + + /* + * The maximum amount of storage in bytes allowed per index. + */ + @Generated + private Long maxStoragePerIndexInBytes; + + /* + * The maximum cumulative runtime in seconds allowed for all indexers in the service over the current UTC period. + */ + @Generated + private Long maxCumulativeIndexerRuntimeSeconds; + + /** + * Creates an instance of ServiceLimits class. + */ + @Generated + public ServiceLimits() { + } + + /** + * Get the maxFieldsPerIndex property: The maximum allowed fields per index. + * + * @return the maxFieldsPerIndex value. + */ + @Generated + public Integer getMaxFieldsPerIndex() { + return this.maxFieldsPerIndex; + } + + /** + * Set the maxFieldsPerIndex property: The maximum allowed fields per index. + * + * @param maxFieldsPerIndex the maxFieldsPerIndex value to set. + * @return the ServiceLimits object itself. + */ + @Generated + public ServiceLimits setMaxFieldsPerIndex(Integer maxFieldsPerIndex) { + this.maxFieldsPerIndex = maxFieldsPerIndex; + return this; + } + + /** + * Get the maxFieldNestingDepthPerIndex property: The maximum depth which you can nest sub-fields in an index, + * including the top-level complex field. For example, a/b/c has a nesting depth of 3. + * + * @return the maxFieldNestingDepthPerIndex value. + */ + @Generated + public Integer getMaxFieldNestingDepthPerIndex() { + return this.maxFieldNestingDepthPerIndex; + } + + /** + * Set the maxFieldNestingDepthPerIndex property: The maximum depth which you can nest sub-fields in an index, + * including the top-level complex field. For example, a/b/c has a nesting depth of 3. + * + * @param maxFieldNestingDepthPerIndex the maxFieldNestingDepthPerIndex value to set. + * @return the ServiceLimits object itself. + */ + @Generated + public ServiceLimits setMaxFieldNestingDepthPerIndex(Integer maxFieldNestingDepthPerIndex) { + this.maxFieldNestingDepthPerIndex = maxFieldNestingDepthPerIndex; + return this; + } + + /** + * Get the maxComplexCollectionFieldsPerIndex property: The maximum number of fields of type + * Collection(Edm.ComplexType) allowed in an index. + * + * @return the maxComplexCollectionFieldsPerIndex value. + */ + @Generated + public Integer getMaxComplexCollectionFieldsPerIndex() { + return this.maxComplexCollectionFieldsPerIndex; + } + + /** + * Set the maxComplexCollectionFieldsPerIndex property: The maximum number of fields of type + * Collection(Edm.ComplexType) allowed in an index. + * + * @param maxComplexCollectionFieldsPerIndex the maxComplexCollectionFieldsPerIndex value to set. + * @return the ServiceLimits object itself. + */ + @Generated + public ServiceLimits setMaxComplexCollectionFieldsPerIndex(Integer maxComplexCollectionFieldsPerIndex) { + this.maxComplexCollectionFieldsPerIndex = maxComplexCollectionFieldsPerIndex; + return this; + } + + /** + * Get the maxComplexObjectsInCollectionsPerDocument property: The maximum number of objects in complex collections + * allowed per document. + * + * @return the maxComplexObjectsInCollectionsPerDocument value. + */ + @Generated + public Integer getMaxComplexObjectsInCollectionsPerDocument() { + return this.maxComplexObjectsInCollectionsPerDocument; + } + + /** + * Set the maxComplexObjectsInCollectionsPerDocument property: The maximum number of objects in complex collections + * allowed per document. + * + * @param maxComplexObjectsInCollectionsPerDocument the maxComplexObjectsInCollectionsPerDocument value to set. + * @return the ServiceLimits object itself. + */ + @Generated + public ServiceLimits + setMaxComplexObjectsInCollectionsPerDocument(Integer maxComplexObjectsInCollectionsPerDocument) { + this.maxComplexObjectsInCollectionsPerDocument = maxComplexObjectsInCollectionsPerDocument; + return this; + } + + /** + * Get the maxStoragePerIndexInBytes property: The maximum amount of storage in bytes allowed per index. + * + * @return the maxStoragePerIndexInBytes value. + */ + @Generated + public Long getMaxStoragePerIndexInBytes() { + return this.maxStoragePerIndexInBytes; + } + + /** + * Set the maxStoragePerIndexInBytes property: The maximum amount of storage in bytes allowed per index. + * + * @param maxStoragePerIndexInBytes the maxStoragePerIndexInBytes value to set. + * @return the ServiceLimits object itself. + */ + @Generated + public ServiceLimits setMaxStoragePerIndexInBytes(Long maxStoragePerIndexInBytes) { + this.maxStoragePerIndexInBytes = maxStoragePerIndexInBytes; + return this; + } + + /** + * Get the maxCumulativeIndexerRuntimeSeconds property: The maximum cumulative runtime in seconds allowed for all + * indexers in the service over the current UTC period. + * + * @return the maxCumulativeIndexerRuntimeSeconds value. + */ + @Generated + public Long getMaxCumulativeIndexerRuntimeSeconds() { + return this.maxCumulativeIndexerRuntimeSeconds; + } + + /** + * Set the maxCumulativeIndexerRuntimeSeconds property: The maximum cumulative runtime in seconds allowed for all + * indexers in the service over the current UTC period. + * + * @param maxCumulativeIndexerRuntimeSeconds the maxCumulativeIndexerRuntimeSeconds value to set. + * @return the ServiceLimits object itself. + */ + @Generated + public ServiceLimits setMaxCumulativeIndexerRuntimeSeconds(Long maxCumulativeIndexerRuntimeSeconds) { + this.maxCumulativeIndexerRuntimeSeconds = maxCumulativeIndexerRuntimeSeconds; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("maxFieldsPerIndex", this.maxFieldsPerIndex); + jsonWriter.writeNumberField("maxFieldNestingDepthPerIndex", this.maxFieldNestingDepthPerIndex); + jsonWriter.writeNumberField("maxComplexCollectionFieldsPerIndex", this.maxComplexCollectionFieldsPerIndex); + jsonWriter.writeNumberField("maxComplexObjectsInCollectionsPerDocument", + this.maxComplexObjectsInCollectionsPerDocument); + jsonWriter.writeNumberField("maxStoragePerIndex", this.maxStoragePerIndexInBytes); + jsonWriter.writeNumberField("maxCumulativeIndexerRuntimeSeconds", this.maxCumulativeIndexerRuntimeSeconds); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServiceLimits from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServiceLimits 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 ServiceLimits. + */ + @Generated + public static ServiceLimits fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServiceLimits deserializedServiceLimits = new ServiceLimits(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("maxFieldsPerIndex".equals(fieldName)) { + deserializedServiceLimits.maxFieldsPerIndex = reader.getNullable(JsonReader::getInt); + } else if ("maxFieldNestingDepthPerIndex".equals(fieldName)) { + deserializedServiceLimits.maxFieldNestingDepthPerIndex = reader.getNullable(JsonReader::getInt); + } else if ("maxComplexCollectionFieldsPerIndex".equals(fieldName)) { + deserializedServiceLimits.maxComplexCollectionFieldsPerIndex + = reader.getNullable(JsonReader::getInt); + } else if ("maxComplexObjectsInCollectionsPerDocument".equals(fieldName)) { + deserializedServiceLimits.maxComplexObjectsInCollectionsPerDocument + = reader.getNullable(JsonReader::getInt); + } else if ("maxStoragePerIndex".equals(fieldName)) { + deserializedServiceLimits.maxStoragePerIndexInBytes = reader.getNullable(JsonReader::getLong); + } else if ("maxCumulativeIndexerRuntimeSeconds".equals(fieldName)) { + deserializedServiceLimits.maxCumulativeIndexerRuntimeSeconds + = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedServiceLimits; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ServiceStatistics.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ServiceStatistics.java new file mode 100644 index 000000000000..746b150b97ab --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ServiceStatistics.java @@ -0,0 +1,157 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Response from a get service statistics request. If successful, it includes service level counters, indexer runtime + * information, and limits. + */ +@Fluent +public final class ServiceStatistics implements JsonSerializable { + /* + * Service level resource counters. + */ + @Generated + private ServiceCounters counters; + + /* + * Service level indexers runtime information. + */ + @Generated + private ServiceIndexersRuntime indexersRuntime; + + /* + * Service level general limits. + */ + @Generated + private ServiceLimits limits; + + /** + * Creates an instance of ServiceStatistics class. + */ + @Generated + public ServiceStatistics() { + } + + /** + * Get the counters property: Service level resource counters. + * + * @return the counters value. + */ + @Generated + public ServiceCounters getCounters() { + return this.counters; + } + + /** + * Set the counters property: Service level resource counters. + * + * @param counters the counters value to set. + * @return the ServiceStatistics object itself. + */ + @Generated + public ServiceStatistics setCounters(ServiceCounters counters) { + this.counters = counters; + return this; + } + + /** + * Get the indexersRuntime property: Service level indexers runtime information. + * + * @return the indexersRuntime value. + */ + @Generated + public ServiceIndexersRuntime getIndexersRuntime() { + return this.indexersRuntime; + } + + /** + * Set the indexersRuntime property: Service level indexers runtime information. + * + * @param indexersRuntime the indexersRuntime value to set. + * @return the ServiceStatistics object itself. + */ + @Generated + public ServiceStatistics setIndexersRuntime(ServiceIndexersRuntime indexersRuntime) { + this.indexersRuntime = indexersRuntime; + return this; + } + + /** + * Get the limits property: Service level general limits. + * + * @return the limits value. + */ + @Generated + public ServiceLimits getLimits() { + return this.limits; + } + + /** + * Set the limits property: Service level general limits. + * + * @param limits the limits value to set. + * @return the ServiceStatistics object itself. + */ + @Generated + public ServiceStatistics setLimits(ServiceLimits limits) { + this.limits = limits; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("counters", this.counters); + jsonWriter.writeJsonField("indexersRuntime", this.indexersRuntime); + jsonWriter.writeJsonField("limits", this.limits); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServiceStatistics from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServiceStatistics 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 ServiceStatistics. + */ + @Generated + public static ServiceStatistics fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServiceStatistics deserializedServiceStatistics = new ServiceStatistics(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("counters".equals(fieldName)) { + deserializedServiceStatistics.counters = ServiceCounters.fromJson(reader); + } else if ("indexersRuntime".equals(fieldName)) { + deserializedServiceStatistics.indexersRuntime = ServiceIndexersRuntime.fromJson(reader); + } else if ("limits".equals(fieldName)) { + deserializedServiceStatistics.limits = ServiceLimits.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedServiceStatistics; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ShaperSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ShaperSkill.java new file mode 100644 index 000000000000..a7217faee984 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ShaperSkill.java @@ -0,0 +1,153 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A skill for reshaping the outputs. It creates a complex type to support composite fields (also known as multipart + * fields). + */ +@Fluent +public final class ShaperSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Util.ShaperSkill"; + + /** + * Creates an instance of ShaperSkill class. + */ + @Generated + public ShaperSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ShaperSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ShaperSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ShaperSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ShaperSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ShaperSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ShaperSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ShaperSkill 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 ShaperSkill. + */ + @Generated + public static ShaperSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ShaperSkill deserializedShaperSkill = new ShaperSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedShaperSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedShaperSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedShaperSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedShaperSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedShaperSkill.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedShaperSkill.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedShaperSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SharePointSensitivityLabelInfo.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SharePointSensitivityLabelInfo.java new file mode 100644 index 000000000000..05745bc12acf --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SharePointSensitivityLabelInfo.java @@ -0,0 +1,249 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Information about the sensitivity label applied to a SharePoint document. + */ +@Fluent +public final class SharePointSensitivityLabelInfo implements JsonSerializable { + /* + * The display name for the sensitivity label. + */ + @Generated + private String displayName; + + /* + * The ID of the sensitivity label. + */ + @Generated + private String sensitivityLabelId; + + /* + * The tooltip that should be displayed for the label in a UI. + */ + @Generated + private String tooltip; + + /* + * The priority in which the sensitivity label is applied. + */ + @Generated + private Integer priority; + + /* + * The color that the UI should display for the label, if configured. + */ + @Generated + private String color; + + /* + * Indicates whether the sensitivity label enforces encryption. + */ + @Generated + private Boolean isEncrypted; + + /** + * Creates an instance of SharePointSensitivityLabelInfo class. + */ + @Generated + public SharePointSensitivityLabelInfo() { + } + + /** + * Get the displayName property: The display name for the sensitivity label. + * + * @return the displayName value. + */ + @Generated + public String getDisplayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name for the sensitivity label. + * + * @param displayName the displayName value to set. + * @return the SharePointSensitivityLabelInfo object itself. + */ + @Generated + public SharePointSensitivityLabelInfo setDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the sensitivityLabelId property: The ID of the sensitivity label. + * + * @return the sensitivityLabelId value. + */ + @Generated + public String getSensitivityLabelId() { + return this.sensitivityLabelId; + } + + /** + * Set the sensitivityLabelId property: The ID of the sensitivity label. + * + * @param sensitivityLabelId the sensitivityLabelId value to set. + * @return the SharePointSensitivityLabelInfo object itself. + */ + @Generated + public SharePointSensitivityLabelInfo setSensitivityLabelId(String sensitivityLabelId) { + this.sensitivityLabelId = sensitivityLabelId; + return this; + } + + /** + * Get the tooltip property: The tooltip that should be displayed for the label in a UI. + * + * @return the tooltip value. + */ + @Generated + public String getTooltip() { + return this.tooltip; + } + + /** + * Set the tooltip property: The tooltip that should be displayed for the label in a UI. + * + * @param tooltip the tooltip value to set. + * @return the SharePointSensitivityLabelInfo object itself. + */ + @Generated + public SharePointSensitivityLabelInfo setTooltip(String tooltip) { + this.tooltip = tooltip; + return this; + } + + /** + * Get the priority property: The priority in which the sensitivity label is applied. + * + * @return the priority value. + */ + @Generated + public Integer getPriority() { + return this.priority; + } + + /** + * Set the priority property: The priority in which the sensitivity label is applied. + * + * @param priority the priority value to set. + * @return the SharePointSensitivityLabelInfo object itself. + */ + @Generated + public SharePointSensitivityLabelInfo setPriority(Integer priority) { + this.priority = priority; + return this; + } + + /** + * Get the color property: The color that the UI should display for the label, if configured. + * + * @return the color value. + */ + @Generated + public String getColor() { + return this.color; + } + + /** + * Set the color property: The color that the UI should display for the label, if configured. + * + * @param color the color value to set. + * @return the SharePointSensitivityLabelInfo object itself. + */ + @Generated + public SharePointSensitivityLabelInfo setColor(String color) { + this.color = color; + return this; + } + + /** + * Get the isEncrypted property: Indicates whether the sensitivity label enforces encryption. + * + * @return the isEncrypted value. + */ + @Generated + public Boolean isEncrypted() { + return this.isEncrypted; + } + + /** + * Set the isEncrypted property: Indicates whether the sensitivity label enforces encryption. + * + * @param isEncrypted the isEncrypted value to set. + * @return the SharePointSensitivityLabelInfo object itself. + */ + @Generated + public SharePointSensitivityLabelInfo setIsEncrypted(Boolean isEncrypted) { + this.isEncrypted = isEncrypted; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("sensitivityLabelId", this.sensitivityLabelId); + jsonWriter.writeStringField("tooltip", this.tooltip); + jsonWriter.writeNumberField("priority", this.priority); + jsonWriter.writeStringField("color", this.color); + jsonWriter.writeBooleanField("isEncrypted", this.isEncrypted); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SharePointSensitivityLabelInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SharePointSensitivityLabelInfo 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 SharePointSensitivityLabelInfo. + */ + @Generated + public static SharePointSensitivityLabelInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SharePointSensitivityLabelInfo deserializedSharePointSensitivityLabelInfo + = new SharePointSensitivityLabelInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedSharePointSensitivityLabelInfo.displayName = reader.getString(); + } else if ("sensitivityLabelId".equals(fieldName)) { + deserializedSharePointSensitivityLabelInfo.sensitivityLabelId = reader.getString(); + } else if ("tooltip".equals(fieldName)) { + deserializedSharePointSensitivityLabelInfo.tooltip = reader.getString(); + } else if ("priority".equals(fieldName)) { + deserializedSharePointSensitivityLabelInfo.priority = reader.getNullable(JsonReader::getInt); + } else if ("color".equals(fieldName)) { + deserializedSharePointSensitivityLabelInfo.color = reader.getString(); + } else if ("isEncrypted".equals(fieldName)) { + deserializedSharePointSensitivityLabelInfo.isEncrypted = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedSharePointSensitivityLabelInfo; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ShingleTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ShingleTokenFilter.java new file mode 100644 index 000000000000..d8f1ddbcd672 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/ShingleTokenFilter.java @@ -0,0 +1,294 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Creates combinations of tokens as a single token. This token filter is implemented using Apache Lucene. + */ +@Fluent +public final class ShingleTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.ShingleTokenFilter"; + + /* + * The maximum shingle size. Default and minimum value is 2. + */ + @Generated + private Integer maxShingleSize; + + /* + * The minimum shingle size. Default and minimum value is 2. Must be less than the value of maxShingleSize. + */ + @Generated + private Integer minShingleSize; + + /* + * A value indicating whether the output stream will contain the input tokens (unigrams) as well as shingles. + * Default is true. + */ + @Generated + private Boolean outputUnigrams; + + /* + * A value indicating whether to output unigrams for those times when no shingles are available. This property takes + * precedence when outputUnigrams is set to false. Default is false. + */ + @Generated + private Boolean outputUnigramsIfNoShingles; + + /* + * The string to use when joining adjacent tokens to form a shingle. Default is a single space (" "). + */ + @Generated + private String tokenSeparator; + + /* + * The string to insert for each position at which there is no token. Default is an underscore ("_"). + */ + @Generated + private String filterToken; + + /** + * Creates an instance of ShingleTokenFilter class. + */ + @Generated + public ShingleTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the maxShingleSize property: The maximum shingle size. Default and minimum value is 2. + * + * @return the maxShingleSize value. + */ + @Generated + public Integer getMaxShingleSize() { + return this.maxShingleSize; + } + + /** + * Set the maxShingleSize property: The maximum shingle size. Default and minimum value is 2. + * + * @param maxShingleSize the maxShingleSize value to set. + * @return the ShingleTokenFilter object itself. + */ + @Generated + public ShingleTokenFilter setMaxShingleSize(Integer maxShingleSize) { + this.maxShingleSize = maxShingleSize; + return this; + } + + /** + * Get the minShingleSize property: The minimum shingle size. Default and minimum value is 2. Must be less than the + * value of maxShingleSize. + * + * @return the minShingleSize value. + */ + @Generated + public Integer getMinShingleSize() { + return this.minShingleSize; + } + + /** + * Set the minShingleSize property: The minimum shingle size. Default and minimum value is 2. Must be less than the + * value of maxShingleSize. + * + * @param minShingleSize the minShingleSize value to set. + * @return the ShingleTokenFilter object itself. + */ + @Generated + public ShingleTokenFilter setMinShingleSize(Integer minShingleSize) { + this.minShingleSize = minShingleSize; + return this; + } + + /** + * Get the outputUnigrams property: A value indicating whether the output stream will contain the input tokens + * (unigrams) as well as shingles. Default is true. + * + * @return the outputUnigrams value. + */ + @Generated + public Boolean isOutputUnigrams() { + return this.outputUnigrams; + } + + /** + * Set the outputUnigrams property: A value indicating whether the output stream will contain the input tokens + * (unigrams) as well as shingles. Default is true. + * + * @param outputUnigrams the outputUnigrams value to set. + * @return the ShingleTokenFilter object itself. + */ + @Generated + public ShingleTokenFilter setOutputUnigrams(Boolean outputUnigrams) { + this.outputUnigrams = outputUnigrams; + return this; + } + + /** + * Get the outputUnigramsIfNoShingles property: A value indicating whether to output unigrams for those times when + * no shingles are available. This property takes precedence when outputUnigrams is set to false. Default is false. + * + * @return the outputUnigramsIfNoShingles value. + */ + @Generated + public Boolean isOutputUnigramsIfNoShingles() { + return this.outputUnigramsIfNoShingles; + } + + /** + * Set the outputUnigramsIfNoShingles property: A value indicating whether to output unigrams for those times when + * no shingles are available. This property takes precedence when outputUnigrams is set to false. Default is false. + * + * @param outputUnigramsIfNoShingles the outputUnigramsIfNoShingles value to set. + * @return the ShingleTokenFilter object itself. + */ + @Generated + public ShingleTokenFilter setOutputUnigramsIfNoShingles(Boolean outputUnigramsIfNoShingles) { + this.outputUnigramsIfNoShingles = outputUnigramsIfNoShingles; + return this; + } + + /** + * Get the tokenSeparator property: The string to use when joining adjacent tokens to form a shingle. Default is a + * single space (" "). + * + * @return the tokenSeparator value. + */ + @Generated + public String getTokenSeparator() { + return this.tokenSeparator; + } + + /** + * Set the tokenSeparator property: The string to use when joining adjacent tokens to form a shingle. Default is a + * single space (" "). + * + * @param tokenSeparator the tokenSeparator value to set. + * @return the ShingleTokenFilter object itself. + */ + @Generated + public ShingleTokenFilter setTokenSeparator(String tokenSeparator) { + this.tokenSeparator = tokenSeparator; + return this; + } + + /** + * Get the filterToken property: The string to insert for each position at which there is no token. Default is an + * underscore ("_"). + * + * @return the filterToken value. + */ + @Generated + public String getFilterToken() { + return this.filterToken; + } + + /** + * Set the filterToken property: The string to insert for each position at which there is no token. Default is an + * underscore ("_"). + * + * @param filterToken the filterToken value to set. + * @return the ShingleTokenFilter object itself. + */ + @Generated + public ShingleTokenFilter setFilterToken(String filterToken) { + this.filterToken = filterToken; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public ShingleTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("maxShingleSize", this.maxShingleSize); + jsonWriter.writeNumberField("minShingleSize", this.minShingleSize); + jsonWriter.writeBooleanField("outputUnigrams", this.outputUnigrams); + jsonWriter.writeBooleanField("outputUnigramsIfNoShingles", this.outputUnigramsIfNoShingles); + jsonWriter.writeStringField("tokenSeparator", this.tokenSeparator); + jsonWriter.writeStringField("filterToken", this.filterToken); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ShingleTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ShingleTokenFilter 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 ShingleTokenFilter. + */ + @Generated + public static ShingleTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ShingleTokenFilter deserializedShingleTokenFilter = new ShingleTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedShingleTokenFilter.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedShingleTokenFilter.odataType = reader.getString(); + } else if ("maxShingleSize".equals(fieldName)) { + deserializedShingleTokenFilter.maxShingleSize = reader.getNullable(JsonReader::getInt); + } else if ("minShingleSize".equals(fieldName)) { + deserializedShingleTokenFilter.minShingleSize = reader.getNullable(JsonReader::getInt); + } else if ("outputUnigrams".equals(fieldName)) { + deserializedShingleTokenFilter.outputUnigrams = reader.getNullable(JsonReader::getBoolean); + } else if ("outputUnigramsIfNoShingles".equals(fieldName)) { + deserializedShingleTokenFilter.outputUnigramsIfNoShingles + = reader.getNullable(JsonReader::getBoolean); + } else if ("tokenSeparator".equals(fieldName)) { + deserializedShingleTokenFilter.tokenSeparator = reader.getString(); + } else if ("filterToken".equals(fieldName)) { + deserializedShingleTokenFilter.filterToken = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedShingleTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/Similarity.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/Similarity.java new file mode 100644 index 000000000000..145b7dd336b2 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/Similarity.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.models; + +import com.azure.core.annotation.Generated; +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 similarity algorithms. Similarity algorithms are used to calculate scores that tie queries to + * documents. The higher the score, the more relevant the document is to that specific query. Those scores are used to + * rank the search results. + */ +@Immutable +public class Similarity implements JsonSerializable { + /* + * The @odata.type property. + */ + @Generated + private String odataType = "Similarity"; + + /** + * Creates an instance of Similarity class. + */ + @Generated + public Similarity() { + } + + /** + * Get the odataType property: The @odata.type property. + * + * @return the odataType value. + */ + @Generated + public String getOdataType() { + return this.odataType; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Similarity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Similarity 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 Similarity. + */ + @Generated + public static Similarity 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.ClassicSimilarity".equals(discriminatorValue)) { + return ClassicSimilarity.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.BM25Similarity".equals(discriminatorValue)) { + return BM25Similarity.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static Similarity fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Similarity deserializedSimilarity = new Similarity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("@odata.type".equals(fieldName)) { + deserializedSimilarity.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSimilarity; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SingleVectorFieldResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SingleVectorFieldResult.java new file mode 100644 index 000000000000..c6522f1138e9 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SingleVectorFieldResult.java @@ -0,0 +1,104 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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. + */ + @Generated + 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. + */ + @Generated + private Double vectorSimilarity; + + /** + * Creates an instance of SingleVectorFieldResult class. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + public Double getVectorSimilarity() { + return this.vectorSimilarity; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + 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/search/src/main/java/com/azure/search/models/SkillNames.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SkillNames.java new file mode 100644 index 000000000000..f891cbdfcbfc --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SkillNames.java @@ -0,0 +1,95 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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. + */ + @Generated + private List skillNames; + + /** + * Creates an instance of SkillNames class. + */ + @Generated + public SkillNames() { + } + + /** + * Get the skillNames property: the names of skills to be reset. + * + * @return the skillNames value. + */ + @Generated + 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. + */ + @Generated + public SkillNames setSkillNames(List skillNames) { + this.skillNames = skillNames; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + 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/search/src/main/java/com/azure/search/models/SnowballTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SnowballTokenFilter.java new file mode 100644 index 000000000000..b26a7bf8e8fc --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SnowballTokenFilter.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A filter that stems words using a Snowball-generated stemmer. This token filter is implemented using Apache Lucene. + */ +@Fluent +public final class SnowballTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.SnowballTokenFilter"; + + /* + * The language to use. + */ + @Generated + private SnowballTokenFilterLanguage language; + + /** + * Creates an instance of SnowballTokenFilter class. + */ + @Generated + public SnowballTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the language property: The language to use. + * + * @return the language value. + */ + @Generated + public SnowballTokenFilterLanguage getLanguage() { + return this.language; + } + + /** + * Set the language property: The language to use. + * + * @param language the language value to set. + * @return the SnowballTokenFilter object itself. + */ + @Generated + public SnowballTokenFilter setLanguage(SnowballTokenFilterLanguage language) { + this.language = language; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SnowballTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("language", this.language == null ? null : this.language.toString()); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SnowballTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SnowballTokenFilter 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 SnowballTokenFilter. + */ + @Generated + public static SnowballTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SnowballTokenFilter deserializedSnowballTokenFilter = new SnowballTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSnowballTokenFilter.setName(reader.getString()); + } else if ("language".equals(fieldName)) { + deserializedSnowballTokenFilter.language + = SnowballTokenFilterLanguage.fromString(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedSnowballTokenFilter.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSnowballTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SnowballTokenFilterLanguage.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SnowballTokenFilterLanguage.java new file mode 100644 index 000000000000..82f621e87198 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SnowballTokenFilterLanguage.java @@ -0,0 +1,157 @@ +// 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.models; + +/** + * The language to use for a Snowball token filter. + */ +public enum SnowballTokenFilterLanguage { + /** + * Selects the Lucene Snowball stemming tokenizer for Armenian. + */ + ARMENIAN("armenian"), + + /** + * Selects the Lucene Snowball stemming tokenizer for Basque. + */ + BASQUE("basque"), + + /** + * Selects the Lucene Snowball stemming tokenizer for Catalan. + */ + CATALAN("catalan"), + + /** + * Selects the Lucene Snowball stemming tokenizer for Danish. + */ + DANISH("danish"), + + /** + * Selects the Lucene Snowball stemming tokenizer for Dutch. + */ + DUTCH("dutch"), + + /** + * Selects the Lucene Snowball stemming tokenizer for English. + */ + ENGLISH("english"), + + /** + * Selects the Lucene Snowball stemming tokenizer for Finnish. + */ + FINNISH("finnish"), + + /** + * Selects the Lucene Snowball stemming tokenizer for French. + */ + FRENCH("french"), + + /** + * Selects the Lucene Snowball stemming tokenizer for German. + */ + GERMAN("german"), + + /** + * Selects the Lucene Snowball stemming tokenizer that uses the German variant algorithm. + */ + GERMAN2("german2"), + + /** + * Selects the Lucene Snowball stemming tokenizer for Hungarian. + */ + HUNGARIAN("hungarian"), + + /** + * Selects the Lucene Snowball stemming tokenizer for Italian. + */ + ITALIAN("italian"), + + /** + * Selects the Lucene Snowball stemming tokenizer for Dutch that uses the Kraaij-Pohlmann stemming algorithm. + */ + KP("kp"), + + /** + * Selects the Lucene Snowball stemming tokenizer for English that uses the Lovins stemming algorithm. + */ + LOVINS("lovins"), + + /** + * Selects the Lucene Snowball stemming tokenizer for Norwegian. + */ + NORWEGIAN("norwegian"), + + /** + * Selects the Lucene Snowball stemming tokenizer for English that uses the Porter stemming algorithm. + */ + PORTER("porter"), + + /** + * Selects the Lucene Snowball stemming tokenizer for Portuguese. + */ + PORTUGUESE("portuguese"), + + /** + * Selects the Lucene Snowball stemming tokenizer for Romanian. + */ + ROMANIAN("romanian"), + + /** + * Selects the Lucene Snowball stemming tokenizer for Russian. + */ + RUSSIAN("russian"), + + /** + * Selects the Lucene Snowball stemming tokenizer for Spanish. + */ + SPANISH("spanish"), + + /** + * Selects the Lucene Snowball stemming tokenizer for Swedish. + */ + SWEDISH("swedish"), + + /** + * Selects the Lucene Snowball stemming tokenizer for Turkish. + */ + TURKISH("turkish"); + + /** + * The actual serialized value for a SnowballTokenFilterLanguage instance. + */ + private final String value; + + SnowballTokenFilterLanguage(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SnowballTokenFilterLanguage instance. + * + * @param value the serialized value to parse. + * @return the parsed SnowballTokenFilterLanguage object, or null if unable to parse. + */ + public static SnowballTokenFilterLanguage fromString(String value) { + if (value == null) { + return null; + } + SnowballTokenFilterLanguage[] items = SnowballTokenFilterLanguage.values(); + for (SnowballTokenFilterLanguage item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SoftDeleteColumnDeletionDetectionPolicy.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SoftDeleteColumnDeletionDetectionPolicy.java new file mode 100644 index 000000000000..9f227d6c2104 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SoftDeleteColumnDeletionDetectionPolicy.java @@ -0,0 +1,145 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 that implements a soft-deletion strategy. It determines whether an item + * should be deleted based on the value of a designated 'soft delete' column. + */ +@Fluent +public final class SoftDeleteColumnDeletionDetectionPolicy extends DataDeletionDetectionPolicy { + /* + * A URI fragment specifying the type of data deletion detection policy. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.SoftDeleteColumnDeletionDetectionPolicy"; + + /* + * The name of the column to use for soft-deletion detection. + */ + @Generated + private String softDeleteColumnName; + + /* + * The marker value that identifies an item as deleted. + */ + @Generated + private String softDeleteMarkerValue; + + /** + * Creates an instance of SoftDeleteColumnDeletionDetectionPolicy class. + */ + @Generated + public SoftDeleteColumnDeletionDetectionPolicy() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of data deletion detection policy. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the softDeleteColumnName property: The name of the column to use for soft-deletion detection. + * + * @return the softDeleteColumnName value. + */ + @Generated + public String getSoftDeleteColumnName() { + return this.softDeleteColumnName; + } + + /** + * Set the softDeleteColumnName property: The name of the column to use for soft-deletion detection. + * + * @param softDeleteColumnName the softDeleteColumnName value to set. + * @return the SoftDeleteColumnDeletionDetectionPolicy object itself. + */ + @Generated + public SoftDeleteColumnDeletionDetectionPolicy setSoftDeleteColumnName(String softDeleteColumnName) { + this.softDeleteColumnName = softDeleteColumnName; + return this; + } + + /** + * Get the softDeleteMarkerValue property: The marker value that identifies an item as deleted. + * + * @return the softDeleteMarkerValue value. + */ + @Generated + public String getSoftDeleteMarkerValue() { + return this.softDeleteMarkerValue; + } + + /** + * Set the softDeleteMarkerValue property: The marker value that identifies an item as deleted. + * + * @param softDeleteMarkerValue the softDeleteMarkerValue value to set. + * @return the SoftDeleteColumnDeletionDetectionPolicy object itself. + */ + @Generated + public SoftDeleteColumnDeletionDetectionPolicy setSoftDeleteMarkerValue(String softDeleteMarkerValue) { + this.softDeleteMarkerValue = softDeleteMarkerValue; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeStringField("softDeleteColumnName", this.softDeleteColumnName); + jsonWriter.writeStringField("softDeleteMarkerValue", this.softDeleteMarkerValue); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SoftDeleteColumnDeletionDetectionPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SoftDeleteColumnDeletionDetectionPolicy 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 SoftDeleteColumnDeletionDetectionPolicy. + */ + @Generated + public static SoftDeleteColumnDeletionDetectionPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SoftDeleteColumnDeletionDetectionPolicy deserializedSoftDeleteColumnDeletionDetectionPolicy + = new SoftDeleteColumnDeletionDetectionPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("@odata.type".equals(fieldName)) { + deserializedSoftDeleteColumnDeletionDetectionPolicy.odataType = reader.getString(); + } else if ("softDeleteColumnName".equals(fieldName)) { + deserializedSoftDeleteColumnDeletionDetectionPolicy.softDeleteColumnName = reader.getString(); + } else if ("softDeleteMarkerValue".equals(fieldName)) { + deserializedSoftDeleteColumnDeletionDetectionPolicy.softDeleteMarkerValue = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSoftDeleteColumnDeletionDetectionPolicy; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SplitSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SplitSkill.java new file mode 100644 index 000000000000..55d60fd920c1 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SplitSkill.java @@ -0,0 +1,392 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A skill to split a string into chunks of text. + */ +@Fluent +public final class SplitSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Text.SplitSkill"; + + /* + * A value indicating which language code to use. Default is `en`. + */ + @Generated + private SplitSkillLanguage defaultLanguageCode; + + /* + * A value indicating which split mode to perform. + */ + @Generated + private TextSplitMode textSplitMode; + + /* + * The desired maximum page length. Default is 10000. + */ + @Generated + private Integer maximumPageLength; + + /* + * Only applicable when textSplitMode is set to 'pages'. If specified, n+1th chunk will start with this number of + * characters/tokens from the end of the nth chunk. + */ + @Generated + private Integer pageOverlapLength; + + /* + * Only applicable when textSplitMode is set to 'pages'. If specified, the SplitSkill will discontinue splitting + * after processing the first 'maximumPagesToTake' pages, in order to improve performance when only a few initial + * pages are needed from each document. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + private AzureOpenAITokenizerParameters azureOpenAITokenizerParameters; + + /** + * Creates an instance of SplitSkill class. + */ + @Generated + public SplitSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @return the defaultLanguageCode value. + */ + @Generated + public SplitSkillLanguage getDefaultLanguageCode() { + return this.defaultLanguageCode; + } + + /** + * Set the defaultLanguageCode property: A value indicating which language code to use. Default is `en`. + * + * @param defaultLanguageCode the defaultLanguageCode value to set. + * @return the SplitSkill object itself. + */ + @Generated + public SplitSkill setDefaultLanguageCode(SplitSkillLanguage defaultLanguageCode) { + this.defaultLanguageCode = defaultLanguageCode; + return this; + } + + /** + * Get the textSplitMode property: A value indicating which split mode to perform. + * + * @return the textSplitMode value. + */ + @Generated + public TextSplitMode getTextSplitMode() { + return this.textSplitMode; + } + + /** + * Set the textSplitMode property: A value indicating which split mode to perform. + * + * @param textSplitMode the textSplitMode value to set. + * @return the SplitSkill object itself. + */ + @Generated + public SplitSkill setTextSplitMode(TextSplitMode textSplitMode) { + this.textSplitMode = textSplitMode; + return this; + } + + /** + * Get the maximumPageLength property: The desired maximum page length. Default is 10000. + * + * @return the maximumPageLength value. + */ + @Generated + public Integer getMaximumPageLength() { + return this.maximumPageLength; + } + + /** + * Set the maximumPageLength property: The desired maximum page length. Default is 10000. + * + * @param maximumPageLength the maximumPageLength value to set. + * @return the SplitSkill object itself. + */ + @Generated + public SplitSkill setMaximumPageLength(Integer maximumPageLength) { + this.maximumPageLength = maximumPageLength; + return this; + } + + /** + * Get the pageOverlapLength property: Only applicable when textSplitMode is set to 'pages'. If specified, n+1th + * chunk will start with this number of characters/tokens from the end of the nth chunk. + * + * @return the pageOverlapLength value. + */ + @Generated + public Integer getPageOverlapLength() { + return this.pageOverlapLength; + } + + /** + * Set the pageOverlapLength property: Only applicable when textSplitMode is set to 'pages'. If specified, n+1th + * chunk will start with this number of characters/tokens from the end of the nth chunk. + * + * @param pageOverlapLength the pageOverlapLength value to set. + * @return the SplitSkill object itself. + */ + @Generated + public SplitSkill setPageOverlapLength(Integer pageOverlapLength) { + this.pageOverlapLength = pageOverlapLength; + return this; + } + + /** + * Get the maximumPagesToTake property: Only applicable when textSplitMode is set to 'pages'. If specified, the + * SplitSkill will discontinue splitting after processing the first 'maximumPagesToTake' pages, in order to improve + * performance when only a few initial pages are needed from each document. + * + * @return the maximumPagesToTake value. + */ + @Generated + public Integer getMaximumPagesToTake() { + return this.maximumPagesToTake; + } + + /** + * Set the maximumPagesToTake property: Only applicable when textSplitMode is set to 'pages'. If specified, the + * SplitSkill will discontinue splitting after processing the first 'maximumPagesToTake' pages, in order to improve + * performance when only a few initial pages are needed from each document. + * + * @param maximumPagesToTake the maximumPagesToTake value to set. + * @return the SplitSkill object itself. + */ + @Generated + public SplitSkill setMaximumPagesToTake(Integer maximumPagesToTake) { + this.maximumPagesToTake = 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + public SplitSkill setAzureOpenAITokenizerParameters(AzureOpenAITokenizerParameters azureOpenAITokenizerParameters) { + this.azureOpenAITokenizerParameters = azureOpenAITokenizerParameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SplitSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SplitSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SplitSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SplitSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SplitSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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("defaultLanguageCode", + this.defaultLanguageCode == null ? null : this.defaultLanguageCode.toString()); + jsonWriter.writeStringField("textSplitMode", this.textSplitMode == null ? null : this.textSplitMode.toString()); + 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(); + } + + /** + * Reads an instance of SplitSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SplitSkill 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 SplitSkill. + */ + @Generated + public static SplitSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SplitSkill deserializedSplitSkill = new SplitSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedSplitSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedSplitSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedSplitSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedSplitSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedSplitSkill.setContext(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedSplitSkill.odataType = reader.getString(); + } else if ("defaultLanguageCode".equals(fieldName)) { + deserializedSplitSkill.defaultLanguageCode = SplitSkillLanguage.fromString(reader.getString()); + } else if ("textSplitMode".equals(fieldName)) { + deserializedSplitSkill.textSplitMode = TextSplitMode.fromString(reader.getString()); + } else if ("maximumPageLength".equals(fieldName)) { + deserializedSplitSkill.maximumPageLength = reader.getNullable(JsonReader::getInt); + } else if ("pageOverlapLength".equals(fieldName)) { + deserializedSplitSkill.pageOverlapLength = reader.getNullable(JsonReader::getInt); + } else if ("maximumPagesToTake".equals(fieldName)) { + deserializedSplitSkill.maximumPagesToTake = reader.getNullable(JsonReader::getInt); + } else if ("unit".equals(fieldName)) { + deserializedSplitSkill.unit = SplitSkillUnit.fromString(reader.getString()); + } else if ("azureOpenAITokenizerParameters".equals(fieldName)) { + deserializedSplitSkill.azureOpenAITokenizerParameters + = AzureOpenAITokenizerParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSplitSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SplitSkillEncoderModelName.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SplitSkillEncoderModelName.java new file mode 100644 index 000000000000..0160c4aa3a7f --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SplitSkillEncoderModelName.java @@ -0,0 +1,71 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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. + */ + @Generated + public static final SplitSkillEncoderModelName R50KBASE = fromString("r50k_base"); + + /** + * A base model with a 50,000 token vocabulary, optimized for prompt-based tasks. + */ + @Generated + public static final SplitSkillEncoderModelName P50KBASE = fromString("p50k_base"); + + /** + * Similar to p50k_base but fine-tuned for editing or rephrasing tasks with a 50,000 token vocabulary. + */ + @Generated + public static final SplitSkillEncoderModelName P50KEDIT = fromString("p50k_edit"); + + /** + * A base model with a 100,000 token vocabulary. + */ + @Generated + public static final SplitSkillEncoderModelName CL100KBASE = fromString("cl100k_base"); + + /** + * Creates a new instance of SplitSkillEncoderModelName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public SplitSkillEncoderModelName() { + } + + /** + * Creates or finds a SplitSkillEncoderModelName from its string representation. + * + * @param name a name to look for. + * @return the corresponding SplitSkillEncoderModelName. + */ + @Generated + public static SplitSkillEncoderModelName fromString(String name) { + return fromString(name, SplitSkillEncoderModelName.class); + } + + /** + * Gets known SplitSkillEncoderModelName values. + * + * @return known SplitSkillEncoderModelName values. + */ + @Generated + public static Collection values() { + return values(SplitSkillEncoderModelName.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SplitSkillLanguage.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SplitSkillLanguage.java new file mode 100644 index 000000000000..aa5c82ef04db --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SplitSkillLanguage.java @@ -0,0 +1,244 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The language codes supported for input text by SplitSkill. + */ +public final class SplitSkillLanguage extends ExpandableStringEnum { + /** + * Amharic. + */ + @Generated + public static final SplitSkillLanguage AM = fromString("am"); + + /** + * Bosnian. + */ + @Generated + public static final SplitSkillLanguage BS = fromString("bs"); + + /** + * Czech. + */ + @Generated + public static final SplitSkillLanguage CS = fromString("cs"); + + /** + * Danish. + */ + @Generated + public static final SplitSkillLanguage DA = fromString("da"); + + /** + * German. + */ + @Generated + public static final SplitSkillLanguage DE = fromString("de"); + + /** + * English. + */ + @Generated + public static final SplitSkillLanguage EN = fromString("en"); + + /** + * Spanish. + */ + @Generated + public static final SplitSkillLanguage ES = fromString("es"); + + /** + * Estonian. + */ + @Generated + public static final SplitSkillLanguage ET = fromString("et"); + + /** + * Finnish. + */ + @Generated + public static final SplitSkillLanguage FI = fromString("fi"); + + /** + * French. + */ + @Generated + public static final SplitSkillLanguage FR = fromString("fr"); + + /** + * Hebrew. + */ + @Generated + public static final SplitSkillLanguage HE = fromString("he"); + + /** + * Hindi. + */ + @Generated + public static final SplitSkillLanguage HI = fromString("hi"); + + /** + * Croatian. + */ + @Generated + public static final SplitSkillLanguage HR = fromString("hr"); + + /** + * Hungarian. + */ + @Generated + public static final SplitSkillLanguage HU = fromString("hu"); + + /** + * Indonesian. + */ + @Generated + public static final SplitSkillLanguage ID = fromString("id"); + + /** + * Icelandic. + */ + @Generated + public static final SplitSkillLanguage IS = fromString("is"); + + /** + * Italian. + */ + @Generated + public static final SplitSkillLanguage IT = fromString("it"); + + /** + * Japanese. + */ + @Generated + public static final SplitSkillLanguage JA = fromString("ja"); + + /** + * Korean. + */ + @Generated + public static final SplitSkillLanguage KO = fromString("ko"); + + /** + * Latvian. + */ + @Generated + public static final SplitSkillLanguage LV = fromString("lv"); + + /** + * Norwegian. + */ + @Generated + public static final SplitSkillLanguage NB = fromString("nb"); + + /** + * Dutch. + */ + @Generated + public static final SplitSkillLanguage NL = fromString("nl"); + + /** + * Polish. + */ + @Generated + public static final SplitSkillLanguage PL = fromString("pl"); + + /** + * Portuguese (Portugal). + */ + @Generated + public static final SplitSkillLanguage PT = fromString("pt"); + + /** + * Portuguese (Brazil). + */ + @Generated + public static final SplitSkillLanguage PT_BR = fromString("pt-br"); + + /** + * Russian. + */ + @Generated + public static final SplitSkillLanguage RU = fromString("ru"); + + /** + * Slovak. + */ + @Generated + public static final SplitSkillLanguage SK = fromString("sk"); + + /** + * Slovenian. + */ + @Generated + public static final SplitSkillLanguage SL = fromString("sl"); + + /** + * Serbian. + */ + @Generated + public static final SplitSkillLanguage SR = fromString("sr"); + + /** + * Swedish. + */ + @Generated + public static final SplitSkillLanguage SV = fromString("sv"); + + /** + * Turkish. + */ + @Generated + public static final SplitSkillLanguage TR = fromString("tr"); + + /** + * Urdu. + */ + @Generated + public static final SplitSkillLanguage UR = fromString("ur"); + + /** + * Chinese (Simplified). + */ + @Generated + public static final SplitSkillLanguage ZH = fromString("zh"); + + /** + * Creates a new instance of SplitSkillLanguage value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public SplitSkillLanguage() { + } + + /** + * Creates or finds a SplitSkillLanguage from its string representation. + * + * @param name a name to look for. + * @return the corresponding SplitSkillLanguage. + */ + @Generated + public static SplitSkillLanguage fromString(String name) { + return fromString(name, SplitSkillLanguage.class); + } + + /** + * Gets known SplitSkillLanguage values. + * + * @return known SplitSkillLanguage values. + */ + @Generated + public static Collection values() { + return values(SplitSkillLanguage.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SplitSkillUnit.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SplitSkillUnit.java new file mode 100644 index 000000000000..23e7d3818a87 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SplitSkillUnit.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.models; + +import com.azure.core.annotation.Generated; +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. + */ + @Generated + public static final SplitSkillUnit CHARACTERS = fromString("characters"); + + /** + * The length will be measured by an AzureOpenAI tokenizer from the tiktoken library. + */ + @Generated + public static final SplitSkillUnit AZURE_OPEN_AITOKENS = fromString("azureOpenAITokens"); + + /** + * Creates a new instance of SplitSkillUnit value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public SplitSkillUnit() { + } + + /** + * Creates or finds a SplitSkillUnit from its string representation. + * + * @param name a name to look for. + * @return the corresponding SplitSkillUnit. + */ + @Generated + public static SplitSkillUnit fromString(String name) { + return fromString(name, SplitSkillUnit.class); + } + + /** + * Gets known SplitSkillUnit values. + * + * @return known SplitSkillUnit values. + */ + @Generated + public static Collection values() { + return values(SplitSkillUnit.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SqlIntegratedChangeTrackingPolicy.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SqlIntegratedChangeTrackingPolicy.java new file mode 100644 index 000000000000..46bbe20e0d18 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SqlIntegratedChangeTrackingPolicy.java @@ -0,0 +1,83 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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 change detection policy that captures changes using the Integrated Change Tracking feature of Azure + * SQL Database. + */ +@Immutable +public final class SqlIntegratedChangeTrackingPolicy extends DataChangeDetectionPolicy { + /* + * A URI fragment specifying the type of data change detection policy. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.SqlIntegratedChangeTrackingPolicy"; + + /** + * Creates an instance of SqlIntegratedChangeTrackingPolicy class. + */ + @Generated + public SqlIntegratedChangeTrackingPolicy() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of data change detection policy. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlIntegratedChangeTrackingPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlIntegratedChangeTrackingPolicy 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 SqlIntegratedChangeTrackingPolicy. + */ + @Generated + public static SqlIntegratedChangeTrackingPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlIntegratedChangeTrackingPolicy deserializedSqlIntegratedChangeTrackingPolicy + = new SqlIntegratedChangeTrackingPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("@odata.type".equals(fieldName)) { + deserializedSqlIntegratedChangeTrackingPolicy.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlIntegratedChangeTrackingPolicy; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StemmerOverrideTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StemmerOverrideTokenFilter.java new file mode 100644 index 000000000000..fa1f2c07beea --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StemmerOverrideTokenFilter.java @@ -0,0 +1,132 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Provides the ability to override other stemming filters with custom dictionary-based stemming. Any dictionary-stemmed + * terms will be marked as keywords so that they will not be stemmed with stemmers down the chain. Must be placed before + * any stemming filters. This token filter is implemented using Apache Lucene. + */ +@Fluent +public final class StemmerOverrideTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.StemmerOverrideTokenFilter"; + + /* + * A list of stemming rules in the following format: "word => stem", for example: "ran => run". + */ + @Generated + private List rules; + + /** + * Creates an instance of StemmerOverrideTokenFilter class. + */ + @Generated + public StemmerOverrideTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the rules property: A list of stemming rules in the following format: "word => stem", for example: "ran + * => run". + * + * @return the rules value. + */ + @Generated + public List getRules() { + return this.rules; + } + + /** + * Set the rules property: A list of stemming rules in the following format: "word => stem", for example: "ran + * => run". + * + * @param rules the rules value to set. + * @return the StemmerOverrideTokenFilter object itself. + */ + @Generated + public StemmerOverrideTokenFilter setRules(List rules) { + this.rules = rules; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public StemmerOverrideTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeArrayField("rules", this.rules, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StemmerOverrideTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StemmerOverrideTokenFilter 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 StemmerOverrideTokenFilter. + */ + @Generated + public static StemmerOverrideTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StemmerOverrideTokenFilter deserializedStemmerOverrideTokenFilter = new StemmerOverrideTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedStemmerOverrideTokenFilter.setName(reader.getString()); + } else if ("rules".equals(fieldName)) { + List rules = reader.readArray(reader1 -> reader1.getString()); + deserializedStemmerOverrideTokenFilter.rules = rules; + } else if ("@odata.type".equals(fieldName)) { + deserializedStemmerOverrideTokenFilter.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStemmerOverrideTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StemmerTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StemmerTokenFilter.java new file mode 100644 index 000000000000..0af429d5cc6d --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StemmerTokenFilter.java @@ -0,0 +1,126 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Language specific stemming filter. This token filter is implemented using Apache Lucene. + */ +@Fluent +public final class StemmerTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.StemmerTokenFilter"; + + /* + * The language to use. + */ + @Generated + private StemmerTokenFilterLanguage language; + + /** + * Creates an instance of StemmerTokenFilter class. + */ + @Generated + public StemmerTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the language property: The language to use. + * + * @return the language value. + */ + @Generated + public StemmerTokenFilterLanguage getLanguage() { + return this.language; + } + + /** + * Set the language property: The language to use. + * + * @param language the language value to set. + * @return the StemmerTokenFilter object itself. + */ + @Generated + public StemmerTokenFilter setLanguage(StemmerTokenFilterLanguage language) { + this.language = language; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public StemmerTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("language", this.language == null ? null : this.language.toString()); + jsonWriter.writeStringField("@odata.type", this.odataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StemmerTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StemmerTokenFilter 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 StemmerTokenFilter. + */ + @Generated + public static StemmerTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StemmerTokenFilter deserializedStemmerTokenFilter = new StemmerTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedStemmerTokenFilter.setName(reader.getString()); + } else if ("language".equals(fieldName)) { + deserializedStemmerTokenFilter.language = StemmerTokenFilterLanguage.fromString(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedStemmerTokenFilter.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStemmerTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StemmerTokenFilterLanguage.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StemmerTokenFilterLanguage.java new file mode 100644 index 000000000000..b44b1fce87e6 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StemmerTokenFilterLanguage.java @@ -0,0 +1,317 @@ +// 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.models; + +/** + * The language to use for a stemmer token filter. + */ +public enum StemmerTokenFilterLanguage { + /** + * Selects the Lucene stemming tokenizer for Arabic. + */ + ARABIC("arabic"), + + /** + * Selects the Lucene stemming tokenizer for Armenian. + */ + ARMENIAN("armenian"), + + /** + * Selects the Lucene stemming tokenizer for Basque. + */ + BASQUE("basque"), + + /** + * Selects the Lucene stemming tokenizer for Portuguese (Brazil). + */ + BRAZILIAN("brazilian"), + + /** + * Selects the Lucene stemming tokenizer for Bulgarian. + */ + BULGARIAN("bulgarian"), + + /** + * Selects the Lucene stemming tokenizer for Catalan. + */ + CATALAN("catalan"), + + /** + * Selects the Lucene stemming tokenizer for Czech. + */ + CZECH("czech"), + + /** + * Selects the Lucene stemming tokenizer for Danish. + */ + DANISH("danish"), + + /** + * Selects the Lucene stemming tokenizer for Dutch. + */ + DUTCH("dutch"), + + /** + * Selects the Lucene stemming tokenizer for Dutch that uses the Kraaij-Pohlmann stemming algorithm. + */ + DUTCH_KP("dutchKp"), + + /** + * Selects the Lucene stemming tokenizer for English. + */ + ENGLISH("english"), + + /** + * Selects the Lucene stemming tokenizer for English that does light stemming. + */ + LIGHT_ENGLISH("lightEnglish"), + + /** + * Selects the Lucene stemming tokenizer for English that does minimal stemming. + */ + MINIMAL_ENGLISH("minimalEnglish"), + + /** + * Selects the Lucene stemming tokenizer for English that removes trailing possessives from words. + */ + POSSESSIVE_ENGLISH("possessiveEnglish"), + + /** + * Selects the Lucene stemming tokenizer for English that uses the Porter2 stemming algorithm. + */ + PORTER2("porter2"), + + /** + * Selects the Lucene stemming tokenizer for English that uses the Lovins stemming algorithm. + */ + LOVINS("lovins"), + + /** + * Selects the Lucene stemming tokenizer for Finnish. + */ + FINNISH("finnish"), + + /** + * Selects the Lucene stemming tokenizer for Finnish that does light stemming. + */ + LIGHT_FINNISH("lightFinnish"), + + /** + * Selects the Lucene stemming tokenizer for French. + */ + FRENCH("french"), + + /** + * Selects the Lucene stemming tokenizer for French that does light stemming. + */ + LIGHT_FRENCH("lightFrench"), + + /** + * Selects the Lucene stemming tokenizer for French that does minimal stemming. + */ + MINIMAL_FRENCH("minimalFrench"), + + /** + * Selects the Lucene stemming tokenizer for Galician. + */ + GALICIAN("galician"), + + /** + * Selects the Lucene stemming tokenizer for Galician that does minimal stemming. + */ + MINIMAL_GALICIAN("minimalGalician"), + + /** + * Selects the Lucene stemming tokenizer for German. + */ + GERMAN("german"), + + /** + * Selects the Lucene stemming tokenizer that uses the German variant algorithm. + */ + GERMAN2("german2"), + + /** + * Selects the Lucene stemming tokenizer for German that does light stemming. + */ + LIGHT_GERMAN("lightGerman"), + + /** + * Selects the Lucene stemming tokenizer for German that does minimal stemming. + */ + MINIMAL_GERMAN("minimalGerman"), + + /** + * Selects the Lucene stemming tokenizer for Greek. + */ + GREEK("greek"), + + /** + * Selects the Lucene stemming tokenizer for Hindi. + */ + HINDI("hindi"), + + /** + * Selects the Lucene stemming tokenizer for Hungarian. + */ + HUNGARIAN("hungarian"), + + /** + * Selects the Lucene stemming tokenizer for Hungarian that does light stemming. + */ + LIGHT_HUNGARIAN("lightHungarian"), + + /** + * Selects the Lucene stemming tokenizer for Indonesian. + */ + INDONESIAN("indonesian"), + + /** + * Selects the Lucene stemming tokenizer for Irish. + */ + IRISH("irish"), + + /** + * Selects the Lucene stemming tokenizer for Italian. + */ + ITALIAN("italian"), + + /** + * Selects the Lucene stemming tokenizer for Italian that does light stemming. + */ + LIGHT_ITALIAN("lightItalian"), + + /** + * Selects the Lucene stemming tokenizer for Sorani. + */ + SORANI("sorani"), + + /** + * Selects the Lucene stemming tokenizer for Latvian. + */ + LATVIAN("latvian"), + + /** + * Selects the Lucene stemming tokenizer for Norwegian (Bokmål). + */ + NORWEGIAN("norwegian"), + + /** + * Selects the Lucene stemming tokenizer for Norwegian (Bokmål) that does light stemming. + */ + LIGHT_NORWEGIAN("lightNorwegian"), + + /** + * Selects the Lucene stemming tokenizer for Norwegian (Bokmål) that does minimal stemming. + */ + MINIMAL_NORWEGIAN("minimalNorwegian"), + + /** + * Selects the Lucene stemming tokenizer for Norwegian (Nynorsk) that does light stemming. + */ + LIGHT_NYNORSK("lightNynorsk"), + + /** + * Selects the Lucene stemming tokenizer for Norwegian (Nynorsk) that does minimal stemming. + */ + MINIMAL_NYNORSK("minimalNynorsk"), + + /** + * Selects the Lucene stemming tokenizer for Portuguese. + */ + PORTUGUESE("portuguese"), + + /** + * Selects the Lucene stemming tokenizer for Portuguese that does light stemming. + */ + LIGHT_PORTUGUESE("lightPortuguese"), + + /** + * Selects the Lucene stemming tokenizer for Portuguese that does minimal stemming. + */ + MINIMAL_PORTUGUESE("minimalPortuguese"), + + /** + * Selects the Lucene stemming tokenizer for Portuguese that uses the RSLP stemming algorithm. + */ + PORTUGUESE_RSLP("portugueseRslp"), + + /** + * Selects the Lucene stemming tokenizer for Romanian. + */ + ROMANIAN("romanian"), + + /** + * Selects the Lucene stemming tokenizer for Russian. + */ + RUSSIAN("russian"), + + /** + * Selects the Lucene stemming tokenizer for Russian that does light stemming. + */ + LIGHT_RUSSIAN("lightRussian"), + + /** + * Selects the Lucene stemming tokenizer for Spanish. + */ + SPANISH("spanish"), + + /** + * Selects the Lucene stemming tokenizer for Spanish that does light stemming. + */ + LIGHT_SPANISH("lightSpanish"), + + /** + * Selects the Lucene stemming tokenizer for Swedish. + */ + SWEDISH("swedish"), + + /** + * Selects the Lucene stemming tokenizer for Swedish that does light stemming. + */ + LIGHT_SWEDISH("lightSwedish"), + + /** + * Selects the Lucene stemming tokenizer for Turkish. + */ + TURKISH("turkish"); + + /** + * The actual serialized value for a StemmerTokenFilterLanguage instance. + */ + private final String value; + + StemmerTokenFilterLanguage(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a StemmerTokenFilterLanguage instance. + * + * @param value the serialized value to parse. + * @return the parsed StemmerTokenFilterLanguage object, or null if unable to parse. + */ + public static StemmerTokenFilterLanguage fromString(String value) { + if (value == null) { + return null; + } + StemmerTokenFilterLanguage[] items = StemmerTokenFilterLanguage.values(); + for (StemmerTokenFilterLanguage item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StopAnalyzer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StopAnalyzer.java new file mode 100644 index 000000000000..15b103b60c10 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StopAnalyzer.java @@ -0,0 +1,129 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Divides text at non-letters; Applies the lowercase and stopword token filters. This analyzer is implemented using + * Apache Lucene. + */ +@Fluent +public final class StopAnalyzer extends LexicalAnalyzer { + /* + * A URI fragment specifying the type of analyzer. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.StopAnalyzer"; + + /* + * A list of stopwords. + */ + @Generated + private List stopwords; + + /** + * Creates an instance of StopAnalyzer class. + */ + @Generated + public StopAnalyzer() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of analyzer. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the stopwords property: A list of stopwords. + * + * @return the stopwords value. + */ + @Generated + public List getStopwords() { + return this.stopwords; + } + + /** + * Set the stopwords property: A list of stopwords. + * + * @param stopwords the stopwords value to set. + * @return the StopAnalyzer object itself. + */ + @Generated + public StopAnalyzer setStopwords(List stopwords) { + this.stopwords = stopwords; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public StopAnalyzer setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeArrayField("stopwords", this.stopwords, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StopAnalyzer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StopAnalyzer 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 StopAnalyzer. + */ + @Generated + public static StopAnalyzer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StopAnalyzer deserializedStopAnalyzer = new StopAnalyzer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedStopAnalyzer.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedStopAnalyzer.odataType = reader.getString(); + } else if ("stopwords".equals(fieldName)) { + List stopwords = reader.readArray(reader1 -> reader1.getString()); + deserializedStopAnalyzer.stopwords = stopwords; + } else { + reader.skipChildren(); + } + } + + return deserializedStopAnalyzer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StopwordsList.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StopwordsList.java new file mode 100644 index 000000000000..5511aac43a69 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StopwordsList.java @@ -0,0 +1,202 @@ +// 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.models; + +/** + * Identifies a predefined list of language-specific stopwords. + */ +public enum StopwordsList { + /** + * Selects the stopword list for Arabic. + */ + ARABIC("arabic"), + + /** + * Selects the stopword list for Armenian. + */ + ARMENIAN("armenian"), + + /** + * Selects the stopword list for Basque. + */ + BASQUE("basque"), + + /** + * Selects the stopword list for Portuguese (Brazil). + */ + BRAZILIAN("brazilian"), + + /** + * Selects the stopword list for Bulgarian. + */ + BULGARIAN("bulgarian"), + + /** + * Selects the stopword list for Catalan. + */ + CATALAN("catalan"), + + /** + * Selects the stopword list for Czech. + */ + CZECH("czech"), + + /** + * Selects the stopword list for Danish. + */ + DANISH("danish"), + + /** + * Selects the stopword list for Dutch. + */ + DUTCH("dutch"), + + /** + * Selects the stopword list for English. + */ + ENGLISH("english"), + + /** + * Selects the stopword list for Finnish. + */ + FINNISH("finnish"), + + /** + * Selects the stopword list for French. + */ + FRENCH("french"), + + /** + * Selects the stopword list for Galician. + */ + GALICIAN("galician"), + + /** + * Selects the stopword list for German. + */ + GERMAN("german"), + + /** + * Selects the stopword list for Greek. + */ + GREEK("greek"), + + /** + * Selects the stopword list for Hindi. + */ + HINDI("hindi"), + + /** + * Selects the stopword list for Hungarian. + */ + HUNGARIAN("hungarian"), + + /** + * Selects the stopword list for Indonesian. + */ + INDONESIAN("indonesian"), + + /** + * Selects the stopword list for Irish. + */ + IRISH("irish"), + + /** + * Selects the stopword list for Italian. + */ + ITALIAN("italian"), + + /** + * Selects the stopword list for Latvian. + */ + LATVIAN("latvian"), + + /** + * Selects the stopword list for Norwegian. + */ + NORWEGIAN("norwegian"), + + /** + * Selects the stopword list for Persian. + */ + PERSIAN("persian"), + + /** + * Selects the stopword list for Portuguese. + */ + PORTUGUESE("portuguese"), + + /** + * Selects the stopword list for Romanian. + */ + ROMANIAN("romanian"), + + /** + * Selects the stopword list for Russian. + */ + RUSSIAN("russian"), + + /** + * Selects the stopword list for Sorani. + */ + SORANI("sorani"), + + /** + * Selects the stopword list for Spanish. + */ + SPANISH("spanish"), + + /** + * Selects the stopword list for Swedish. + */ + SWEDISH("swedish"), + + /** + * Selects the stopword list for Thai. + */ + THAI("thai"), + + /** + * Selects the stopword list for Turkish. + */ + TURKISH("turkish"); + + /** + * The actual serialized value for a StopwordsList instance. + */ + private final String value; + + StopwordsList(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a StopwordsList instance. + * + * @param value the serialized value to parse. + * @return the parsed StopwordsList object, or null if unable to parse. + */ + public static StopwordsList fromString(String value) { + if (value == null) { + return null; + } + StopwordsList[] items = StopwordsList.values(); + for (StopwordsList item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StopwordsTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StopwordsTokenFilter.java new file mode 100644 index 000000000000..e1b5a9b8903c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/StopwordsTokenFilter.java @@ -0,0 +1,232 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Removes stop words from a token stream. This token filter is implemented using Apache Lucene. + */ +@Fluent +public final class StopwordsTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.StopwordsTokenFilter"; + + /* + * The list of stopwords. This property and the stopwords list property cannot both be set. + */ + @Generated + private List stopwords; + + /* + * A predefined list of stopwords to use. This property and the stopwords property cannot both be set. Default is + * English. + */ + @Generated + private StopwordsList stopwordsList; + + /* + * A value indicating whether to ignore case. If true, all words are converted to lower case first. Default is + * false. + */ + @Generated + private Boolean ignoreCase; + + /* + * A value indicating whether to ignore the last search term if it's a stop word. Default is true. + */ + @Generated + private Boolean removeTrailingStopWords; + + /** + * Creates an instance of StopwordsTokenFilter class. + */ + @Generated + public StopwordsTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the stopwords property: The list of stopwords. This property and the stopwords list property cannot both be + * set. + * + * @return the stopwords value. + */ + @Generated + public List getStopwords() { + return this.stopwords; + } + + /** + * Set the stopwords property: The list of stopwords. This property and the stopwords list property cannot both be + * set. + * + * @param stopwords the stopwords value to set. + * @return the StopwordsTokenFilter object itself. + */ + @Generated + public StopwordsTokenFilter setStopwords(List stopwords) { + this.stopwords = stopwords; + return this; + } + + /** + * Get the stopwordsList property: A predefined list of stopwords to use. This property and the stopwords property + * cannot both be set. Default is English. + * + * @return the stopwordsList value. + */ + @Generated + public StopwordsList getStopwordsList() { + return this.stopwordsList; + } + + /** + * Set the stopwordsList property: A predefined list of stopwords to use. This property and the stopwords property + * cannot both be set. Default is English. + * + * @param stopwordsList the stopwordsList value to set. + * @return the StopwordsTokenFilter object itself. + */ + @Generated + public StopwordsTokenFilter setStopwordsList(StopwordsList stopwordsList) { + this.stopwordsList = stopwordsList; + return this; + } + + /** + * Get the ignoreCase property: A value indicating whether to ignore case. If true, all words are converted to lower + * case first. Default is false. + * + * @return the ignoreCase value. + */ + @Generated + public Boolean isIgnoreCase() { + return this.ignoreCase; + } + + /** + * Set the ignoreCase property: A value indicating whether to ignore case. If true, all words are converted to lower + * case first. Default is false. + * + * @param ignoreCase the ignoreCase value to set. + * @return the StopwordsTokenFilter object itself. + */ + @Generated + public StopwordsTokenFilter setIgnoreCase(Boolean ignoreCase) { + this.ignoreCase = ignoreCase; + return this; + } + + /** + * Get the removeTrailingStopWords property: A value indicating whether to ignore the last search term if it's a + * stop word. Default is true. + * + * @return the removeTrailingStopWords value. + */ + @Generated + public Boolean isRemoveTrailingStopWords() { + return this.removeTrailingStopWords; + } + + /** + * Set the removeTrailingStopWords property: A value indicating whether to ignore the last search term if it's a + * stop word. Default is true. + * + * @param removeTrailingStopWords the removeTrailingStopWords value to set. + * @return the StopwordsTokenFilter object itself. + */ + @Generated + public StopwordsTokenFilter setRemoveTrailingStopWords(Boolean removeTrailingStopWords) { + this.removeTrailingStopWords = removeTrailingStopWords; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public StopwordsTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeArrayField("stopwords", this.stopwords, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("stopwordsList", this.stopwordsList == null ? null : this.stopwordsList.toString()); + jsonWriter.writeBooleanField("ignoreCase", this.ignoreCase); + jsonWriter.writeBooleanField("removeTrailing", this.removeTrailingStopWords); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StopwordsTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StopwordsTokenFilter 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 StopwordsTokenFilter. + */ + @Generated + public static StopwordsTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StopwordsTokenFilter deserializedStopwordsTokenFilter = new StopwordsTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedStopwordsTokenFilter.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedStopwordsTokenFilter.odataType = reader.getString(); + } else if ("stopwords".equals(fieldName)) { + List stopwords = reader.readArray(reader1 -> reader1.getString()); + deserializedStopwordsTokenFilter.stopwords = stopwords; + } else if ("stopwordsList".equals(fieldName)) { + deserializedStopwordsTokenFilter.stopwordsList = StopwordsList.fromString(reader.getString()); + } else if ("ignoreCase".equals(fieldName)) { + deserializedStopwordsTokenFilter.ignoreCase = reader.getNullable(JsonReader::getBoolean); + } else if ("removeTrailing".equals(fieldName)) { + deserializedStopwordsTokenFilter.removeTrailingStopWords + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedStopwordsTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SuggestDocumentsResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SuggestDocumentsResult.java new file mode 100644 index 000000000000..8215ff4297dc --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SuggestDocumentsResult.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.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Response containing suggestion query results from an index. + */ +@Immutable +public final class SuggestDocumentsResult implements JsonSerializable { + /* + * The sequence of results returned by the query. + */ + @Generated + private List results; + + /* + * A value indicating the percentage of the index that was included in the query, or null if minimumCoverage was not + * set in the request. + */ + @Generated + private Double coverage; + + /** + * Creates an instance of SuggestDocumentsResult class. + */ + @Generated + public SuggestDocumentsResult() { + } + + /** + * Get the results property: The sequence of results returned by the query. + * + * @return the results value. + */ + @Generated + public List getResults() { + return this.results; + } + + /** + * Get the coverage property: A value indicating the percentage of the index that was included in the query, or null + * if minimumCoverage was not set in the request. + * + * @return the coverage value. + */ + @Generated + public Double getCoverage() { + return this.coverage; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SuggestDocumentsResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SuggestDocumentsResult 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 SuggestDocumentsResult. + */ + @Generated + public static SuggestDocumentsResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SuggestDocumentsResult deserializedSuggestDocumentsResult = new SuggestDocumentsResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List results = reader.readArray(reader1 -> SuggestResult.fromJson(reader1)); + deserializedSuggestDocumentsResult.results = results; + } else if ("@search.coverage".equals(fieldName)) { + deserializedSuggestDocumentsResult.coverage = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedSuggestDocumentsResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SuggestOptions.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SuggestOptions.java new file mode 100644 index 000000000000..78ee1c2d2b65 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SuggestOptions.java @@ -0,0 +1,315 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import java.util.List; + +/** + * Parameter group. + */ +@Fluent +public final class SuggestOptions { + /* + * An OData expression that filters the documents considered for suggestions. + */ + @Generated + private String filter; + + /* + * A value indicating whether to use fuzzy matching for the suggestions query. Default is false. When set to true, + * the query will find terms even if there's a substituted or missing character in the search text. While this + * provides a better experience in some scenarios, it comes at a performance cost as fuzzy suggestions queries are + * slower and consume more resources. + */ + @Generated + private Boolean useFuzzyMatching; + + /* + * A string tag that is appended to hit highlights. Must be set with highlightPreTag. If omitted, hit highlighting + * of suggestions is disabled. + */ + @Generated + private String highlightPostTag; + + /* + * A string tag that is prepended to hit highlights. Must be set with highlightPostTag. If omitted, hit highlighting + * of suggestions is disabled. + */ + @Generated + private String highlightPreTag; + + /* + * A number between 0 and 100 indicating the percentage of the index that must be covered by a suggestions query in + * order for the query to be reported as a success. This parameter can be useful for ensuring search availability + * even for services with only one replica. The default is 80. + */ + @Generated + private Double minimumCoverage; + + /* + * The list of OData $orderby expressions by which to sort the results. Each expression can be either a field name + * or a call to either the geo.distance() or the search.score() functions. Each expression can be followed by asc to + * indicate ascending, or desc to indicate descending. The default is ascending order. Ties will be broken by the + * match scores of documents. If no $orderby is specified, the default sort order is descending by document match + * score. There can be at most 32 $orderby clauses. + */ + @Generated + private List orderBy; + + /* + * The list of field names to search for the specified search text. Target fields must be included in the specified + * suggester. + */ + @Generated + private List searchFields; + + /* + * The list of fields to retrieve. If unspecified, only the key field will be included in the results. + */ + @Generated + private List select; + + /* + * The number of suggestions to retrieve. The value must be a number between 1 and 100. The default is 5. + */ + @Generated + private Integer top; + + /** + * Creates an instance of SuggestOptions class. + */ + @Generated + public SuggestOptions() { + } + + /** + * Get the filter property: An OData expression that filters the documents considered for suggestions. + * + * @return the filter value. + */ + @Generated + public String getFilter() { + return this.filter; + } + + /** + * Set the filter property: An OData expression that filters the documents considered for suggestions. + * + * @param filter the filter value to set. + * @return the SuggestOptions object itself. + */ + @Generated + public SuggestOptions setFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get the useFuzzyMatching property: A value indicating whether to use fuzzy matching for the suggestions query. + * Default is false. When set to true, the query will find terms even if there's a substituted or missing character + * in the search text. While this provides a better experience in some scenarios, it comes at a performance cost as + * fuzzy suggestions queries are slower and consume more resources. + * + * @return the useFuzzyMatching value. + */ + @Generated + public Boolean isUseFuzzyMatching() { + return this.useFuzzyMatching; + } + + /** + * Set the useFuzzyMatching property: A value indicating whether to use fuzzy matching for the suggestions query. + * Default is false. When set to true, the query will find terms even if there's a substituted or missing character + * in the search text. While this provides a better experience in some scenarios, it comes at a performance cost as + * fuzzy suggestions queries are slower and consume more resources. + * + * @param useFuzzyMatching the useFuzzyMatching value to set. + * @return the SuggestOptions object itself. + */ + @Generated + public SuggestOptions setUseFuzzyMatching(Boolean useFuzzyMatching) { + this.useFuzzyMatching = useFuzzyMatching; + return this; + } + + /** + * Get the highlightPostTag property: A string tag that is appended to hit highlights. Must be set with + * highlightPreTag. If omitted, hit highlighting of suggestions is disabled. + * + * @return the highlightPostTag value. + */ + @Generated + public String getHighlightPostTag() { + return this.highlightPostTag; + } + + /** + * Set the highlightPostTag property: A string tag that is appended to hit highlights. Must be set with + * highlightPreTag. If omitted, hit highlighting of suggestions is disabled. + * + * @param highlightPostTag the highlightPostTag value to set. + * @return the SuggestOptions object itself. + */ + @Generated + public SuggestOptions setHighlightPostTag(String highlightPostTag) { + this.highlightPostTag = highlightPostTag; + return this; + } + + /** + * Get the highlightPreTag property: A string tag that is prepended to hit highlights. Must be set with + * highlightPostTag. If omitted, hit highlighting of suggestions is disabled. + * + * @return the highlightPreTag value. + */ + @Generated + public String getHighlightPreTag() { + return this.highlightPreTag; + } + + /** + * Set the highlightPreTag property: A string tag that is prepended to hit highlights. Must be set with + * highlightPostTag. If omitted, hit highlighting of suggestions is disabled. + * + * @param highlightPreTag the highlightPreTag value to set. + * @return the SuggestOptions object itself. + */ + @Generated + public SuggestOptions setHighlightPreTag(String highlightPreTag) { + this.highlightPreTag = highlightPreTag; + return this; + } + + /** + * Get the minimumCoverage property: A number between 0 and 100 indicating the percentage of the index that must be + * covered by a suggestions query in order for the query to be reported as a success. This parameter can be useful + * for ensuring search availability even for services with only one replica. The default is 80. + * + * @return the minimumCoverage value. + */ + @Generated + public Double getMinimumCoverage() { + return this.minimumCoverage; + } + + /** + * Set the minimumCoverage property: A number between 0 and 100 indicating the percentage of the index that must be + * covered by a suggestions query in order for the query to be reported as a success. This parameter can be useful + * for ensuring search availability even for services with only one replica. The default is 80. + * + * @param minimumCoverage the minimumCoverage value to set. + * @return the SuggestOptions object itself. + */ + @Generated + public SuggestOptions setMinimumCoverage(Double minimumCoverage) { + this.minimumCoverage = minimumCoverage; + return this; + } + + /** + * Get the orderBy property: The list of OData $orderby expressions by which to sort the results. Each expression + * can be either a field name or a call to either the geo.distance() or the search.score() functions. Each + * expression can be followed by asc to indicate ascending, or desc to indicate descending. The default is ascending + * order. Ties will be broken by the match scores of documents. If no $orderby is specified, the default sort order + * is descending by document match score. There can be at most 32 $orderby clauses. + * + * @return the orderBy value. + */ + @Generated + public List getOrderBy() { + return this.orderBy; + } + + /** + * Set the orderBy property: The list of OData $orderby expressions by which to sort the results. Each expression + * can be either a field name or a call to either the geo.distance() or the search.score() functions. Each + * expression can be followed by asc to indicate ascending, or desc to indicate descending. The default is ascending + * order. Ties will be broken by the match scores of documents. If no $orderby is specified, the default sort order + * is descending by document match score. There can be at most 32 $orderby clauses. + * + * @param orderBy the orderBy value to set. + * @return the SuggestOptions object itself. + */ + @Generated + public SuggestOptions setOrderBy(List orderBy) { + this.orderBy = orderBy; + return this; + } + + /** + * Get the searchFields property: The list of field names to search for the specified search text. Target fields + * must be included in the specified suggester. + * + * @return the searchFields value. + */ + @Generated + public List getSearchFields() { + return this.searchFields; + } + + /** + * Set the searchFields property: The list of field names to search for the specified search text. Target fields + * must be included in the specified suggester. + * + * @param searchFields the searchFields value to set. + * @return the SuggestOptions object itself. + */ + @Generated + public SuggestOptions setSearchFields(List searchFields) { + this.searchFields = searchFields; + return this; + } + + /** + * Get the select property: The list of fields to retrieve. If unspecified, only the key field will be included in + * the results. + * + * @return the select value. + */ + @Generated + public List getSelect() { + return this.select; + } + + /** + * Set the select property: The list of fields to retrieve. If unspecified, only the key field will be included in + * the results. + * + * @param select the select value to set. + * @return the SuggestOptions object itself. + */ + @Generated + public SuggestOptions setSelect(List select) { + this.select = select; + return this; + } + + /** + * Get the top property: The number of suggestions to retrieve. The value must be a number between 1 and 100. The + * default is 5. + * + * @return the top value. + */ + @Generated + public Integer getTop() { + return this.top; + } + + /** + * Set the top property: The number of suggestions to retrieve. The value must be a number between 1 and 100. The + * default is 5. + * + * @param top the top value to set. + * @return the SuggestOptions object itself. + */ + @Generated + public SuggestOptions setTop(Integer top) { + this.top = top; + return this; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SuggestRequest.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SuggestRequest.java new file mode 100644 index 000000000000..32ec64052476 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SuggestRequest.java @@ -0,0 +1,449 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Parameters for filtering, sorting, fuzzy matching, and other suggestions query behaviors. + */ +@Fluent +public final class SuggestRequest implements JsonSerializable { + /* + * An OData expression that filters the documents considered for suggestions. + */ + @Generated + private String filter; + + /* + * A value indicating whether to use fuzzy matching for the suggestion query. Default is false. When set to true, + * the query will find suggestions even if there's a substituted or missing character in the search text. While this + * provides a better experience in some scenarios, it comes at a performance cost as fuzzy suggestion searches are + * slower and consume more resources. + */ + @Generated + private Boolean useFuzzyMatching; + + /* + * A string tag that is appended to hit highlights. Must be set with highlightPreTag. If omitted, hit highlighting + * of suggestions is disabled. + */ + @Generated + private String highlightPostTag; + + /* + * A string tag that is prepended to hit highlights. Must be set with highlightPostTag. If omitted, hit highlighting + * of suggestions is disabled. + */ + @Generated + private String highlightPreTag; + + /* + * A number between 0 and 100 indicating the percentage of the index that must be covered by a suggestion query in + * order for the query to be reported as a success. This parameter can be useful for ensuring search availability + * even for services with only one replica. The default is 80. + */ + @Generated + private Double minimumCoverage; + + /* + * The comma-separated list of OData $orderby expressions by which to sort the results. Each expression can be + * either a field name or a call to either the geo.distance() or the search.score() functions. Each expression can + * be followed by asc to indicate ascending, or desc to indicate descending. The default is ascending order. Ties + * will be broken by the match scores of documents. If no $orderby is specified, the default sort order is + * descending by document match score. There can be at most 32 $orderby clauses. + */ + @Generated + private String orderBy; + + /* + * The search text to use to suggest documents. Must be at least 1 character, and no more than 100 characters. + */ + @Generated + private String searchText; + + /* + * The comma-separated list of field names to search for the specified search text. Target fields must be included + * in the specified suggester. + */ + @Generated + private String searchFields; + + /* + * The comma-separated list of fields to retrieve. If unspecified, only the key field will be included in the + * results. + */ + @Generated + private String select; + + /* + * The name of the suggester as specified in the suggesters collection that's part of the index definition. + */ + @Generated + private String suggesterName; + + /* + * The number of suggestions to retrieve. This must be a value between 1 and 100. The default is 5. + */ + @Generated + private Integer top; + + /** + * Creates an instance of SuggestRequest class. + */ + @Generated + public SuggestRequest() { + } + + /** + * Get the filter property: An OData expression that filters the documents considered for suggestions. + * + * @return the filter value. + */ + @Generated + public String getFilter() { + return this.filter; + } + + /** + * Set the filter property: An OData expression that filters the documents considered for suggestions. + * + * @param filter the filter value to set. + * @return the SuggestRequest object itself. + */ + @Generated + public SuggestRequest setFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get the useFuzzyMatching property: A value indicating whether to use fuzzy matching for the suggestion query. + * Default is false. When set to true, the query will find suggestions even if there's a substituted or missing + * character in the search text. While this provides a better experience in some scenarios, it comes at a + * performance cost as fuzzy suggestion searches are slower and consume more resources. + * + * @return the useFuzzyMatching value. + */ + @Generated + public Boolean isUseFuzzyMatching() { + return this.useFuzzyMatching; + } + + /** + * Set the useFuzzyMatching property: A value indicating whether to use fuzzy matching for the suggestion query. + * Default is false. When set to true, the query will find suggestions even if there's a substituted or missing + * character in the search text. While this provides a better experience in some scenarios, it comes at a + * performance cost as fuzzy suggestion searches are slower and consume more resources. + * + * @param useFuzzyMatching the useFuzzyMatching value to set. + * @return the SuggestRequest object itself. + */ + @Generated + public SuggestRequest setUseFuzzyMatching(Boolean useFuzzyMatching) { + this.useFuzzyMatching = useFuzzyMatching; + return this; + } + + /** + * Get the highlightPostTag property: A string tag that is appended to hit highlights. Must be set with + * highlightPreTag. If omitted, hit highlighting of suggestions is disabled. + * + * @return the highlightPostTag value. + */ + @Generated + public String getHighlightPostTag() { + return this.highlightPostTag; + } + + /** + * Set the highlightPostTag property: A string tag that is appended to hit highlights. Must be set with + * highlightPreTag. If omitted, hit highlighting of suggestions is disabled. + * + * @param highlightPostTag the highlightPostTag value to set. + * @return the SuggestRequest object itself. + */ + @Generated + public SuggestRequest setHighlightPostTag(String highlightPostTag) { + this.highlightPostTag = highlightPostTag; + return this; + } + + /** + * Get the highlightPreTag property: A string tag that is prepended to hit highlights. Must be set with + * highlightPostTag. If omitted, hit highlighting of suggestions is disabled. + * + * @return the highlightPreTag value. + */ + @Generated + public String getHighlightPreTag() { + return this.highlightPreTag; + } + + /** + * Set the highlightPreTag property: A string tag that is prepended to hit highlights. Must be set with + * highlightPostTag. If omitted, hit highlighting of suggestions is disabled. + * + * @param highlightPreTag the highlightPreTag value to set. + * @return the SuggestRequest object itself. + */ + @Generated + public SuggestRequest setHighlightPreTag(String highlightPreTag) { + this.highlightPreTag = highlightPreTag; + return this; + } + + /** + * Get the minimumCoverage property: A number between 0 and 100 indicating the percentage of the index that must be + * covered by a suggestion query in order for the query to be reported as a success. This parameter can be useful + * for ensuring search availability even for services with only one replica. The default is 80. + * + * @return the minimumCoverage value. + */ + @Generated + public Double getMinimumCoverage() { + return this.minimumCoverage; + } + + /** + * Set the minimumCoverage property: A number between 0 and 100 indicating the percentage of the index that must be + * covered by a suggestion query in order for the query to be reported as a success. This parameter can be useful + * for ensuring search availability even for services with only one replica. The default is 80. + * + * @param minimumCoverage the minimumCoverage value to set. + * @return the SuggestRequest object itself. + */ + @Generated + public SuggestRequest setMinimumCoverage(Double minimumCoverage) { + this.minimumCoverage = minimumCoverage; + return this; + } + + /** + * Get the orderBy property: The comma-separated list of OData $orderby expressions by which to sort the results. + * Each expression can be either a field name or a call to either the geo.distance() or the search.score() + * functions. Each expression can be followed by asc to indicate ascending, or desc to indicate descending. The + * default is ascending order. Ties will be broken by the match scores of documents. If no $orderby is specified, + * the default sort order is descending by document match score. There can be at most 32 $orderby clauses. + * + * @return the orderBy value. + */ + @Generated + public String getOrderBy() { + return this.orderBy; + } + + /** + * Set the orderBy property: The comma-separated list of OData $orderby expressions by which to sort the results. + * Each expression can be either a field name or a call to either the geo.distance() or the search.score() + * functions. Each expression can be followed by asc to indicate ascending, or desc to indicate descending. The + * default is ascending order. Ties will be broken by the match scores of documents. If no $orderby is specified, + * the default sort order is descending by document match score. There can be at most 32 $orderby clauses. + * + * @param orderBy the orderBy value to set. + * @return the SuggestRequest object itself. + */ + @Generated + public SuggestRequest setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + /** + * Get the searchText property: The search text to use to suggest documents. Must be at least 1 character, and no + * more than 100 characters. + * + * @return the searchText value. + */ + @Generated + public String getSearchText() { + return this.searchText; + } + + /** + * Set the searchText property: The search text to use to suggest documents. Must be at least 1 character, and no + * more than 100 characters. + * + * @param searchText the searchText value to set. + * @return the SuggestRequest object itself. + */ + @Generated + public SuggestRequest setSearchText(String searchText) { + this.searchText = searchText; + return this; + } + + /** + * Get the searchFields property: The comma-separated list of field names to search for the specified search text. + * Target fields must be included in the specified suggester. + * + * @return the searchFields value. + */ + @Generated + public String getSearchFields() { + return this.searchFields; + } + + /** + * Set the searchFields property: The comma-separated list of field names to search for the specified search text. + * Target fields must be included in the specified suggester. + * + * @param searchFields the searchFields value to set. + * @return the SuggestRequest object itself. + */ + @Generated + public SuggestRequest setSearchFields(String searchFields) { + this.searchFields = searchFields; + return this; + } + + /** + * Get the select property: The comma-separated list of fields to retrieve. If unspecified, only the key field will + * be included in the results. + * + * @return the select value. + */ + @Generated + public String getSelect() { + return this.select; + } + + /** + * Set the select property: The comma-separated list of fields to retrieve. If unspecified, only the key field will + * be included in the results. + * + * @param select the select value to set. + * @return the SuggestRequest object itself. + */ + @Generated + public SuggestRequest setSelect(String select) { + this.select = select; + return this; + } + + /** + * Get the suggesterName property: The name of the suggester as specified in the suggesters collection that's part + * of the index definition. + * + * @return the suggesterName value. + */ + @Generated + public String getSuggesterName() { + return this.suggesterName; + } + + /** + * Set the suggesterName property: The name of the suggester as specified in the suggesters collection that's part + * of the index definition. + * + * @param suggesterName the suggesterName value to set. + * @return the SuggestRequest object itself. + */ + @Generated + public SuggestRequest setSuggesterName(String suggesterName) { + this.suggesterName = suggesterName; + return this; + } + + /** + * Get the top property: The number of suggestions to retrieve. This must be a value between 1 and 100. The default + * is 5. + * + * @return the top value. + */ + @Generated + public Integer getTop() { + return this.top; + } + + /** + * Set the top property: The number of suggestions to retrieve. This must be a value between 1 and 100. The default + * is 5. + * + * @param top the top value to set. + * @return the SuggestRequest object itself. + */ + @Generated + public SuggestRequest setTop(Integer top) { + this.top = top; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("search", this.searchText); + jsonWriter.writeStringField("suggesterName", this.suggesterName); + jsonWriter.writeStringField("filter", this.filter); + jsonWriter.writeBooleanField("fuzzy", this.useFuzzyMatching); + jsonWriter.writeStringField("highlightPostTag", this.highlightPostTag); + jsonWriter.writeStringField("highlightPreTag", this.highlightPreTag); + jsonWriter.writeNumberField("minimumCoverage", this.minimumCoverage); + jsonWriter.writeStringField("orderby", this.orderBy); + jsonWriter.writeStringField("searchFields", this.searchFields); + jsonWriter.writeStringField("select", this.select); + jsonWriter.writeNumberField("top", this.top); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SuggestRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SuggestRequest 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 SuggestRequest. + */ + @Generated + public static SuggestRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SuggestRequest deserializedSuggestRequest = new SuggestRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("search".equals(fieldName)) { + deserializedSuggestRequest.searchText = reader.getString(); + } else if ("suggesterName".equals(fieldName)) { + deserializedSuggestRequest.suggesterName = reader.getString(); + } else if ("filter".equals(fieldName)) { + deserializedSuggestRequest.filter = reader.getString(); + } else if ("fuzzy".equals(fieldName)) { + deserializedSuggestRequest.useFuzzyMatching = reader.getNullable(JsonReader::getBoolean); + } else if ("highlightPostTag".equals(fieldName)) { + deserializedSuggestRequest.highlightPostTag = reader.getString(); + } else if ("highlightPreTag".equals(fieldName)) { + deserializedSuggestRequest.highlightPreTag = reader.getString(); + } else if ("minimumCoverage".equals(fieldName)) { + deserializedSuggestRequest.minimumCoverage = reader.getNullable(JsonReader::getDouble); + } else if ("orderby".equals(fieldName)) { + deserializedSuggestRequest.orderBy = reader.getString(); + } else if ("searchFields".equals(fieldName)) { + deserializedSuggestRequest.searchFields = reader.getString(); + } else if ("select".equals(fieldName)) { + deserializedSuggestRequest.select = reader.getString(); + } else if ("top".equals(fieldName)) { + deserializedSuggestRequest.top = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedSuggestRequest; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SuggestResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SuggestResult.java new file mode 100644 index 000000000000..8ff7a8065dad --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SuggestResult.java @@ -0,0 +1,124 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.LinkedHashMap; +import java.util.Map; + +/** + * A result containing a document found by a suggestion query, plus associated metadata. + */ +@Fluent +public final class SuggestResult implements JsonSerializable { + /* + * The text of the suggestion result. + */ + @Generated + private String text; + + /* + * A result containing a document found by a suggestion query, plus associated metadata. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of SuggestResult class. + */ + @Generated + public SuggestResult() { + } + + /** + * Get the text property: The text of the suggestion result. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Get the additionalProperties property: A result containing a document found by a suggestion query, plus + * associated metadata. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: A result containing a document found by a suggestion query, plus + * associated metadata. + * + * @param additionalProperties the additionalProperties value to set. + * @return the SuggestResult object itself. + */ + @Generated + public SuggestResult setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SuggestResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SuggestResult 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 SuggestResult. + */ + @Generated + public static SuggestResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SuggestResult deserializedSuggestResult = new SuggestResult(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("@search.text".equals(fieldName)) { + deserializedSuggestResult.text = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedSuggestResult.additionalProperties = additionalProperties; + + return deserializedSuggestResult; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/Suggester.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/Suggester.java new file mode 100644 index 000000000000..b305ec339f5f --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/Suggester.java @@ -0,0 +1,146 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Defines how the Suggest API should apply to a group of fields in the index. + */ +@Fluent +public final class Suggester implements JsonSerializable { + /* + * The name of the suggester. + */ + @Generated + private String name; + + /* + * A value indicating the capabilities of the suggester. + */ + @Generated + private final String searchMode = "analyzingInfixMatching"; + + /* + * The list of field names to which the suggester applies. Each field must be searchable. + */ + @Generated + private List sourceFields; + + /** + * Creates an instance of Suggester class. + */ + @Generated + public Suggester() { + } + + /** + * Get the name property: The name of the suggester. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the suggester. + * + * @param name the name value to set. + * @return the Suggester object itself. + */ + @Generated + public Suggester setName(String name) { + this.name = name; + return this; + } + + /** + * Get the searchMode property: A value indicating the capabilities of the suggester. + * + * @return the searchMode value. + */ + @Generated + public String getSearchMode() { + return this.searchMode; + } + + /** + * Get the sourceFields property: The list of field names to which the suggester applies. Each field must be + * searchable. + * + * @return the sourceFields value. + */ + @Generated + public List getSourceFields() { + return this.sourceFields; + } + + /** + * Set the sourceFields property: The list of field names to which the suggester applies. Each field must be + * searchable. + * + * @param sourceFields the sourceFields value to set. + * @return the Suggester object itself. + */ + @Generated + public Suggester setSourceFields(List sourceFields) { + this.sourceFields = sourceFields; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("searchMode", this.searchMode); + jsonWriter.writeArrayField("sourceFields", this.sourceFields, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Suggester from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Suggester 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 Suggester. + */ + @Generated + public static Suggester fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Suggester deserializedSuggester = new Suggester(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSuggester.name = reader.getString(); + } else if ("sourceFields".equals(fieldName)) { + List sourceFields = reader.readArray(reader1 -> reader1.getString()); + deserializedSuggester.sourceFields = sourceFields; + } else { + reader.skipChildren(); + } + } + + return deserializedSuggester; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SynchronizationState.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SynchronizationState.java new file mode 100644 index 000000000000..64e91f36b291 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SynchronizationState.java @@ -0,0 +1,194 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Represents the current state of an ongoing synchronization that spans multiple indexer runs. + */ +@Fluent +public final class SynchronizationState implements JsonSerializable { + /* + * The start time of the current synchronization. + */ + @Generated + private OffsetDateTime startTime; + + /* + * The number of item updates successfully processed in the current synchronization. + */ + @Generated + private int itemsUpdatesProcessed; + + /* + * The number of item updates that failed in the current synchronization. + */ + @Generated + private int itemsUpdatesFailed; + + /* + * The number of items skipped in the current synchronization. + */ + @Generated + private int itemsSkipped; + + /** + * Creates an instance of SynchronizationState class. + */ + @Generated + public SynchronizationState() { + } + + /** + * Get the startTime property: The start time of the current synchronization. + * + * @return the startTime value. + */ + @Generated + public OffsetDateTime getStartTime() { + return this.startTime; + } + + /** + * Set the startTime property: The start time of the current synchronization. + * + * @param startTime the startTime value to set. + * @return the SynchronizationState object itself. + */ + @Generated + public SynchronizationState setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the itemsUpdatesProcessed property: The number of item updates successfully processed in the current + * synchronization. + * + * @return the itemsUpdatesProcessed value. + */ + @Generated + public int getItemsUpdatesProcessed() { + return this.itemsUpdatesProcessed; + } + + /** + * Set the itemsUpdatesProcessed property: The number of item updates successfully processed in the current + * synchronization. + * + * @param itemsUpdatesProcessed the itemsUpdatesProcessed value to set. + * @return the SynchronizationState object itself. + */ + @Generated + public SynchronizationState setItemsUpdatesProcessed(int itemsUpdatesProcessed) { + this.itemsUpdatesProcessed = itemsUpdatesProcessed; + return this; + } + + /** + * Get the itemsUpdatesFailed property: The number of item updates that failed in the current synchronization. + * + * @return the itemsUpdatesFailed value. + */ + @Generated + public int getItemsUpdatesFailed() { + return this.itemsUpdatesFailed; + } + + /** + * Set the itemsUpdatesFailed property: The number of item updates that failed in the current synchronization. + * + * @param itemsUpdatesFailed the itemsUpdatesFailed value to set. + * @return the SynchronizationState object itself. + */ + @Generated + public SynchronizationState setItemsUpdatesFailed(int itemsUpdatesFailed) { + this.itemsUpdatesFailed = itemsUpdatesFailed; + return this; + } + + /** + * Get the itemsSkipped property: The number of items skipped in the current synchronization. + * + * @return the itemsSkipped value. + */ + @Generated + public int getItemsSkipped() { + return this.itemsSkipped; + } + + /** + * Set the itemsSkipped property: The number of items skipped in the current synchronization. + * + * @param itemsSkipped the itemsSkipped value to set. + * @return the SynchronizationState object itself. + */ + @Generated + public SynchronizationState setItemsSkipped(int itemsSkipped) { + this.itemsSkipped = itemsSkipped; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + jsonWriter.writeIntField("itemsUpdatesProcessed", this.itemsUpdatesProcessed); + jsonWriter.writeIntField("itemsUpdatesFailed", this.itemsUpdatesFailed); + jsonWriter.writeIntField("itemsSkipped", this.itemsSkipped); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SynchronizationState from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SynchronizationState 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 SynchronizationState. + */ + @Generated + public static SynchronizationState fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SynchronizationState deserializedSynchronizationState = new SynchronizationState(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("startTime".equals(fieldName)) { + deserializedSynchronizationState.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("itemsUpdatesProcessed".equals(fieldName)) { + deserializedSynchronizationState.itemsUpdatesProcessed = reader.getInt(); + } else if ("itemsUpdatesFailed".equals(fieldName)) { + deserializedSynchronizationState.itemsUpdatesFailed = reader.getInt(); + } else if ("itemsSkipped".equals(fieldName)) { + deserializedSynchronizationState.itemsSkipped = reader.getInt(); + } else { + reader.skipChildren(); + } + } + + return deserializedSynchronizationState; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SynonymMap.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SynonymMap.java new file mode 100644 index 000000000000..5adb0a038177 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SynonymMap.java @@ -0,0 +1,223 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a synonym map definition. + */ +@Fluent +public final class SynonymMap implements JsonSerializable { + /* + * The name of the synonym map. + */ + @Generated + private String name; + + /* + * The format of the synonym map. Only the 'solr' format is currently supported. + */ + @Generated + private final String format = "solr"; + + /* + * A series of synonym rules in the specified synonym map format. The rules must be separated by newlines. + */ + @Generated + private String synonyms; + + /* + * 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 + * decrypt your data. Once you have encrypted your data, it will always remain encrypted. The search service will + * ignore attempts to set this property to null. You can change this property as needed if you want to rotate your + * encryption key; Your data will be unaffected. Encryption with customer-managed keys is not available for free + * search services, and is only available for paid services created on or after January 1, 2019. + */ + @Generated + private SearchResourceEncryptionKey encryptionKey; + + /* + * The ETag of the synonym map. + */ + @Generated + private String eTag; + + /** + * Creates an instance of SynonymMap class. + */ + @Generated + public SynonymMap() { + } + + /** + * Get the name property: The name of the synonym map. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the synonym map. + * + * @param name the name value to set. + * @return the SynonymMap object itself. + */ + @Generated + public SynonymMap setName(String name) { + this.name = name; + return this; + } + + /** + * Get the format property: The format of the synonym map. Only the 'solr' format is currently supported. + * + * @return the format value. + */ + @Generated + public String getFormat() { + return this.format; + } + + /** + * Get the synonyms property: A series of synonym rules in the specified synonym map format. The rules must be + * separated by newlines. + * + * @return the synonyms value. + */ + @Generated + public String getSynonyms() { + return this.synonyms; + } + + /** + * Set the synonyms property: A series of synonym rules in the specified synonym map format. The rules must be + * separated by newlines. + * + * @param synonyms the synonyms value to set. + * @return the SynonymMap object itself. + */ + @Generated + public SynonymMap setSynonyms(String synonyms) { + this.synonyms = synonyms; + 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 + * one, not even Microsoft, can decrypt your data. Once you have encrypted your data, it will always remain + * encrypted. The search service will ignore attempts to set this property to null. You can change this property as + * needed if you want to rotate your encryption key; Your data will be unaffected. Encryption with customer-managed + * keys is not available for free search services, and is only available for paid services created on or after + * January 1, 2019. + * + * @return the encryptionKey value. + */ + @Generated + public SearchResourceEncryptionKey getEncryptionKey() { + return this.encryptionKey; + } + + /** + * Set 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 + * one, not even Microsoft, can decrypt your data. Once you have encrypted your data, it will always remain + * encrypted. The search service will ignore attempts to set this property to null. You can change this property as + * needed if you want to rotate your encryption key; Your data will be unaffected. Encryption with customer-managed + * keys is not available for free search services, and is only available for paid services created on or after + * January 1, 2019. + * + * @param encryptionKey the encryptionKey value to set. + * @return the SynonymMap object itself. + */ + @Generated + public SynonymMap setEncryptionKey(SearchResourceEncryptionKey encryptionKey) { + this.encryptionKey = encryptionKey; + return this; + } + + /** + * Get the eTag property: The ETag of the synonym map. + * + * @return the eTag value. + */ + @Generated + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag of the synonym map. + * + * @param eTag the eTag value to set. + * @return the SynonymMap object itself. + */ + @Generated + public SynonymMap setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("format", this.format); + jsonWriter.writeStringField("synonyms", this.synonyms); + jsonWriter.writeJsonField("encryptionKey", this.encryptionKey); + jsonWriter.writeStringField("@odata.etag", this.eTag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SynonymMap from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SynonymMap 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 SynonymMap. + */ + @Generated + public static SynonymMap fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SynonymMap deserializedSynonymMap = new SynonymMap(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSynonymMap.name = reader.getString(); + } else if ("synonyms".equals(fieldName)) { + deserializedSynonymMap.synonyms = reader.getString(); + } else if ("encryptionKey".equals(fieldName)) { + deserializedSynonymMap.encryptionKey = SearchResourceEncryptionKey.fromJson(reader); + } else if ("@odata.etag".equals(fieldName)) { + deserializedSynonymMap.eTag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSynonymMap; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SynonymTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SynonymTokenFilter.java new file mode 100644 index 000000000000..5ea7050ede13 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/SynonymTokenFilter.java @@ -0,0 +1,214 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Matches single or multi-word synonyms in a token stream. This token filter is implemented using Apache Lucene. + */ +@Fluent +public final class SynonymTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.SynonymTokenFilter"; + + /* + * A list of synonyms in following one of two formats: 1. incredible, unbelievable, fabulous => amazing - all terms + * on the left side of => symbol will be replaced with all terms on its right side; 2. incredible, unbelievable, + * fabulous, amazing - comma separated list of equivalent words. Set the expand option to change how this list is + * interpreted. + */ + @Generated + private List synonyms; + + /* + * A value indicating whether to case-fold input for matching. Default is false. + */ + @Generated + private Boolean ignoreCase; + + /* + * A value indicating whether all words in the list of synonyms (if => notation is not used) will map to one + * another. If true, all words in the list of synonyms (if => notation is not used) will map to one another. The + * following list: incredible, unbelievable, fabulous, amazing is equivalent to: incredible, unbelievable, fabulous, + * amazing => incredible, unbelievable, fabulous, amazing. If false, the following list: incredible, unbelievable, + * fabulous, amazing will be equivalent to: incredible, unbelievable, fabulous, amazing => incredible. Default is + * true. + */ + @Generated + private Boolean expand; + + /** + * Creates an instance of SynonymTokenFilter class. + */ + @Generated + public SynonymTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the synonyms property: A list of synonyms in following one of two formats: 1. incredible, unbelievable, + * fabulous => amazing - all terms on the left side of => symbol will be replaced with all terms on its right + * side; 2. incredible, unbelievable, fabulous, amazing - comma separated list of equivalent words. Set the expand + * option to change how this list is interpreted. + * + * @return the synonyms value. + */ + @Generated + public List getSynonyms() { + return this.synonyms; + } + + /** + * Set the synonyms property: A list of synonyms in following one of two formats: 1. incredible, unbelievable, + * fabulous => amazing - all terms on the left side of => symbol will be replaced with all terms on its right + * side; 2. incredible, unbelievable, fabulous, amazing - comma separated list of equivalent words. Set the expand + * option to change how this list is interpreted. + * + * @param synonyms the synonyms value to set. + * @return the SynonymTokenFilter object itself. + */ + @Generated + public SynonymTokenFilter setSynonyms(List synonyms) { + this.synonyms = synonyms; + return this; + } + + /** + * Get the ignoreCase property: A value indicating whether to case-fold input for matching. Default is false. + * + * @return the ignoreCase value. + */ + @Generated + public Boolean isIgnoreCase() { + return this.ignoreCase; + } + + /** + * Set the ignoreCase property: A value indicating whether to case-fold input for matching. Default is false. + * + * @param ignoreCase the ignoreCase value to set. + * @return the SynonymTokenFilter object itself. + */ + @Generated + public SynonymTokenFilter setIgnoreCase(Boolean ignoreCase) { + this.ignoreCase = ignoreCase; + return this; + } + + /** + * Get the expand property: A value indicating whether all words in the list of synonyms (if => notation is not + * used) will map to one another. If true, all words in the list of synonyms (if => notation is not used) will + * map to one another. The following list: incredible, unbelievable, fabulous, amazing is equivalent to: incredible, + * unbelievable, fabulous, amazing => incredible, unbelievable, fabulous, amazing. If false, the following list: + * incredible, unbelievable, fabulous, amazing will be equivalent to: incredible, unbelievable, fabulous, amazing + * => incredible. Default is true. + * + * @return the expand value. + */ + @Generated + public Boolean isExpand() { + return this.expand; + } + + /** + * Set the expand property: A value indicating whether all words in the list of synonyms (if => notation is not + * used) will map to one another. If true, all words in the list of synonyms (if => notation is not used) will + * map to one another. The following list: incredible, unbelievable, fabulous, amazing is equivalent to: incredible, + * unbelievable, fabulous, amazing => incredible, unbelievable, fabulous, amazing. If false, the following list: + * incredible, unbelievable, fabulous, amazing will be equivalent to: incredible, unbelievable, fabulous, amazing + * => incredible. Default is true. + * + * @param expand the expand value to set. + * @return the SynonymTokenFilter object itself. + */ + @Generated + public SynonymTokenFilter setExpand(Boolean expand) { + this.expand = expand; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SynonymTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeArrayField("synonyms", this.synonyms, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeBooleanField("ignoreCase", this.ignoreCase); + jsonWriter.writeBooleanField("expand", this.expand); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SynonymTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SynonymTokenFilter 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 SynonymTokenFilter. + */ + @Generated + public static SynonymTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SynonymTokenFilter deserializedSynonymTokenFilter = new SynonymTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSynonymTokenFilter.setName(reader.getString()); + } else if ("synonyms".equals(fieldName)) { + List synonyms = reader.readArray(reader1 -> reader1.getString()); + deserializedSynonymTokenFilter.synonyms = synonyms; + } else if ("@odata.type".equals(fieldName)) { + deserializedSynonymTokenFilter.odataType = reader.getString(); + } else if ("ignoreCase".equals(fieldName)) { + deserializedSynonymTokenFilter.ignoreCase = reader.getNullable(JsonReader::getBoolean); + } else if ("expand".equals(fieldName)) { + deserializedSynonymTokenFilter.expand = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedSynonymTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TagScoringFunction.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TagScoringFunction.java new file mode 100644 index 000000000000..a6352181140b --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TagScoringFunction.java @@ -0,0 +1,155 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines a function that boosts scores of documents with string values matching a given list of tags. + */ +@Fluent +public final class TagScoringFunction extends ScoringFunction { + /* + * Indicates the type of function to use. Valid values include magnitude, freshness, distance, and tag. The function + * type must be lower case. + */ + @Generated + private String type = "tag"; + + /* + * Parameter values for the tag scoring function. + */ + @Generated + private TagScoringParameters parameters; + + /** + * Creates an instance of TagScoringFunction class. + */ + @Generated + public TagScoringFunction() { + } + + /** + * Get the type property: Indicates the type of function to use. Valid values include magnitude, freshness, + * distance, and tag. The function type must be lower case. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the parameters property: Parameter values for the tag scoring function. + * + * @return the parameters value. + */ + @Generated + public TagScoringParameters getParameters() { + return this.parameters; + } + + /** + * Set the parameters property: Parameter values for the tag scoring function. + * + * @param parameters the parameters value to set. + * @return the TagScoringFunction object itself. + */ + @Generated + public TagScoringFunction setParameters(TagScoringParameters parameters) { + this.parameters = parameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public TagScoringFunction setFieldName(String fieldName) { + super.setFieldName(fieldName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public TagScoringFunction setBoost(double boost) { + super.setBoost(boost); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public TagScoringFunction setInterpolation(ScoringFunctionInterpolation interpolation) { + super.setInterpolation(interpolation); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("fieldName", getFieldName()); + jsonWriter.writeDoubleField("boost", getBoost()); + jsonWriter.writeStringField("interpolation", getInterpolation() == null ? null : getInterpolation().toString()); + jsonWriter.writeJsonField("tag", this.parameters); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TagScoringFunction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TagScoringFunction 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 TagScoringFunction. + */ + @Generated + public static TagScoringFunction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TagScoringFunction deserializedTagScoringFunction = new TagScoringFunction(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String jsonFieldName = reader.getFieldName(); + reader.nextToken(); + + if ("fieldName".equals(jsonFieldName)) { + deserializedTagScoringFunction.setFieldName(reader.getString()); + } else if ("boost".equals(jsonFieldName)) { + deserializedTagScoringFunction.setBoost(reader.getDouble()); + } else if ("interpolation".equals(jsonFieldName)) { + deserializedTagScoringFunction + .setInterpolation(ScoringFunctionInterpolation.fromString(reader.getString())); + } else if ("tag".equals(jsonFieldName)) { + deserializedTagScoringFunction.parameters = TagScoringParameters.fromJson(reader); + } else if ("type".equals(jsonFieldName)) { + deserializedTagScoringFunction.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTagScoringFunction; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TagScoringParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TagScoringParameters.java new file mode 100644 index 000000000000..017bd67230a5 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TagScoringParameters.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Provides parameter values to a tag scoring function. + */ +@Fluent +public final class TagScoringParameters implements JsonSerializable { + /* + * The name of the parameter passed in search queries to specify the list of tags to compare against the target + * field. + */ + @Generated + private String tagsParameter; + + /** + * Creates an instance of TagScoringParameters class. + */ + @Generated + public TagScoringParameters() { + } + + /** + * Get the tagsParameter property: The name of the parameter passed in search queries to specify the list of tags to + * compare against the target field. + * + * @return the tagsParameter value. + */ + @Generated + public String getTagsParameter() { + return this.tagsParameter; + } + + /** + * Set the tagsParameter property: The name of the parameter passed in search queries to specify the list of tags to + * compare against the target field. + * + * @param tagsParameter the tagsParameter value to set. + * @return the TagScoringParameters object itself. + */ + @Generated + public TagScoringParameters setTagsParameter(String tagsParameter) { + this.tagsParameter = tagsParameter; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tagsParameter", this.tagsParameter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TagScoringParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TagScoringParameters 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 TagScoringParameters. + */ + @Generated + public static TagScoringParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TagScoringParameters deserializedTagScoringParameters = new TagScoringParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tagsParameter".equals(fieldName)) { + deserializedTagScoringParameters.tagsParameter = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTagScoringParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TextResult.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TextResult.java new file mode 100644 index 000000000000..b0106fc46d57 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TextResult.java @@ -0,0 +1,80 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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. + */ + @Generated + private Double searchScore; + + /** + * Creates an instance of TextResult class. + */ + @Generated + public TextResult() { + } + + /** + * Get the searchScore property: The BM25 or Classic score for the text portion of the query. + * + * @return the searchScore value. + */ + @Generated + public Double getSearchScore() { + return this.searchScore; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + 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/search/src/main/java/com/azure/search/models/TextSplitMode.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TextSplitMode.java new file mode 100644 index 000000000000..01f9cced23f9 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TextSplitMode.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * A value indicating which split mode to perform. + */ +public final class TextSplitMode extends ExpandableStringEnum { + /** + * Split the text into individual pages. + */ + @Generated + public static final TextSplitMode PAGES = fromString("pages"); + + /** + * Split the text into individual sentences. + */ + @Generated + public static final TextSplitMode SENTENCES = fromString("sentences"); + + /** + * Creates a new instance of TextSplitMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public TextSplitMode() { + } + + /** + * Creates or finds a TextSplitMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding TextSplitMode. + */ + @Generated + public static TextSplitMode fromString(String name) { + return fromString(name, TextSplitMode.class); + } + + /** + * Gets known TextSplitMode values. + * + * @return known TextSplitMode values. + */ + @Generated + public static Collection values() { + return values(TextSplitMode.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TextTranslationSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TextTranslationSkill.java new file mode 100644 index 000000000000..c4e723f5e4e0 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TextTranslationSkill.java @@ -0,0 +1,260 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A skill to translate text from one language to another. + */ +@Fluent +public final class TextTranslationSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Text.TranslationSkill"; + + /* + * The language code to translate documents into for documents that don't specify the to language explicitly. + */ + @Generated + private TextTranslationSkillLanguage defaultToLanguageCode; + + /* + * The language code to translate documents from for documents that don't specify the from language explicitly. + */ + @Generated + private TextTranslationSkillLanguage defaultFromLanguageCode; + + /* + * The language code to translate documents from when neither the fromLanguageCode input nor the + * defaultFromLanguageCode parameter are provided, and the automatic language detection is unsuccessful. Default is + * `en`. + */ + @Generated + private TextTranslationSkillLanguage suggestedFrom; + + /** + * Creates an instance of TextTranslationSkill class. + */ + @Generated + public TextTranslationSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the defaultToLanguageCode property: The language code to translate documents into for documents that don't + * specify the to language explicitly. + * + * @return the defaultToLanguageCode value. + */ + @Generated + public TextTranslationSkillLanguage getDefaultToLanguageCode() { + return this.defaultToLanguageCode; + } + + /** + * Set the defaultToLanguageCode property: The language code to translate documents into for documents that don't + * specify the to language explicitly. + * + * @param defaultToLanguageCode the defaultToLanguageCode value to set. + * @return the TextTranslationSkill object itself. + */ + @Generated + public TextTranslationSkill setDefaultToLanguageCode(TextTranslationSkillLanguage defaultToLanguageCode) { + this.defaultToLanguageCode = defaultToLanguageCode; + return this; + } + + /** + * Get the defaultFromLanguageCode property: The language code to translate documents from for documents that don't + * specify the from language explicitly. + * + * @return the defaultFromLanguageCode value. + */ + @Generated + public TextTranslationSkillLanguage getDefaultFromLanguageCode() { + return this.defaultFromLanguageCode; + } + + /** + * Set the defaultFromLanguageCode property: The language code to translate documents from for documents that don't + * specify the from language explicitly. + * + * @param defaultFromLanguageCode the defaultFromLanguageCode value to set. + * @return the TextTranslationSkill object itself. + */ + @Generated + public TextTranslationSkill setDefaultFromLanguageCode(TextTranslationSkillLanguage defaultFromLanguageCode) { + this.defaultFromLanguageCode = defaultFromLanguageCode; + return this; + } + + /** + * Get the suggestedFrom property: The language code to translate documents from when neither the fromLanguageCode + * input nor the defaultFromLanguageCode parameter are provided, and the automatic language detection is + * unsuccessful. Default is `en`. + * + * @return the suggestedFrom value. + */ + @Generated + public TextTranslationSkillLanguage getSuggestedFrom() { + return this.suggestedFrom; + } + + /** + * Set the suggestedFrom property: The language code to translate documents from when neither the fromLanguageCode + * input nor the defaultFromLanguageCode parameter are provided, and the automatic language detection is + * unsuccessful. Default is `en`. + * + * @param suggestedFrom the suggestedFrom value to set. + * @return the TextTranslationSkill object itself. + */ + @Generated + public TextTranslationSkill setSuggestedFrom(TextTranslationSkillLanguage suggestedFrom) { + this.suggestedFrom = suggestedFrom; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public TextTranslationSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public TextTranslationSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public TextTranslationSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public TextTranslationSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public TextTranslationSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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("defaultToLanguageCode", + this.defaultToLanguageCode == null ? null : this.defaultToLanguageCode.toString()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeStringField("defaultFromLanguageCode", + this.defaultFromLanguageCode == null ? null : this.defaultFromLanguageCode.toString()); + jsonWriter.writeStringField("suggestedFrom", this.suggestedFrom == null ? null : this.suggestedFrom.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TextTranslationSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TextTranslationSkill 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 TextTranslationSkill. + */ + @Generated + public static TextTranslationSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TextTranslationSkill deserializedTextTranslationSkill = new TextTranslationSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedTextTranslationSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedTextTranslationSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedTextTranslationSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedTextTranslationSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedTextTranslationSkill.setContext(reader.getString()); + } else if ("defaultToLanguageCode".equals(fieldName)) { + deserializedTextTranslationSkill.defaultToLanguageCode + = TextTranslationSkillLanguage.fromString(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedTextTranslationSkill.odataType = reader.getString(); + } else if ("defaultFromLanguageCode".equals(fieldName)) { + deserializedTextTranslationSkill.defaultFromLanguageCode + = TextTranslationSkillLanguage.fromString(reader.getString()); + } else if ("suggestedFrom".equals(fieldName)) { + deserializedTextTranslationSkill.suggestedFrom + = TextTranslationSkillLanguage.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedTextTranslationSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TextTranslationSkillLanguage.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TextTranslationSkillLanguage.java new file mode 100644 index 000000000000..830f79605c34 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TextTranslationSkillLanguage.java @@ -0,0 +1,478 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The language codes supported for input text by TextTranslationSkill. + */ +public final class TextTranslationSkillLanguage extends ExpandableStringEnum { + /** + * Afrikaans. + */ + @Generated + public static final TextTranslationSkillLanguage AF = fromString("af"); + + /** + * Arabic. + */ + @Generated + public static final TextTranslationSkillLanguage AR = fromString("ar"); + + /** + * Bangla. + */ + @Generated + public static final TextTranslationSkillLanguage BN = fromString("bn"); + + /** + * Bosnian (Latin). + */ + @Generated + public static final TextTranslationSkillLanguage BS = fromString("bs"); + + /** + * Bulgarian. + */ + @Generated + public static final TextTranslationSkillLanguage BG = fromString("bg"); + + /** + * Cantonese (Traditional). + */ + @Generated + public static final TextTranslationSkillLanguage YUE = fromString("yue"); + + /** + * Catalan. + */ + @Generated + public static final TextTranslationSkillLanguage CA = fromString("ca"); + + /** + * Chinese Simplified. + */ + @Generated + public static final TextTranslationSkillLanguage ZH_HANS = fromString("zh-Hans"); + + /** + * Chinese Traditional. + */ + @Generated + public static final TextTranslationSkillLanguage ZH_HANT = fromString("zh-Hant"); + + /** + * Croatian. + */ + @Generated + public static final TextTranslationSkillLanguage HR = fromString("hr"); + + /** + * Czech. + */ + @Generated + public static final TextTranslationSkillLanguage CS = fromString("cs"); + + /** + * Danish. + */ + @Generated + public static final TextTranslationSkillLanguage DA = fromString("da"); + + /** + * Dutch. + */ + @Generated + public static final TextTranslationSkillLanguage NL = fromString("nl"); + + /** + * English. + */ + @Generated + public static final TextTranslationSkillLanguage EN = fromString("en"); + + /** + * Estonian. + */ + @Generated + public static final TextTranslationSkillLanguage ET = fromString("et"); + + /** + * Fijian. + */ + @Generated + public static final TextTranslationSkillLanguage FJ = fromString("fj"); + + /** + * Filipino. + */ + @Generated + public static final TextTranslationSkillLanguage FIL = fromString("fil"); + + /** + * Finnish. + */ + @Generated + public static final TextTranslationSkillLanguage FI = fromString("fi"); + + /** + * French. + */ + @Generated + public static final TextTranslationSkillLanguage FR = fromString("fr"); + + /** + * German. + */ + @Generated + public static final TextTranslationSkillLanguage DE = fromString("de"); + + /** + * Greek. + */ + @Generated + public static final TextTranslationSkillLanguage EL = fromString("el"); + + /** + * Haitian Creole. + */ + @Generated + public static final TextTranslationSkillLanguage HT = fromString("ht"); + + /** + * Hebrew. + */ + @Generated + public static final TextTranslationSkillLanguage HE = fromString("he"); + + /** + * Hindi. + */ + @Generated + public static final TextTranslationSkillLanguage HI = fromString("hi"); + + /** + * Hmong Daw. + */ + @Generated + public static final TextTranslationSkillLanguage MWW = fromString("mww"); + + /** + * Hungarian. + */ + @Generated + public static final TextTranslationSkillLanguage HU = fromString("hu"); + + /** + * Icelandic. + */ + @Generated + public static final TextTranslationSkillLanguage IS = fromString("is"); + + /** + * Indonesian. + */ + @Generated + public static final TextTranslationSkillLanguage ID = fromString("id"); + + /** + * Italian. + */ + @Generated + public static final TextTranslationSkillLanguage IT = fromString("it"); + + /** + * Japanese. + */ + @Generated + public static final TextTranslationSkillLanguage JA = fromString("ja"); + + /** + * Kiswahili. + */ + @Generated + public static final TextTranslationSkillLanguage SW = fromString("sw"); + + /** + * Klingon. + */ + @Generated + public static final TextTranslationSkillLanguage TLH = fromString("tlh"); + + /** + * Klingon (Latin script). + */ + @Generated + public static final TextTranslationSkillLanguage TLH_LATN = fromString("tlh-Latn"); + + /** + * Klingon (Klingon script). + */ + @Generated + public static final TextTranslationSkillLanguage TLH_PIQD = fromString("tlh-Piqd"); + + /** + * Korean. + */ + @Generated + public static final TextTranslationSkillLanguage KO = fromString("ko"); + + /** + * Latvian. + */ + @Generated + public static final TextTranslationSkillLanguage LV = fromString("lv"); + + /** + * Lithuanian. + */ + @Generated + public static final TextTranslationSkillLanguage LT = fromString("lt"); + + /** + * Malagasy. + */ + @Generated + public static final TextTranslationSkillLanguage MG = fromString("mg"); + + /** + * Malay. + */ + @Generated + public static final TextTranslationSkillLanguage MS = fromString("ms"); + + /** + * Maltese. + */ + @Generated + public static final TextTranslationSkillLanguage MT = fromString("mt"); + + /** + * Norwegian. + */ + @Generated + public static final TextTranslationSkillLanguage NB = fromString("nb"); + + /** + * Persian. + */ + @Generated + public static final TextTranslationSkillLanguage FA = fromString("fa"); + + /** + * Polish. + */ + @Generated + public static final TextTranslationSkillLanguage PL = fromString("pl"); + + /** + * Portuguese. + */ + @Generated + public static final TextTranslationSkillLanguage PT = fromString("pt"); + + /** + * Portuguese (Brazil). + */ + @Generated + public static final TextTranslationSkillLanguage PT_BR = fromString("pt-br"); + + /** + * Portuguese (Portugal). + */ + @Generated + public static final TextTranslationSkillLanguage PT_PT = fromString("pt-PT"); + + /** + * Queretaro Otomi. + */ + @Generated + public static final TextTranslationSkillLanguage OTQ = fromString("otq"); + + /** + * Romanian. + */ + @Generated + public static final TextTranslationSkillLanguage RO = fromString("ro"); + + /** + * Russian. + */ + @Generated + public static final TextTranslationSkillLanguage RU = fromString("ru"); + + /** + * Samoan. + */ + @Generated + public static final TextTranslationSkillLanguage SM = fromString("sm"); + + /** + * Serbian (Cyrillic). + */ + @Generated + public static final TextTranslationSkillLanguage SR_CYRL = fromString("sr-Cyrl"); + + /** + * Serbian (Latin). + */ + @Generated + public static final TextTranslationSkillLanguage SR_LATN = fromString("sr-Latn"); + + /** + * Slovak. + */ + @Generated + public static final TextTranslationSkillLanguage SK = fromString("sk"); + + /** + * Slovenian. + */ + @Generated + public static final TextTranslationSkillLanguage SL = fromString("sl"); + + /** + * Spanish. + */ + @Generated + public static final TextTranslationSkillLanguage ES = fromString("es"); + + /** + * Swedish. + */ + @Generated + public static final TextTranslationSkillLanguage SV = fromString("sv"); + + /** + * Tahitian. + */ + @Generated + public static final TextTranslationSkillLanguage TY = fromString("ty"); + + /** + * Tamil. + */ + @Generated + public static final TextTranslationSkillLanguage TA = fromString("ta"); + + /** + * Telugu. + */ + @Generated + public static final TextTranslationSkillLanguage TE = fromString("te"); + + /** + * Thai. + */ + @Generated + public static final TextTranslationSkillLanguage TH = fromString("th"); + + /** + * Tongan. + */ + @Generated + public static final TextTranslationSkillLanguage TO = fromString("to"); + + /** + * Turkish. + */ + @Generated + public static final TextTranslationSkillLanguage TR = fromString("tr"); + + /** + * Ukrainian. + */ + @Generated + public static final TextTranslationSkillLanguage UK = fromString("uk"); + + /** + * Urdu. + */ + @Generated + public static final TextTranslationSkillLanguage UR = fromString("ur"); + + /** + * Vietnamese. + */ + @Generated + public static final TextTranslationSkillLanguage VI = fromString("vi"); + + /** + * Welsh. + */ + @Generated + public static final TextTranslationSkillLanguage CY = fromString("cy"); + + /** + * Yucatec Maya. + */ + @Generated + public static final TextTranslationSkillLanguage YUA = fromString("yua"); + + /** + * Irish. + */ + @Generated + public static final TextTranslationSkillLanguage GA = fromString("ga"); + + /** + * Kannada. + */ + @Generated + public static final TextTranslationSkillLanguage KN = fromString("kn"); + + /** + * Maori. + */ + @Generated + public static final TextTranslationSkillLanguage MI = fromString("mi"); + + /** + * Malayalam. + */ + @Generated + public static final TextTranslationSkillLanguage ML = fromString("ml"); + + /** + * Punjabi. + */ + @Generated + public static final TextTranslationSkillLanguage PA = fromString("pa"); + + /** + * Creates a new instance of TextTranslationSkillLanguage value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public TextTranslationSkillLanguage() { + } + + /** + * Creates or finds a TextTranslationSkillLanguage from its string representation. + * + * @param name a name to look for. + * @return the corresponding TextTranslationSkillLanguage. + */ + @Generated + public static TextTranslationSkillLanguage fromString(String name) { + return fromString(name, TextTranslationSkillLanguage.class); + } + + /** + * Gets known TextTranslationSkillLanguage values. + * + * @return known TextTranslationSkillLanguage values. + */ + @Generated + public static Collection values() { + return values(TextTranslationSkillLanguage.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TextWeights.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TextWeights.java new file mode 100644 index 000000000000..7cf90c6764b8 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TextWeights.java @@ -0,0 +1,99 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.Map; + +/** + * Defines weights on index fields for which matches should boost scoring in search queries. + */ +@Fluent +public final class TextWeights implements JsonSerializable { + /* + * The dictionary of per-field weights to boost document scoring. The keys are field names and the values are the + * weights for each field. + */ + @Generated + private Map weights; + + /** + * Creates an instance of TextWeights class. + */ + @Generated + public TextWeights() { + } + + /** + * Get the weights property: The dictionary of per-field weights to boost document scoring. The keys are field names + * and the values are the weights for each field. + * + * @return the weights value. + */ + @Generated + public Map getWeights() { + return this.weights; + } + + /** + * Set the weights property: The dictionary of per-field weights to boost document scoring. The keys are field names + * and the values are the weights for each field. + * + * @param weights the weights value to set. + * @return the TextWeights object itself. + */ + @Generated + public TextWeights setWeights(Map weights) { + this.weights = weights; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("weights", this.weights, (writer, element) -> writer.writeDouble(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TextWeights from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TextWeights 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 TextWeights. + */ + @Generated + public static TextWeights fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TextWeights deserializedTextWeights = new TextWeights(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("weights".equals(fieldName)) { + Map weights = reader.readMap(reader1 -> reader1.getDouble()); + deserializedTextWeights.weights = weights; + } else { + reader.skipChildren(); + } + } + + return deserializedTextWeights; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TokenCharacterKind.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TokenCharacterKind.java new file mode 100644 index 000000000000..5da5d56428bd --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TokenCharacterKind.java @@ -0,0 +1,72 @@ +// 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.models; + +/** + * Represents classes of characters on which a token filter can operate. + */ +public enum TokenCharacterKind { + /** + * Keeps letters in tokens. + */ + LETTER("letter"), + + /** + * Keeps digits in tokens. + */ + DIGIT("digit"), + + /** + * Keeps whitespace in tokens. + */ + WHITESPACE("whitespace"), + + /** + * Keeps punctuation in tokens. + */ + PUNCTUATION("punctuation"), + + /** + * Keeps symbols in tokens. + */ + SYMBOL("symbol"); + + /** + * The actual serialized value for a TokenCharacterKind instance. + */ + private final String value; + + TokenCharacterKind(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TokenCharacterKind instance. + * + * @param value the serialized value to parse. + * @return the parsed TokenCharacterKind object, or null if unable to parse. + */ + public static TokenCharacterKind fromString(String value) { + if (value == null) { + return null; + } + TokenCharacterKind[] items = TokenCharacterKind.values(); + for (TokenCharacterKind item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TokenFilter.java new file mode 100644 index 000000000000..346f54717a14 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TokenFilter.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 token filters. + */ +@Fluent +public class TokenFilter implements JsonSerializable { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "TokenFilter"; + + /* + * The name of the token filter. It must only contain letters, digits, spaces, dashes or underscores, can only start + * and end with alphanumeric characters, and is limited to 128 characters. + */ + @Generated + private String name; + + /** + * Creates an instance of TokenFilter class. + */ + @Generated + public TokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + public String getOdataType() { + return this.odataType; + } + + /** + * Get the name property: The name of the token filter. It must only contain letters, digits, spaces, dashes or + * underscores, can only start and end with alphanumeric characters, and is limited to 128 characters. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the token filter. It must only contain letters, digits, spaces, dashes or + * underscores, can only start and end with alphanumeric characters, and is limited to 128 characters. + * + * @param name the name value to set. + * @return the TokenFilter object itself. + */ + @Generated + public TokenFilter setName(String name) { + this.name = name; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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 TokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TokenFilter 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 TokenFilter. + */ + @Generated + public static TokenFilter 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.AsciiFoldingTokenFilter".equals(discriminatorValue)) { + return AsciiFoldingTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.CjkBigramTokenFilter".equals(discriminatorValue)) { + return CjkBigramTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.CommonGramTokenFilter".equals(discriminatorValue)) { + return CommonGramTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.DictionaryDecompounderTokenFilter".equals(discriminatorValue)) { + return DictionaryDecompounderTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.EdgeNGramTokenFilter".equals(discriminatorValue)) { + return EdgeNGramTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.EdgeNGramTokenFilterV2".equals(discriminatorValue)) { + return EdgeNGramTokenFilterV2.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.ElisionTokenFilter".equals(discriminatorValue)) { + return ElisionTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.KeepTokenFilter".equals(discriminatorValue)) { + return KeepTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.KeywordMarkerTokenFilter".equals(discriminatorValue)) { + return KeywordMarkerTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.LengthTokenFilter".equals(discriminatorValue)) { + return LengthTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.LimitTokenFilter".equals(discriminatorValue)) { + return LimitTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.NGramTokenFilter".equals(discriminatorValue)) { + return NGramTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.NGramTokenFilterV2".equals(discriminatorValue)) { + return NGramTokenFilterV2.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.PatternCaptureTokenFilter".equals(discriminatorValue)) { + return PatternCaptureTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.PatternReplaceTokenFilter".equals(discriminatorValue)) { + return PatternReplaceTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.PhoneticTokenFilter".equals(discriminatorValue)) { + return PhoneticTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.ShingleTokenFilter".equals(discriminatorValue)) { + return ShingleTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.SnowballTokenFilter".equals(discriminatorValue)) { + return SnowballTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.StemmerTokenFilter".equals(discriminatorValue)) { + return StemmerTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.StemmerOverrideTokenFilter".equals(discriminatorValue)) { + return StemmerOverrideTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.StopwordsTokenFilter".equals(discriminatorValue)) { + return StopwordsTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.SynonymTokenFilter".equals(discriminatorValue)) { + return SynonymTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.TruncateTokenFilter".equals(discriminatorValue)) { + return TruncateTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.UniqueTokenFilter".equals(discriminatorValue)) { + return UniqueTokenFilter.fromJson(readerToUse.reset()); + } else if ("#Microsoft.Azure.Search.WordDelimiterTokenFilter".equals(discriminatorValue)) { + return WordDelimiterTokenFilter.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static TokenFilter fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TokenFilter deserializedTokenFilter = new TokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedTokenFilter.name = reader.getString(); + } else if ("@odata.type".equals(fieldName)) { + deserializedTokenFilter.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TokenFilterName.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TokenFilterName.java new file mode 100644 index 000000000000..ba70259a5c29 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TokenFilterName.java @@ -0,0 +1,286 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines the names of all token filters supported by the search engine. + */ +public final class TokenFilterName extends ExpandableStringEnum { + /** + * A token filter that applies the Arabic normalizer to normalize the orthography. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/ar/ArabicNormalizationFilter.html. + */ + @Generated + public static final TokenFilterName ARABIC_NORMALIZATION = fromString("arabic_normalization"); + + /** + * Strips all characters after an apostrophe (including the apostrophe itself). See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/tr/ApostropheFilter.html. + */ + @Generated + public static final TokenFilterName APOSTROPHE = fromString("apostrophe"); + + /** + * 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. + */ + @Generated + public static final TokenFilterName ASCII_FOLDING = fromString("asciifolding"); + + /** + * Forms bigrams of CJK terms that are generated from the standard tokenizer. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/cjk/CJKBigramFilter.html. + */ + @Generated + public static final TokenFilterName CJK_BIGRAM = fromString("cjk_bigram"); + + /** + * Normalizes CJK width differences. Folds fullwidth ASCII variants into the equivalent basic Latin, and half-width + * Katakana variants into the equivalent Kana. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/cjk/CJKWidthFilter.html. + */ + @Generated + public static final TokenFilterName CJK_WIDTH = fromString("cjk_width"); + + /** + * Removes English possessives, and dots from acronyms. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/standard/ClassicFilter.html. + */ + @Generated + public static final TokenFilterName CLASSIC = fromString("classic"); + + /** + * Construct bigrams for frequently occurring terms while indexing. Single terms are still indexed too, with bigrams + * overlaid. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/commongrams/CommonGramsFilter.html. + */ + @Generated + public static final TokenFilterName COMMON_GRAM = fromString("common_grams"); + + /** + * Generates n-grams of the given size(s) starting from the front or the back of an input token. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/ngram/EdgeNGramTokenFilter.html. + */ + @Generated + public static final TokenFilterName EDGE_NGRAM = fromString("edgeNGram_v2"); + + /** + * 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. + */ + @Generated + public static final TokenFilterName ELISION = fromString("elision"); + + /** + * Normalizes German characters according to the heuristics of the German2 snowball algorithm. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/de/GermanNormalizationFilter.html. + */ + @Generated + public static final TokenFilterName GERMAN_NORMALIZATION = fromString("german_normalization"); + + /** + * Normalizes text in Hindi to remove some differences in spelling variations. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/hi/HindiNormalizationFilter.html. + */ + @Generated + public static final TokenFilterName HINDI_NORMALIZATION = fromString("hindi_normalization"); + + /** + * Normalizes the Unicode representation of text in Indian languages. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/in/IndicNormalizationFilter.html. + */ + @Generated + public static final TokenFilterName INDIC_NORMALIZATION = fromString("indic_normalization"); + + /** + * Emits each incoming token twice, once as keyword and once as non-keyword. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/miscellaneous/KeywordRepeatFilter.html. + */ + @Generated + public static final TokenFilterName KEYWORD_REPEAT = fromString("keyword_repeat"); + + /** + * A high-performance kstem filter for English. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/en/KStemFilter.html. + */ + @Generated + public static final TokenFilterName KSTEM = fromString("kstem"); + + /** + * Removes words that are too long or too short. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/miscellaneous/LengthFilter.html. + */ + @Generated + public static final TokenFilterName LENGTH = fromString("length"); + + /** + * Limits the number of tokens while indexing. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/miscellaneous/LimitTokenCountFilter.html. + */ + @Generated + public static final TokenFilterName LIMIT = fromString("limit"); + + /** + * Normalizes token text to lower case. See + * https://lucene.apache.org/core/6_6_1/analyzers-common/org/apache/lucene/analysis/core/LowerCaseFilter.html. + */ + @Generated + public static final TokenFilterName LOWERCASE = fromString("lowercase"); + + /** + * Generates n-grams of the given size(s). See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/ngram/NGramTokenFilter.html. + */ + @Generated + public static final TokenFilterName NGRAM = fromString("nGram_v2"); + + /** + * Applies normalization for Persian. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/fa/PersianNormalizationFilter.html. + */ + @Generated + public static final TokenFilterName PERSIAN_NORMALIZATION = fromString("persian_normalization"); + + /** + * Create tokens for phonetic matches. See + * https://lucene.apache.org/core/4_10_3/analyzers-phonetic/org/apache/lucene/analysis/phonetic/package-tree.html. + */ + @Generated + public static final TokenFilterName PHONETIC = fromString("phonetic"); + + /** + * Uses the Porter stemming algorithm to transform the token stream. See http://tartarus.org/~martin/PorterStemmer. + */ + @Generated + public static final TokenFilterName PORTER_STEM = fromString("porter_stem"); + + /** + * Reverses the token string. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/reverse/ReverseStringFilter.html. + */ + @Generated + public static final TokenFilterName REVERSE = fromString("reverse"); + + /** + * Normalizes use of the interchangeable Scandinavian characters. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/miscellaneous/ScandinavianNormalizationFilter.html. + */ + @Generated + public static final TokenFilterName SCANDINAVIAN_NORMALIZATION = fromString("scandinavian_normalization"); + + /** + * Folds Scandinavian characters åÅäæÄÆ-&gt;a and öÖøØ-&gt;o. It also discriminates against use of double + * vowels aa, ae, ao, oe and oo, leaving just the first one. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/miscellaneous/ScandinavianFoldingFilter.html. + */ + @Generated + public static final TokenFilterName SCANDINAVIAN_FOLDING_NORMALIZATION = fromString("scandinavian_folding"); + + /** + * Creates combinations of tokens as a single token. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/shingle/ShingleFilter.html. + */ + @Generated + public static final TokenFilterName SHINGLE = fromString("shingle"); + + /** + * A filter that stems words using a Snowball-generated stemmer. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/snowball/SnowballFilter.html. + */ + @Generated + public static final TokenFilterName SNOWBALL = fromString("snowball"); + + /** + * Normalizes the Unicode representation of Sorani text. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/ckb/SoraniNormalizationFilter.html. + */ + @Generated + public static final TokenFilterName SORANI_NORMALIZATION = fromString("sorani_normalization"); + + /** + * Language specific stemming filter. See + * https://learn.microsoft.com/rest/api/searchservice/Custom-analyzers-in-Azure-Search#TokenFilters. + */ + @Generated + public static final TokenFilterName STEMMER = fromString("stemmer"); + + /** + * Removes stop words from a token stream. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/core/StopFilter.html. + */ + @Generated + public static final TokenFilterName STOPWORDS = fromString("stopwords"); + + /** + * Trims leading and trailing whitespace from tokens. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/miscellaneous/TrimFilter.html. + */ + @Generated + public static final TokenFilterName TRIM = fromString("trim"); + + /** + * Truncates the terms to a specific length. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/miscellaneous/TruncateTokenFilter.html. + */ + @Generated + public static final TokenFilterName TRUNCATE = fromString("truncate"); + + /** + * Filters out tokens with same text as the previous token. See + * http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/miscellaneous/RemoveDuplicatesTokenFilter.html. + */ + @Generated + public static final TokenFilterName UNIQUE = fromString("unique"); + + /** + * Normalizes token text to upper case. See + * https://lucene.apache.org/core/6_6_1/analyzers-common/org/apache/lucene/analysis/core/UpperCaseFilter.html. + */ + @Generated + public static final TokenFilterName UPPERCASE = fromString("uppercase"); + + /** + * Splits words into subwords and performs optional transformations on subword groups. + */ + @Generated + public static final TokenFilterName WORD_DELIMITER = fromString("word_delimiter"); + + /** + * Creates a new instance of TokenFilterName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public TokenFilterName() { + } + + /** + * Creates or finds a TokenFilterName from its string representation. + * + * @param name a name to look for. + * @return the corresponding TokenFilterName. + */ + @Generated + public static TokenFilterName fromString(String name) { + return fromString(name, TokenFilterName.class); + } + + /** + * Gets known TokenFilterName values. + * + * @return known TokenFilterName values. + */ + @Generated + public static Collection values() { + return values(TokenFilterName.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TruncateTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TruncateTokenFilter.java new file mode 100644 index 000000000000..011afdada163 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/TruncateTokenFilter.java @@ -0,0 +1,126 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Truncates the terms to a specific length. This token filter is implemented using Apache Lucene. + */ +@Fluent +public final class TruncateTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.TruncateTokenFilter"; + + /* + * The length at which terms will be truncated. Default and maximum is 300. + */ + @Generated + private Integer length; + + /** + * Creates an instance of TruncateTokenFilter class. + */ + @Generated + public TruncateTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the length property: The length at which terms will be truncated. Default and maximum is 300. + * + * @return the length value. + */ + @Generated + public Integer getLength() { + return this.length; + } + + /** + * Set the length property: The length at which terms will be truncated. Default and maximum is 300. + * + * @param length the length value to set. + * @return the TruncateTokenFilter object itself. + */ + @Generated + public TruncateTokenFilter setLength(Integer length) { + this.length = length; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public TruncateTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("length", this.length); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TruncateTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TruncateTokenFilter 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 TruncateTokenFilter. + */ + @Generated + public static TruncateTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TruncateTokenFilter deserializedTruncateTokenFilter = new TruncateTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedTruncateTokenFilter.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedTruncateTokenFilter.odataType = reader.getString(); + } else if ("length".equals(fieldName)) { + deserializedTruncateTokenFilter.length = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedTruncateTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/UaxUrlEmailTokenizer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/UaxUrlEmailTokenizer.java new file mode 100644 index 000000000000..53d4d476ba56 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/UaxUrlEmailTokenizer.java @@ -0,0 +1,129 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Tokenizes urls and emails as one token. This tokenizer is implemented using Apache Lucene. + */ +@Fluent +public final class UaxUrlEmailTokenizer extends LexicalTokenizer { + /* + * A URI fragment specifying the type of tokenizer. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.UaxUrlEmailTokenizer"; + + /* + * The maximum token length. Default is 255. Tokens longer than the maximum length are split. The maximum token + * length that can be used is 300 characters. + */ + @Generated + private Integer maxTokenLength; + + /** + * Creates an instance of UaxUrlEmailTokenizer class. + */ + @Generated + public UaxUrlEmailTokenizer() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of tokenizer. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the maxTokenLength property: The maximum token length. Default is 255. Tokens longer than the maximum length + * are split. The maximum token length that can be used is 300 characters. + * + * @return the maxTokenLength value. + */ + @Generated + public Integer getMaxTokenLength() { + return this.maxTokenLength; + } + + /** + * Set the maxTokenLength property: The maximum token length. Default is 255. Tokens longer than the maximum length + * are split. The maximum token length that can be used is 300 characters. + * + * @param maxTokenLength the maxTokenLength value to set. + * @return the UaxUrlEmailTokenizer object itself. + */ + @Generated + public UaxUrlEmailTokenizer setMaxTokenLength(Integer maxTokenLength) { + this.maxTokenLength = maxTokenLength; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public UaxUrlEmailTokenizer setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeNumberField("maxTokenLength", this.maxTokenLength); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UaxUrlEmailTokenizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UaxUrlEmailTokenizer 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 UaxUrlEmailTokenizer. + */ + @Generated + public static UaxUrlEmailTokenizer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UaxUrlEmailTokenizer deserializedUaxUrlEmailTokenizer = new UaxUrlEmailTokenizer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedUaxUrlEmailTokenizer.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedUaxUrlEmailTokenizer.odataType = reader.getString(); + } else if ("maxTokenLength".equals(fieldName)) { + deserializedUaxUrlEmailTokenizer.maxTokenLength = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedUaxUrlEmailTokenizer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/UniqueTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/UniqueTokenFilter.java new file mode 100644 index 000000000000..433cb0a5f988 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/UniqueTokenFilter.java @@ -0,0 +1,128 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Filters out tokens with same text as the previous token. This token filter is implemented using Apache Lucene. + */ +@Fluent +public final class UniqueTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.UniqueTokenFilter"; + + /* + * A value indicating whether to remove duplicates only at the same position. Default is false. + */ + @Generated + private Boolean onlyOnSamePosition; + + /** + * Creates an instance of UniqueTokenFilter class. + */ + @Generated + public UniqueTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the onlyOnSamePosition property: A value indicating whether to remove duplicates only at the same position. + * Default is false. + * + * @return the onlyOnSamePosition value. + */ + @Generated + public Boolean isOnlyOnSamePosition() { + return this.onlyOnSamePosition; + } + + /** + * Set the onlyOnSamePosition property: A value indicating whether to remove duplicates only at the same position. + * Default is false. + * + * @param onlyOnSamePosition the onlyOnSamePosition value to set. + * @return the UniqueTokenFilter object itself. + */ + @Generated + public UniqueTokenFilter setOnlyOnSamePosition(Boolean onlyOnSamePosition) { + this.onlyOnSamePosition = onlyOnSamePosition; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public UniqueTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeBooleanField("onlyOnSamePosition", this.onlyOnSamePosition); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UniqueTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UniqueTokenFilter 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 UniqueTokenFilter. + */ + @Generated + public static UniqueTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UniqueTokenFilter deserializedUniqueTokenFilter = new UniqueTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedUniqueTokenFilter.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedUniqueTokenFilter.odataType = reader.getString(); + } else if ("onlyOnSamePosition".equals(fieldName)) { + deserializedUniqueTokenFilter.onlyOnSamePosition = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedUniqueTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorEncodingFormat.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorEncodingFormat.java new file mode 100644 index 000000000000..303058ff4c0a --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorEncodingFormat.java @@ -0,0 +1,52 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The encoding format for interpreting vector field contents. + */ +public final class VectorEncodingFormat extends ExpandableStringEnum { + /** + * Encoding format representing bits packed into a wider data type. + */ + @Generated + public static final VectorEncodingFormat PACKED_BIT = fromString("packedBit"); + + /** + * Creates a new instance of VectorEncodingFormat value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VectorEncodingFormat() { + } + + /** + * Creates or finds a VectorEncodingFormat from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorEncodingFormat. + */ + @Generated + public static VectorEncodingFormat fromString(String name) { + return fromString(name, VectorEncodingFormat.class); + } + + /** + * Gets known VectorEncodingFormat values. + * + * @return known VectorEncodingFormat values. + */ + @Generated + public static Collection values() { + return values(VectorEncodingFormat.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorFilterMode.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorFilterMode.java new file mode 100644 index 000000000000..fc273e31e026 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorFilterMode.java @@ -0,0 +1,66 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Determines whether or not filters are applied before or after the vector search is performed. + */ +public final class VectorFilterMode extends ExpandableStringEnum { + /** + * The filter will be applied after the candidate set of vector results is returned. Depending on the filter + * selectivity, this can result in fewer results than requested by the parameter 'k'. + */ + @Generated + public static final VectorFilterMode POST_FILTER = fromString("postFilter"); + + /** + * The filter will be applied before the search query. + */ + @Generated + public static final VectorFilterMode PRE_FILTER = fromString("preFilter"); + + /** + * The filter will be applied after the global top-k candidate set of vector results is returned. This will result + * in fewer results than requested by the parameter 'k'. + */ + @Generated + public static final VectorFilterMode STRICT_POST_FILTER = fromString("strictPostFilter"); + + /** + * Creates a new instance of VectorFilterMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VectorFilterMode() { + } + + /** + * Creates or finds a VectorFilterMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorFilterMode. + */ + @Generated + public static VectorFilterMode fromString(String name) { + return fromString(name, VectorFilterMode.class); + } + + /** + * Gets known VectorFilterMode values. + * + * @return known VectorFilterMode values. + */ + @Generated + public static Collection values() { + return values(VectorFilterMode.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorQuery.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorQuery.java new file mode 100644 index 000000000000..baa2b8c2e668 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorQuery.java @@ -0,0 +1,399 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 query parameters for vector and hybrid search queries. + */ +@Fluent +public class VectorQuery implements JsonSerializable { + /* + * The kind of vector query being performed. + */ + @Generated + private VectorQueryKind kind = VectorQueryKind.fromString("VectorQuery"); + + /* + * Number of nearest neighbors to return as top hits. + */ + @Generated + private Integer k; + + /* + * Vector Fields of type Collection(Edm.Single) to be included in the vector searched. + */ + @Generated + private String fields; + + /* + * When true, triggers an exhaustive k-nearest neighbor search across all vectors within the vector index. Useful + * for scenarios where exact matches are critical, such as determining ground truth values. + */ + @Generated + private Boolean exhaustive; + + /* + * Oversampling factor. Minimum value is 1. It overrides the 'defaultOversampling' parameter configured in the index + * definition. It can be set only when 'rerankWithOriginalVectors' is true. This parameter is only permitted when a + * compression method is used on the underlying vector field. + */ + @Generated + private Double oversampling; + + /* + * Relative weight of the vector query when compared to other vector query and/or the text query within the same + * search request. This value is used when combining the results of multiple ranking lists produced by the different + * vector queries and/or the results retrieved through the text query. The higher the weight, the higher the + * documents that matched that query will be in the final ranking. Default is 1.0 and the value needs to be a + * positive number larger than zero. + */ + @Generated + private Float weight; + + /* + * The threshold used for vector queries. Note this can only be set if all 'fields' use the same similarity metric. + */ + @Generated + 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. + */ + @Generated + private String filterOverride; + + /* + * Controls how many vectors can be matched from each document in a vector search query. Setting it to 1 ensures at + * most one vector per document is matched, guaranteeing results come from distinct documents. Setting it to 0 + * (unlimited) allows multiple relevant vectors from the same document to be matched. Default is 0. + */ + @Generated + private Integer perDocumentVectorLimit; + + /** + * Creates an instance of VectorQuery class. + */ + @Generated + public VectorQuery() { + } + + /** + * Get the kind property: The kind of vector query being performed. + * + * @return the kind value. + */ + @Generated + public VectorQueryKind getKind() { + return this.kind; + } + + /** + * Get the k property: Number of nearest neighbors to return as top hits. + * + * @return the k value. + */ + @Generated + public Integer getK() { + return this.k; + } + + /** + * Set the k property: Number of nearest neighbors to return as top hits. + * + * @param k the k value to set. + * @return the VectorQuery object itself. + */ + @Generated + public VectorQuery setK(Integer k) { + this.k = k; + return this; + } + + /** + * Get the fields property: Vector Fields of type Collection(Edm.Single) to be included in the vector searched. + * + * @return the fields value. + */ + @Generated + public String getFields() { + return this.fields; + } + + /** + * Set the fields property: Vector Fields of type Collection(Edm.Single) to be included in the vector searched. + * + * @param fields the fields value to set. + * @return the VectorQuery object itself. + */ + @Generated + public VectorQuery setFields(String fields) { + this.fields = fields; + return this; + } + + /** + * Get the exhaustive property: When true, triggers an exhaustive k-nearest neighbor search across all vectors + * within the vector index. Useful for scenarios where exact matches are critical, such as determining ground truth + * values. + * + * @return the exhaustive value. + */ + @Generated + public Boolean isExhaustive() { + return this.exhaustive; + } + + /** + * Set the exhaustive property: When true, triggers an exhaustive k-nearest neighbor search across all vectors + * within the vector index. Useful for scenarios where exact matches are critical, such as determining ground truth + * values. + * + * @param exhaustive the exhaustive value to set. + * @return the VectorQuery object itself. + */ + @Generated + public VectorQuery setExhaustive(Boolean exhaustive) { + this.exhaustive = exhaustive; + return this; + } + + /** + * Get the oversampling property: Oversampling factor. Minimum value is 1. It overrides the 'defaultOversampling' + * parameter configured in the index definition. It can be set only when 'rerankWithOriginalVectors' is true. This + * parameter is only permitted when a compression method is used on the underlying vector field. + * + * @return the oversampling value. + */ + @Generated + public Double getOversampling() { + return this.oversampling; + } + + /** + * Set the oversampling property: Oversampling factor. Minimum value is 1. It overrides the 'defaultOversampling' + * parameter configured in the index definition. It can be set only when 'rerankWithOriginalVectors' is true. This + * parameter is only permitted when a compression method is used on the underlying vector field. + * + * @param oversampling the oversampling value to set. + * @return the VectorQuery object itself. + */ + @Generated + public VectorQuery setOversampling(Double oversampling) { + this.oversampling = oversampling; + return this; + } + + /** + * Get the weight property: Relative weight of the vector query when compared to other vector query and/or the text + * query within the same search request. This value is used when combining the results of multiple ranking lists + * produced by the different vector queries and/or the results retrieved through the text query. The higher the + * weight, the higher the documents that matched that query will be in the final ranking. Default is 1.0 and the + * value needs to be a positive number larger than zero. + * + * @return the weight value. + */ + @Generated + public Float getWeight() { + return this.weight; + } + + /** + * Set the weight property: Relative weight of the vector query when compared to other vector query and/or the text + * query within the same search request. This value is used when combining the results of multiple ranking lists + * produced by the different vector queries and/or the results retrieved through the text query. The higher the + * weight, the higher the documents that matched that query will be in the final ranking. Default is 1.0 and the + * value needs to be a positive number larger than zero. + * + * @param weight the weight value to set. + * @return the VectorQuery object itself. + */ + @Generated + public VectorQuery setWeight(Float weight) { + this.weight = 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + 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. + */ + @Generated + public VectorQuery setFilterOverride(String filterOverride) { + this.filterOverride = filterOverride; + return this; + } + + /** + * Get the perDocumentVectorLimit property: Controls how many vectors can be matched from each document in a vector + * search query. Setting it to 1 ensures at most one vector per document is matched, guaranteeing results come from + * distinct documents. Setting it to 0 (unlimited) allows multiple relevant vectors from the same document to be + * matched. Default is 0. + * + * @return the perDocumentVectorLimit value. + */ + @Generated + public Integer getPerDocumentVectorLimit() { + return this.perDocumentVectorLimit; + } + + /** + * Set the perDocumentVectorLimit property: Controls how many vectors can be matched from each document in a vector + * search query. Setting it to 1 ensures at most one vector per document is matched, guaranteeing results come from + * distinct documents. Setting it to 0 (unlimited) allows multiple relevant vectors from the same document to be + * matched. Default is 0. + * + * @param perDocumentVectorLimit the perDocumentVectorLimit value to set. + * @return the VectorQuery object itself. + */ + @Generated + public VectorQuery setPerDocumentVectorLimit(Integer perDocumentVectorLimit) { + this.perDocumentVectorLimit = perDocumentVectorLimit; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeNumberField("k", this.k); + jsonWriter.writeStringField("fields", this.fields); + 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); + jsonWriter.writeNumberField("perDocumentVectorLimit", this.perDocumentVectorLimit); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorQuery from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorQuery 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 VectorQuery. + */ + @Generated + public static VectorQuery 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 ("vector".equals(discriminatorValue)) { + return VectorizedQuery.fromJson(readerToUse.reset()); + } else 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 { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static VectorQuery fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorQuery deserializedVectorQuery = new VectorQuery(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedVectorQuery.kind = VectorQueryKind.fromString(reader.getString()); + } else if ("k".equals(fieldName)) { + deserializedVectorQuery.k = reader.getNullable(JsonReader::getInt); + } else if ("fields".equals(fieldName)) { + deserializedVectorQuery.fields = reader.getString(); + } else if ("exhaustive".equals(fieldName)) { + deserializedVectorQuery.exhaustive = reader.getNullable(JsonReader::getBoolean); + } else if ("oversampling".equals(fieldName)) { + 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 if ("perDocumentVectorLimit".equals(fieldName)) { + deserializedVectorQuery.perDocumentVectorLimit = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedVectorQuery; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorQueryKind.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorQueryKind.java new file mode 100644 index 000000000000..284f45fb9025 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorQueryKind.java @@ -0,0 +1,70 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The kind of vector query being performed. + */ +public final class VectorQueryKind extends ExpandableStringEnum { + /** + * Vector query where a raw vector value is provided. + */ + @Generated + public static final VectorQueryKind VECTOR = fromString("vector"); + + /** + * Vector query where a text value that needs to be vectorized is provided. + */ + @Generated + public static final VectorQueryKind TEXT = fromString("text"); + + /** + * Vector query where an url that represents an image value that needs to be vectorized is provided. + */ + @Generated + 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. + */ + @Generated + public static final VectorQueryKind IMAGE_BINARY = fromString("imageBinary"); + + /** + * Creates a new instance of VectorQueryKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VectorQueryKind() { + } + + /** + * Creates or finds a VectorQueryKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorQueryKind. + */ + @Generated + public static VectorQueryKind fromString(String name) { + return fromString(name, VectorQueryKind.class); + } + + /** + * Gets known VectorQueryKind values. + * + * @return known VectorQueryKind values. + */ + @Generated + public static Collection values() { + return values(VectorQueryKind.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearch.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearch.java new file mode 100644 index 000000000000..d5bd2d81fdbc --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearch.java @@ -0,0 +1,199 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Contains configuration options related to vector search. + */ +@Fluent +public final class VectorSearch implements JsonSerializable { + /* + * Defines combinations of configurations to use with vector search. + */ + @Generated + private List profiles; + + /* + * Contains configuration options specific to the algorithm used during indexing or querying. + */ + @Generated + private List algorithms; + + /* + * Contains configuration options on how to vectorize text vector queries. + */ + @Generated + private List vectorizers; + + /* + * Contains configuration options specific to the compression method used during indexing or querying. + */ + @Generated + private List compressions; + + /** + * Creates an instance of VectorSearch class. + */ + @Generated + public VectorSearch() { + } + + /** + * Get the profiles property: Defines combinations of configurations to use with vector search. + * + * @return the profiles value. + */ + @Generated + public List getProfiles() { + return this.profiles; + } + + /** + * Set the profiles property: Defines combinations of configurations to use with vector search. + * + * @param profiles the profiles value to set. + * @return the VectorSearch object itself. + */ + @Generated + public VectorSearch setProfiles(List profiles) { + this.profiles = profiles; + return this; + } + + /** + * Get the algorithms property: Contains configuration options specific to the algorithm used during indexing or + * querying. + * + * @return the algorithms value. + */ + @Generated + public List getAlgorithms() { + return this.algorithms; + } + + /** + * Set the algorithms property: Contains configuration options specific to the algorithm used during indexing or + * querying. + * + * @param algorithms the algorithms value to set. + * @return the VectorSearch object itself. + */ + @Generated + public VectorSearch setAlgorithms(List algorithms) { + this.algorithms = algorithms; + return this; + } + + /** + * Get the vectorizers property: Contains configuration options on how to vectorize text vector queries. + * + * @return the vectorizers value. + */ + @Generated + public List getVectorizers() { + return this.vectorizers; + } + + /** + * Set the vectorizers property: Contains configuration options on how to vectorize text vector queries. + * + * @param vectorizers the vectorizers value to set. + * @return the VectorSearch object itself. + */ + @Generated + public VectorSearch setVectorizers(List vectorizers) { + this.vectorizers = vectorizers; + return this; + } + + /** + * Get the compressions property: Contains configuration options specific to the compression method used during + * indexing or querying. + * + * @return the compressions value. + */ + @Generated + public List getCompressions() { + return this.compressions; + } + + /** + * Set the compressions property: Contains configuration options specific to the compression method used during + * indexing or querying. + * + * @param compressions the compressions value to set. + * @return the VectorSearch object itself. + */ + @Generated + public VectorSearch setCompressions(List compressions) { + this.compressions = compressions; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("profiles", this.profiles, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("algorithms", this.algorithms, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("vectorizers", this.vectorizers, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("compressions", this.compressions, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorSearch from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorSearch 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 VectorSearch. + */ + @Generated + public static VectorSearch fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorSearch deserializedVectorSearch = new VectorSearch(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("profiles".equals(fieldName)) { + List profiles + = reader.readArray(reader1 -> VectorSearchProfile.fromJson(reader1)); + deserializedVectorSearch.profiles = profiles; + } else if ("algorithms".equals(fieldName)) { + List algorithms + = reader.readArray(reader1 -> VectorSearchAlgorithmConfiguration.fromJson(reader1)); + deserializedVectorSearch.algorithms = algorithms; + } else if ("vectorizers".equals(fieldName)) { + List vectorizers + = reader.readArray(reader1 -> VectorSearchVectorizer.fromJson(reader1)); + deserializedVectorSearch.vectorizers = vectorizers; + } else if ("compressions".equals(fieldName)) { + List compressions + = reader.readArray(reader1 -> VectorSearchCompressionConfiguration.fromJson(reader1)); + deserializedVectorSearch.compressions = compressions; + } else { + reader.skipChildren(); + } + } + + return deserializedVectorSearch; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchAlgorithmConfiguration.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchAlgorithmConfiguration.java new file mode 100644 index 000000000000..ffd73f46a335 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchAlgorithmConfiguration.java @@ -0,0 +1,143 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 configuration options specific to the algorithm used during indexing or querying. + */ +@Fluent +public class VectorSearchAlgorithmConfiguration implements JsonSerializable { + /* + * The name of the kind of algorithm being configured for use with vector search. + */ + @Generated + private VectorSearchAlgorithmKind kind = VectorSearchAlgorithmKind.fromString("VectorSearchAlgorithmConfiguration"); + + /* + * The name to associate with this particular configuration. + */ + @Generated + private String name; + + /** + * Creates an instance of VectorSearchAlgorithmConfiguration class. + */ + @Generated + public VectorSearchAlgorithmConfiguration() { + } + + /** + * Get the kind property: The name of the kind of algorithm being configured for use with vector search. + * + * @return the kind value. + */ + @Generated + public VectorSearchAlgorithmKind getKind() { + return this.kind; + } + + /** + * Get the name property: The name to associate with this particular configuration. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name to associate with this particular configuration. + * + * @param name the name value to set. + * @return the VectorSearchAlgorithmConfiguration object itself. + */ + @Generated + public VectorSearchAlgorithmConfiguration setName(String name) { + this.name = name; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorSearchAlgorithmConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorSearchAlgorithmConfiguration 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 VectorSearchAlgorithmConfiguration. + */ + @Generated + public static VectorSearchAlgorithmConfiguration 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 ("hnsw".equals(discriminatorValue)) { + return HnswAlgorithmConfiguration.fromJson(readerToUse.reset()); + } else if ("exhaustiveKnn".equals(discriminatorValue)) { + return ExhaustiveKnnAlgorithmConfiguration.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static VectorSearchAlgorithmConfiguration fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorSearchAlgorithmConfiguration deserializedVectorSearchAlgorithmConfiguration + = new VectorSearchAlgorithmConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedVectorSearchAlgorithmConfiguration.name = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedVectorSearchAlgorithmConfiguration.kind + = VectorSearchAlgorithmKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVectorSearchAlgorithmConfiguration; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchAlgorithmKind.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchAlgorithmKind.java new file mode 100644 index 000000000000..31d4e1d8c071 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchAlgorithmKind.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The algorithm used for indexing and querying. + */ +public final class VectorSearchAlgorithmKind extends ExpandableStringEnum { + /** + * HNSW (Hierarchical Navigable Small World), a type of approximate nearest neighbors algorithm. + */ + @Generated + public static final VectorSearchAlgorithmKind HNSW = fromString("hnsw"); + + /** + * Exhaustive KNN algorithm which will perform brute-force search. + */ + @Generated + public static final VectorSearchAlgorithmKind EXHAUSTIVE_KNN = fromString("exhaustiveKnn"); + + /** + * Creates a new instance of VectorSearchAlgorithmKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VectorSearchAlgorithmKind() { + } + + /** + * Creates or finds a VectorSearchAlgorithmKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorSearchAlgorithmKind. + */ + @Generated + public static VectorSearchAlgorithmKind fromString(String name) { + return fromString(name, VectorSearchAlgorithmKind.class); + } + + /** + * Gets known VectorSearchAlgorithmKind values. + * + * @return known VectorSearchAlgorithmKind values. + */ + @Generated + public static Collection values() { + return values(VectorSearchAlgorithmKind.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchAlgorithmMetric.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchAlgorithmMetric.java new file mode 100644 index 000000000000..1e7402411fe8 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchAlgorithmMetric.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The similarity metric to use for vector comparisons. It is recommended to choose the same similarity metric as the + * embedding model was trained on. + */ +public final class VectorSearchAlgorithmMetric extends ExpandableStringEnum { + /** + * Measures the angle between vectors to quantify their similarity, disregarding magnitude. The smaller the angle, + * the closer the similarity. + */ + @Generated + public static final VectorSearchAlgorithmMetric COSINE = fromString("cosine"); + + /** + * Computes the straight-line distance between vectors in a multi-dimensional space. The smaller the distance, the + * closer the similarity. + */ + @Generated + public static final VectorSearchAlgorithmMetric EUCLIDEAN = fromString("euclidean"); + + /** + * Calculates the sum of element-wise products to gauge alignment and magnitude similarity. The larger and more + * positive, the closer the similarity. + */ + @Generated + public static final VectorSearchAlgorithmMetric DOT_PRODUCT = fromString("dotProduct"); + + /** + * Only applicable to bit-packed binary data types. Determines dissimilarity by counting differing positions in + * binary vectors. The fewer differences, the closer the similarity. + */ + @Generated + public static final VectorSearchAlgorithmMetric HAMMING = fromString("hamming"); + + /** + * Creates a new instance of VectorSearchAlgorithmMetric value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VectorSearchAlgorithmMetric() { + } + + /** + * Creates or finds a VectorSearchAlgorithmMetric from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorSearchAlgorithmMetric. + */ + @Generated + public static VectorSearchAlgorithmMetric fromString(String name) { + return fromString(name, VectorSearchAlgorithmMetric.class); + } + + /** + * Gets known VectorSearchAlgorithmMetric values. + * + * @return known VectorSearchAlgorithmMetric values. + */ + @Generated + public static Collection values() { + return values(VectorSearchAlgorithmMetric.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchCompressionConfiguration.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchCompressionConfiguration.java new file mode 100644 index 000000000000..7b920390b657 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchCompressionConfiguration.java @@ -0,0 +1,301 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 configuration options specific to the compression method used during indexing or querying. + */ +@Fluent +public class VectorSearchCompressionConfiguration implements JsonSerializable { + /* + * The name of the kind of compression method being configured for use with vector search. + */ + @Generated + private VectorSearchCompressionKind kind + = VectorSearchCompressionKind.fromString("VectorSearchCompressionConfiguration"); + + /* + * The name to associate with this particular configuration. + */ + @Generated + private String name; + + /* + * If set to true, once the ordered set of results calculated using compressed vectors are obtained, they will be + * reranked again by recalculating the full-precision similarity scores. This will improve recall at the expense of + * latency. + */ + @Generated + private Boolean rerankWithOriginalVectors; + + /* + * Default oversampling factor. Oversampling will internally request more documents (specified by this multiplier) + * in the initial search. This increases the set of results that will be reranked using recomputed similarity scores + * from full-precision vectors. Minimum value is 1, meaning no oversampling (1x). This parameter can only be set + * when rerankWithOriginalVectors is true. Higher values improve recall at the expense of latency. + */ + @Generated + private Double defaultOversampling; + + /* + * Contains the options for rescoring. + */ + @Generated + private RescoringOptions rescoringOptions; + + /* + * The number of dimensions to truncate the vectors to. Truncating the vectors reduces the size of the vectors and + * the amount of data that needs to be transferred during search. This can save storage cost and improve search + * performance at the expense of recall. It should be only used for embeddings trained with Matryoshka + * Representation Learning (MRL) such as OpenAI text-embedding-3-large (small). The default value is null, which + * means no truncation. + */ + @Generated + private Integer truncationDimension; + + /** + * Creates an instance of VectorSearchCompressionConfiguration class. + */ + @Generated + public VectorSearchCompressionConfiguration() { + } + + /** + * Get the kind property: The name of the kind of compression method being configured for use with vector search. + * + * @return the kind value. + */ + @Generated + public VectorSearchCompressionKind getKind() { + return this.kind; + } + + /** + * Get the name property: The name to associate with this particular configuration. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name to associate with this particular configuration. + * + * @param name the name value to set. + * @return the VectorSearchCompressionConfiguration object itself. + */ + @Generated + public VectorSearchCompressionConfiguration setName(String name) { + this.name = name; + return this; + } + + /** + * Get the rerankWithOriginalVectors property: If set to true, once the ordered set of results calculated using + * compressed vectors are obtained, they will be reranked again by recalculating the full-precision similarity + * scores. This will improve recall at the expense of latency. + * + * @return the rerankWithOriginalVectors value. + */ + @Generated + public Boolean isRerankWithOriginalVectors() { + return this.rerankWithOriginalVectors; + } + + /** + * Set the rerankWithOriginalVectors property: If set to true, once the ordered set of results calculated using + * compressed vectors are obtained, they will be reranked again by recalculating the full-precision similarity + * scores. This will improve recall at the expense of latency. + * + * @param rerankWithOriginalVectors the rerankWithOriginalVectors value to set. + * @return the VectorSearchCompressionConfiguration object itself. + */ + @Generated + public VectorSearchCompressionConfiguration setRerankWithOriginalVectors(Boolean rerankWithOriginalVectors) { + this.rerankWithOriginalVectors = rerankWithOriginalVectors; + return this; + } + + /** + * Get the defaultOversampling property: Default oversampling factor. Oversampling will internally request more + * documents (specified by this multiplier) in the initial search. This increases the set of results that will be + * reranked using recomputed similarity scores from full-precision vectors. Minimum value is 1, meaning no + * oversampling (1x). This parameter can only be set when rerankWithOriginalVectors is true. Higher values improve + * recall at the expense of latency. + * + * @return the defaultOversampling value. + */ + @Generated + public Double getDefaultOversampling() { + return this.defaultOversampling; + } + + /** + * Set the defaultOversampling property: Default oversampling factor. Oversampling will internally request more + * documents (specified by this multiplier) in the initial search. This increases the set of results that will be + * reranked using recomputed similarity scores from full-precision vectors. Minimum value is 1, meaning no + * oversampling (1x). This parameter can only be set when rerankWithOriginalVectors is true. Higher values improve + * recall at the expense of latency. + * + * @param defaultOversampling the defaultOversampling value to set. + * @return the VectorSearchCompressionConfiguration object itself. + */ + @Generated + public VectorSearchCompressionConfiguration setDefaultOversampling(Double defaultOversampling) { + this.defaultOversampling = defaultOversampling; + return this; + } + + /** + * Get the rescoringOptions property: Contains the options for rescoring. + * + * @return the rescoringOptions value. + */ + @Generated + public RescoringOptions getRescoringOptions() { + return this.rescoringOptions; + } + + /** + * Set the rescoringOptions property: Contains the options for rescoring. + * + * @param rescoringOptions the rescoringOptions value to set. + * @return the VectorSearchCompressionConfiguration object itself. + */ + @Generated + public VectorSearchCompressionConfiguration setRescoringOptions(RescoringOptions rescoringOptions) { + this.rescoringOptions = rescoringOptions; + return this; + } + + /** + * Get the truncationDimension property: The number of dimensions to truncate the vectors to. Truncating the vectors + * reduces the size of the vectors and the amount of data that needs to be transferred during search. This can save + * storage cost and improve search performance at the expense of recall. It should be only used for embeddings + * trained with Matryoshka Representation Learning (MRL) such as OpenAI text-embedding-3-large (small). The default + * value is null, which means no truncation. + * + * @return the truncationDimension value. + */ + @Generated + public Integer getTruncationDimension() { + return this.truncationDimension; + } + + /** + * Set the truncationDimension property: The number of dimensions to truncate the vectors to. Truncating the vectors + * reduces the size of the vectors and the amount of data that needs to be transferred during search. This can save + * storage cost and improve search performance at the expense of recall. It should be only used for embeddings + * trained with Matryoshka Representation Learning (MRL) such as OpenAI text-embedding-3-large (small). The default + * value is null, which means no truncation. + * + * @param truncationDimension the truncationDimension value to set. + * @return the VectorSearchCompressionConfiguration object itself. + */ + @Generated + public VectorSearchCompressionConfiguration setTruncationDimension(Integer truncationDimension) { + this.truncationDimension = truncationDimension; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeBooleanField("rerankWithOriginalVectors", this.rerankWithOriginalVectors); + jsonWriter.writeNumberField("defaultOversampling", this.defaultOversampling); + jsonWriter.writeJsonField("rescoringOptions", this.rescoringOptions); + jsonWriter.writeNumberField("truncationDimension", this.truncationDimension); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorSearchCompressionConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorSearchCompressionConfiguration 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 VectorSearchCompressionConfiguration. + */ + @Generated + public static VectorSearchCompressionConfiguration 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 ("scalarQuantization".equals(discriminatorValue)) { + return ScalarQuantizationCompressionConfiguration.fromJson(readerToUse.reset()); + } else if ("binaryQuantization".equals(discriminatorValue)) { + return BinaryQuantizationCompressionConfiguration.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static VectorSearchCompressionConfiguration fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorSearchCompressionConfiguration deserializedVectorSearchCompressionConfiguration + = new VectorSearchCompressionConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedVectorSearchCompressionConfiguration.name = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedVectorSearchCompressionConfiguration.kind + = VectorSearchCompressionKind.fromString(reader.getString()); + } else if ("rerankWithOriginalVectors".equals(fieldName)) { + deserializedVectorSearchCompressionConfiguration.rerankWithOriginalVectors + = reader.getNullable(JsonReader::getBoolean); + } else if ("defaultOversampling".equals(fieldName)) { + deserializedVectorSearchCompressionConfiguration.defaultOversampling + = reader.getNullable(JsonReader::getDouble); + } else if ("rescoringOptions".equals(fieldName)) { + deserializedVectorSearchCompressionConfiguration.rescoringOptions + = RescoringOptions.fromJson(reader); + } else if ("truncationDimension".equals(fieldName)) { + deserializedVectorSearchCompressionConfiguration.truncationDimension + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedVectorSearchCompressionConfiguration; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchCompressionKind.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchCompressionKind.java new file mode 100644 index 000000000000..931ab3fd715f --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchCompressionKind.java @@ -0,0 +1,62 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The compression method used for indexing and querying. + */ +public final class VectorSearchCompressionKind extends ExpandableStringEnum { + /** + * Scalar Quantization, a type of compression method. In scalar quantization, the original vectors values are + * compressed to a narrower type by discretizing and representing each component of a vector using a reduced set of + * quantized values, thereby reducing the overall data size. + */ + @Generated + public static final VectorSearchCompressionKind SCALAR_QUANTIZATION = fromString("scalarQuantization"); + + /** + * Binary Quantization, a type of compression method. In binary quantization, the original vectors values are + * compressed to the narrower binary type by discretizing and representing each component of a vector using binary + * values, thereby reducing the overall data size. + */ + @Generated + public static final VectorSearchCompressionKind BINARY_QUANTIZATION = fromString("binaryQuantization"); + + /** + * Creates a new instance of VectorSearchCompressionKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VectorSearchCompressionKind() { + } + + /** + * Creates or finds a VectorSearchCompressionKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorSearchCompressionKind. + */ + @Generated + public static VectorSearchCompressionKind fromString(String name) { + return fromString(name, VectorSearchCompressionKind.class); + } + + /** + * Gets known VectorSearchCompressionKind values. + * + * @return known VectorSearchCompressionKind values. + */ + @Generated + public static Collection values() { + return values(VectorSearchCompressionKind.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchCompressionRescoreStorageMethod.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchCompressionRescoreStorageMethod.java new file mode 100644 index 000000000000..f3418dd4b619 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchCompressionRescoreStorageMethod.java @@ -0,0 +1,63 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The storage method for the original full-precision vectors used for rescoring and internal index operations. + */ +public final class VectorSearchCompressionRescoreStorageMethod + extends ExpandableStringEnum { + /** + * This option preserves the original full-precision vectors. Choose this option for maximum flexibility and highest + * quality of compressed search results. This consumes more storage but allows for rescoring and oversampling. + */ + @Generated + public static final VectorSearchCompressionRescoreStorageMethod PRESERVE_ORIGINALS + = fromString("preserveOriginals"); + + /** + * This option discards the original full-precision vectors. Choose this option for maximum storage savings. Since + * this option does not allow for rescoring and oversampling, it will often cause slight to moderate reductions in + * quality. + */ + @Generated + public static final VectorSearchCompressionRescoreStorageMethod DISCARD_ORIGINALS = fromString("discardOriginals"); + + /** + * Creates a new instance of VectorSearchCompressionRescoreStorageMethod value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VectorSearchCompressionRescoreStorageMethod() { + } + + /** + * Creates or finds a VectorSearchCompressionRescoreStorageMethod from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorSearchCompressionRescoreStorageMethod. + */ + @Generated + public static VectorSearchCompressionRescoreStorageMethod fromString(String name) { + return fromString(name, VectorSearchCompressionRescoreStorageMethod.class); + } + + /** + * Gets known VectorSearchCompressionRescoreStorageMethod values. + * + * @return known VectorSearchCompressionRescoreStorageMethod values. + */ + @Generated + public static Collection values() { + return values(VectorSearchCompressionRescoreStorageMethod.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchCompressionTargetDataType.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchCompressionTargetDataType.java new file mode 100644 index 000000000000..aac671e9b424 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchCompressionTargetDataType.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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The quantized data type of compressed vector values. + */ +public final class VectorSearchCompressionTargetDataType + extends ExpandableStringEnum { + /** + * Static value int8 for VectorSearchCompressionTargetDataType. + */ + @Generated + public static final VectorSearchCompressionTargetDataType INT8 = fromString("int8"); + + /** + * Creates a new instance of VectorSearchCompressionTargetDataType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VectorSearchCompressionTargetDataType() { + } + + /** + * Creates or finds a VectorSearchCompressionTargetDataType from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorSearchCompressionTargetDataType. + */ + @Generated + public static VectorSearchCompressionTargetDataType fromString(String name) { + return fromString(name, VectorSearchCompressionTargetDataType.class); + } + + /** + * Gets known VectorSearchCompressionTargetDataType values. + * + * @return known VectorSearchCompressionTargetDataType values. + */ + @Generated + public static Collection values() { + return values(VectorSearchCompressionTargetDataType.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchProfile.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchProfile.java new file mode 100644 index 000000000000..4d2090154e55 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchProfile.java @@ -0,0 +1,191 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines a combination of configurations to use with vector search. + */ +@Fluent +public final class VectorSearchProfile implements JsonSerializable { + /* + * The name to associate with this particular vector search profile. + */ + @Generated + private String name; + + /* + * The name of the vector search algorithm configuration that specifies the algorithm and optional parameters. + */ + @Generated + private String algorithmConfigurationName; + + /* + * The name of the vectorization being configured for use with vector search. + */ + @Generated + private String vectorizerName; + + /* + * The name of the compression method configuration that specifies the compression method and optional parameters. + */ + @Generated + private String compressionConfigurationName; + + /** + * Creates an instance of VectorSearchProfile class. + */ + @Generated + public VectorSearchProfile() { + } + + /** + * Get the name property: The name to associate with this particular vector search profile. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name to associate with this particular vector search profile. + * + * @param name the name value to set. + * @return the VectorSearchProfile object itself. + */ + @Generated + public VectorSearchProfile setName(String name) { + this.name = name; + return this; + } + + /** + * Get the algorithmConfigurationName property: The name of the vector search algorithm configuration that specifies + * the algorithm and optional parameters. + * + * @return the algorithmConfigurationName value. + */ + @Generated + public String getAlgorithmConfigurationName() { + return this.algorithmConfigurationName; + } + + /** + * Set the algorithmConfigurationName property: The name of the vector search algorithm configuration that specifies + * the algorithm and optional parameters. + * + * @param algorithmConfigurationName the algorithmConfigurationName value to set. + * @return the VectorSearchProfile object itself. + */ + @Generated + public VectorSearchProfile setAlgorithmConfigurationName(String algorithmConfigurationName) { + this.algorithmConfigurationName = algorithmConfigurationName; + return this; + } + + /** + * Get the vectorizerName property: The name of the vectorization being configured for use with vector search. + * + * @return the vectorizerName value. + */ + @Generated + public String getVectorizerName() { + return this.vectorizerName; + } + + /** + * Set the vectorizerName property: The name of the vectorization being configured for use with vector search. + * + * @param vectorizerName the vectorizerName value to set. + * @return the VectorSearchProfile object itself. + */ + @Generated + public VectorSearchProfile setVectorizerName(String vectorizerName) { + this.vectorizerName = vectorizerName; + return this; + } + + /** + * Get the compressionConfigurationName property: The name of the compression method configuration that specifies + * the compression method and optional parameters. + * + * @return the compressionConfigurationName value. + */ + @Generated + public String getCompressionConfigurationName() { + return this.compressionConfigurationName; + } + + /** + * Set the compressionConfigurationName property: The name of the compression method configuration that specifies + * the compression method and optional parameters. + * + * @param compressionConfigurationName the compressionConfigurationName value to set. + * @return the VectorSearchProfile object itself. + */ + @Generated + public VectorSearchProfile setCompressionConfigurationName(String compressionConfigurationName) { + this.compressionConfigurationName = compressionConfigurationName; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("algorithm", this.algorithmConfigurationName); + jsonWriter.writeStringField("vectorizer", this.vectorizerName); + jsonWriter.writeStringField("compression", this.compressionConfigurationName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorSearchProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorSearchProfile 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 VectorSearchProfile. + */ + @Generated + public static VectorSearchProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorSearchProfile deserializedVectorSearchProfile = new VectorSearchProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedVectorSearchProfile.name = reader.getString(); + } else if ("algorithm".equals(fieldName)) { + deserializedVectorSearchProfile.algorithmConfigurationName = reader.getString(); + } else if ("vectorizer".equals(fieldName)) { + deserializedVectorSearchProfile.vectorizerName = reader.getString(); + } else if ("compression".equals(fieldName)) { + deserializedVectorSearchProfile.compressionConfigurationName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVectorSearchProfile; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchVectorizer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchVectorizer.java new file mode 100644 index 000000000000..325e4c6474fd --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchVectorizer.java @@ -0,0 +1,145 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specifies the vectorization method to be used during query time. + */ +@Fluent +public class VectorSearchVectorizer implements JsonSerializable { + /* + * The name of the kind of vectorization method being configured for use with vector search. + */ + @Generated + private VectorSearchVectorizerKind kind = VectorSearchVectorizerKind.fromString("VectorSearchVectorizer"); + + /* + * The name to associate with this particular vectorization method. + */ + @Generated + private String name; + + /** + * Creates an instance of VectorSearchVectorizer class. + */ + @Generated + public VectorSearchVectorizer() { + } + + /** + * Get the kind property: The name of the kind of vectorization method being configured for use with vector search. + * + * @return the kind value. + */ + @Generated + public VectorSearchVectorizerKind getKind() { + return this.kind; + } + + /** + * Get the name property: The name to associate with this particular vectorization method. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name to associate with this particular vectorization method. + * + * @param name the name value to set. + * @return the VectorSearchVectorizer object itself. + */ + @Generated + public VectorSearchVectorizer setName(String name) { + this.name = name; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorSearchVectorizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorSearchVectorizer 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 VectorSearchVectorizer. + */ + @Generated + public static VectorSearchVectorizer 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 ("azureOpenAI".equals(discriminatorValue)) { + return AzureOpenAIVectorizer.fromJson(readerToUse.reset()); + } else if ("customWebApi".equals(discriminatorValue)) { + return WebApiVectorizer.fromJson(readerToUse.reset()); + } else if ("aiServicesVision".equals(discriminatorValue)) { + return AIServicesVisionVectorizer.fromJson(readerToUse.reset()); + } else if ("aml".equals(discriminatorValue)) { + return AMLVectorizer.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static VectorSearchVectorizer fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorSearchVectorizer deserializedVectorSearchVectorizer = new VectorSearchVectorizer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedVectorSearchVectorizer.name = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedVectorSearchVectorizer.kind = VectorSearchVectorizerKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVectorSearchVectorizer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchVectorizerKind.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchVectorizerKind.java new file mode 100644 index 000000000000..4d7307d156b1 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSearchVectorizerKind.java @@ -0,0 +1,71 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The vectorization method to be used during query time. + */ +public final class VectorSearchVectorizerKind extends ExpandableStringEnum { + /** + * Generate embeddings using an Azure OpenAI resource at query time. + */ + @Generated + public static final VectorSearchVectorizerKind AZURE_OPEN_AI = fromString("azureOpenAI"); + + /** + * Generate embeddings using a custom web endpoint at query time. + */ + @Generated + public static final VectorSearchVectorizerKind CUSTOM_WEB_API = fromString("customWebApi"); + + /** + * Generate embeddings for an image or text input at query time using the Azure AI Services Vision Vectorize API. + */ + @Generated + public static final VectorSearchVectorizerKind AISERVICES_VISION = fromString("aiServicesVision"); + + /** + * Generate embeddings using an Azure Machine Learning endpoint deployed via the Azure AI Foundry Model Catalog at + * query time. + */ + @Generated + public static final VectorSearchVectorizerKind AML = fromString("aml"); + + /** + * Creates a new instance of VectorSearchVectorizerKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VectorSearchVectorizerKind() { + } + + /** + * Creates or finds a VectorSearchVectorizerKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorSearchVectorizerKind. + */ + @Generated + public static VectorSearchVectorizerKind fromString(String name) { + return fromString(name, VectorSearchVectorizerKind.class); + } + + /** + * Gets known VectorSearchVectorizerKind values. + * + * @return known VectorSearchVectorizerKind values. + */ + @Generated + public static Collection values() { + return values(VectorSearchVectorizerKind.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSimilarityThreshold.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSimilarityThreshold.java new file mode 100644 index 000000000000..2ba6f9c00e90 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorSimilarityThreshold.java @@ -0,0 +1,121 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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. + */ +@Fluent +public final class VectorSimilarityThreshold extends VectorThreshold { + /* + * The kind of threshold used to filter vector queries + */ + @Generated + 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. + */ + @Generated + private double value; + + /** + * Creates an instance of VectorSimilarityThreshold class. + */ + @Generated + public VectorSimilarityThreshold() { + } + + /** + * Get the kind property: The kind of threshold used to filter vector queries. + * + * @return the kind value. + */ + @Generated + @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. + */ + @Generated + public double getValue() { + return this.value; + } + + /** + * Set 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. + * + * @param value the value value to set. + * @return the VectorSimilarityThreshold object itself. + */ + @Generated + public VectorSimilarityThreshold setValue(double value) { + this.value = value; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + public static VectorSimilarityThreshold fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorSimilarityThreshold deserializedVectorSimilarityThreshold = new VectorSimilarityThreshold(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + deserializedVectorSimilarityThreshold.value = reader.getDouble(); + } else if ("kind".equals(fieldName)) { + deserializedVectorSimilarityThreshold.kind = VectorThresholdKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVectorSimilarityThreshold; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorThreshold.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorThreshold.java new file mode 100644 index 000000000000..e5854238d2d1 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorThreshold.java @@ -0,0 +1,109 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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 + */ + @Generated + private VectorThresholdKind kind = VectorThresholdKind.fromString("VectorThreshold"); + + /** + * Creates an instance of VectorThreshold class. + */ + @Generated + public VectorThreshold() { + } + + /** + * Get the kind property: The kind of threshold used to filter vector queries. + * + * @return the kind value. + */ + @Generated + public VectorThresholdKind getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + 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()); + } + } + }); + } + + @Generated + 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/search/src/main/java/com/azure/search/models/VectorThresholdKind.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorThresholdKind.java new file mode 100644 index 000000000000..68fc57b60e88 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorThresholdKind.java @@ -0,0 +1,62 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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. + */ + @Generated + 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. + */ + @Generated + public static final VectorThresholdKind SEARCH_SCORE = fromString("searchScore"); + + /** + * Creates a new instance of VectorThresholdKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VectorThresholdKind() { + } + + /** + * Creates or finds a VectorThresholdKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding VectorThresholdKind. + */ + @Generated + public static VectorThresholdKind fromString(String name) { + return fromString(name, VectorThresholdKind.class); + } + + /** + * Gets known VectorThresholdKind values. + * + * @return known VectorThresholdKind values. + */ + @Generated + public static Collection values() { + return values(VectorThresholdKind.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorizableImageBinaryQuery.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorizableImageBinaryQuery.java new file mode 100644 index 000000000000..679dc3bdb5cf --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorizableImageBinaryQuery.java @@ -0,0 +1,220 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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. + */ + @Generated + private VectorQueryKind kind = VectorQueryKind.IMAGE_BINARY; + + /* + * The base 64 encoded binary of an image to be vectorized to perform a vector search query. + */ + @Generated + private String base64Image; + + /** + * Creates an instance of VectorizableImageBinaryQuery class. + */ + @Generated + public VectorizableImageBinaryQuery() { + } + + /** + * Get the kind property: The kind of vector query being performed. + * + * @return the kind value. + */ + @Generated + @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. + */ + @Generated + 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. + */ + @Generated + public VectorizableImageBinaryQuery setBase64Image(String base64Image) { + this.base64Image = base64Image; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableImageBinaryQuery setK(Integer k) { + super.setK(k); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableImageBinaryQuery setFields(String fields) { + super.setFields(fields); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableImageBinaryQuery setExhaustive(Boolean exhaustive) { + super.setExhaustive(exhaustive); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableImageBinaryQuery setOversampling(Double oversampling) { + super.setOversampling(oversampling); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableImageBinaryQuery setWeight(Float weight) { + super.setWeight(weight); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableImageBinaryQuery setThreshold(VectorThreshold threshold) { + super.setThreshold(threshold); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableImageBinaryQuery setFilterOverride(String filterOverride) { + super.setFilterOverride(filterOverride); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableImageBinaryQuery setPerDocumentVectorLimit(Integer perDocumentVectorLimit) { + super.setPerDocumentVectorLimit(perDocumentVectorLimit); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("k", getK()); + 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.writeNumberField("perDocumentVectorLimit", getPerDocumentVectorLimit()); + 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. + */ + @Generated + 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.setK(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 ("perDocumentVectorLimit".equals(fieldName)) { + deserializedVectorizableImageBinaryQuery + .setPerDocumentVectorLimit(reader.getNullable(JsonReader::getInt)); + } 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/search/src/main/java/com/azure/search/models/VectorizableImageUrlQuery.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorizableImageUrlQuery.java new file mode 100644 index 000000000000..7d144d4b313c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorizableImageUrlQuery.java @@ -0,0 +1,218 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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. + */ + @Generated + private VectorQueryKind kind = VectorQueryKind.IMAGE_URL; + + /* + * The URL of an image to be vectorized to perform a vector search query. + */ + @Generated + private String url; + + /** + * Creates an instance of VectorizableImageUrlQuery class. + */ + @Generated + public VectorizableImageUrlQuery() { + } + + /** + * Get the kind property: The kind of vector query being performed. + * + * @return the kind value. + */ + @Generated + @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. + */ + @Generated + 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. + */ + @Generated + public VectorizableImageUrlQuery setUrl(String url) { + this.url = url; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableImageUrlQuery setK(Integer k) { + super.setK(k); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableImageUrlQuery setFields(String fields) { + super.setFields(fields); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableImageUrlQuery setExhaustive(Boolean exhaustive) { + super.setExhaustive(exhaustive); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableImageUrlQuery setOversampling(Double oversampling) { + super.setOversampling(oversampling); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableImageUrlQuery setWeight(Float weight) { + super.setWeight(weight); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableImageUrlQuery setThreshold(VectorThreshold threshold) { + super.setThreshold(threshold); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableImageUrlQuery setFilterOverride(String filterOverride) { + super.setFilterOverride(filterOverride); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableImageUrlQuery setPerDocumentVectorLimit(Integer perDocumentVectorLimit) { + super.setPerDocumentVectorLimit(perDocumentVectorLimit); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("k", getK()); + 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.writeNumberField("perDocumentVectorLimit", getPerDocumentVectorLimit()); + 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. + */ + @Generated + 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.setK(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 ("perDocumentVectorLimit".equals(fieldName)) { + deserializedVectorizableImageUrlQuery + .setPerDocumentVectorLimit(reader.getNullable(JsonReader::getInt)); + } 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/search/src/main/java/com/azure/search/models/VectorizableTextQuery.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorizableTextQuery.java new file mode 100644 index 000000000000..36e9616883ba --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorizableTextQuery.java @@ -0,0 +1,250 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 text value that needs to be vectorized is provided. + */ +@Fluent +public final class VectorizableTextQuery extends VectorQuery { + /* + * The kind of vector query being performed. + */ + @Generated + private VectorQueryKind kind = VectorQueryKind.TEXT; + + /* + * The text to be vectorized to perform a vector search query. + */ + @Generated + private String text; + + /* + * Can be configured to let a generative model rewrite the query before sending it to be vectorized. + */ + @Generated + private QueryRewritesType queryRewrites; + + /** + * Creates an instance of VectorizableTextQuery class. + */ + @Generated + public VectorizableTextQuery() { + } + + /** + * Get the kind property: The kind of vector query being performed. + * + * @return the kind value. + */ + @Generated + @Override + public VectorQueryKind getKind() { + return this.kind; + } + + /** + * Get the text property: The text to be vectorized to perform a vector search query. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Set the text property: The text to be vectorized to perform a vector search query. + * + * @param text the text value to set. + * @return the VectorizableTextQuery object itself. + */ + @Generated + public VectorizableTextQuery setText(String text) { + this.text = text; + return this; + } + + /** + * Get the queryRewrites property: Can be configured to let a generative model rewrite the query before sending it + * to be vectorized. + * + * @return the queryRewrites value. + */ + @Generated + public QueryRewritesType getQueryRewrites() { + return this.queryRewrites; + } + + /** + * Set the queryRewrites property: Can be configured to let a generative model rewrite the query before sending it + * to be vectorized. + * + * @param queryRewrites the queryRewrites value to set. + * @return the VectorizableTextQuery object itself. + */ + @Generated + public VectorizableTextQuery setQueryRewrites(QueryRewritesType queryRewrites) { + this.queryRewrites = queryRewrites; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableTextQuery setK(Integer k) { + super.setK(k); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableTextQuery setFields(String fields) { + super.setFields(fields); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableTextQuery setExhaustive(Boolean exhaustive) { + super.setExhaustive(exhaustive); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableTextQuery setOversampling(Double oversampling) { + super.setOversampling(oversampling); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableTextQuery setWeight(Float weight) { + super.setWeight(weight); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableTextQuery setThreshold(VectorThreshold threshold) { + super.setThreshold(threshold); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableTextQuery setFilterOverride(String filterOverride) { + super.setFilterOverride(filterOverride); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizableTextQuery setPerDocumentVectorLimit(Integer perDocumentVectorLimit) { + super.setPerDocumentVectorLimit(perDocumentVectorLimit); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("k", getK()); + 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.writeNumberField("perDocumentVectorLimit", getPerDocumentVectorLimit()); + jsonWriter.writeStringField("text", this.text); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("queryRewrites", this.queryRewrites == null ? null : this.queryRewrites.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorizableTextQuery from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorizableTextQuery 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 VectorizableTextQuery. + */ + @Generated + public static VectorizableTextQuery fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorizableTextQuery deserializedVectorizableTextQuery = new VectorizableTextQuery(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("k".equals(fieldName)) { + deserializedVectorizableTextQuery.setK(reader.getNullable(JsonReader::getInt)); + } else if ("fields".equals(fieldName)) { + deserializedVectorizableTextQuery.setFields(reader.getString()); + } else if ("exhaustive".equals(fieldName)) { + deserializedVectorizableTextQuery.setExhaustive(reader.getNullable(JsonReader::getBoolean)); + } else if ("oversampling".equals(fieldName)) { + deserializedVectorizableTextQuery.setOversampling(reader.getNullable(JsonReader::getDouble)); + } else if ("weight".equals(fieldName)) { + deserializedVectorizableTextQuery.setWeight(reader.getNullable(JsonReader::getFloat)); + } else if ("threshold".equals(fieldName)) { + deserializedVectorizableTextQuery.setThreshold(VectorThreshold.fromJson(reader)); + } else if ("filterOverride".equals(fieldName)) { + deserializedVectorizableTextQuery.setFilterOverride(reader.getString()); + } else if ("perDocumentVectorLimit".equals(fieldName)) { + deserializedVectorizableTextQuery.setPerDocumentVectorLimit(reader.getNullable(JsonReader::getInt)); + } else if ("text".equals(fieldName)) { + deserializedVectorizableTextQuery.text = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedVectorizableTextQuery.kind = VectorQueryKind.fromString(reader.getString()); + } else if ("queryRewrites".equals(fieldName)) { + deserializedVectorizableTextQuery.queryRewrites = QueryRewritesType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVectorizableTextQuery; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorizedQuery.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorizedQuery.java new file mode 100644 index 000000000000..ad5301066221 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorizedQuery.java @@ -0,0 +1,219 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The query parameters to use for vector search when a raw vector value is provided. + */ +@Fluent +public final class VectorizedQuery extends VectorQuery { + /* + * The kind of vector query being performed. + */ + @Generated + private VectorQueryKind kind = VectorQueryKind.VECTOR; + + /* + * The vector representation of a search query. + */ + @Generated + private List vector; + + /** + * Creates an instance of VectorizedQuery class. + */ + @Generated + public VectorizedQuery() { + } + + /** + * Get the kind property: The kind of vector query being performed. + * + * @return the kind value. + */ + @Generated + @Override + public VectorQueryKind getKind() { + return this.kind; + } + + /** + * Get the vector property: The vector representation of a search query. + * + * @return the vector value. + */ + @Generated + public List getVector() { + return this.vector; + } + + /** + * Set the vector property: The vector representation of a search query. + * + * @param vector the vector value to set. + * @return the VectorizedQuery object itself. + */ + @Generated + public VectorizedQuery setVector(List vector) { + this.vector = vector; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizedQuery setK(Integer k) { + super.setK(k); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizedQuery setFields(String fields) { + super.setFields(fields); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizedQuery setExhaustive(Boolean exhaustive) { + super.setExhaustive(exhaustive); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizedQuery setOversampling(Double oversampling) { + super.setOversampling(oversampling); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizedQuery setWeight(Float weight) { + super.setWeight(weight); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizedQuery setThreshold(VectorThreshold threshold) { + super.setThreshold(threshold); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizedQuery setFilterOverride(String filterOverride) { + super.setFilterOverride(filterOverride); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VectorizedQuery setPerDocumentVectorLimit(Integer perDocumentVectorLimit) { + super.setPerDocumentVectorLimit(perDocumentVectorLimit); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("k", getK()); + 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.writeNumberField("perDocumentVectorLimit", getPerDocumentVectorLimit()); + jsonWriter.writeArrayField("vector", this.vector, (writer, element) -> writer.writeFloat(element)); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VectorizedQuery from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VectorizedQuery 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 VectorizedQuery. + */ + @Generated + public static VectorizedQuery fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorizedQuery deserializedVectorizedQuery = new VectorizedQuery(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("k".equals(fieldName)) { + deserializedVectorizedQuery.setK(reader.getNullable(JsonReader::getInt)); + } else if ("fields".equals(fieldName)) { + deserializedVectorizedQuery.setFields(reader.getString()); + } else if ("exhaustive".equals(fieldName)) { + deserializedVectorizedQuery.setExhaustive(reader.getNullable(JsonReader::getBoolean)); + } else if ("oversampling".equals(fieldName)) { + deserializedVectorizedQuery.setOversampling(reader.getNullable(JsonReader::getDouble)); + } else if ("weight".equals(fieldName)) { + deserializedVectorizedQuery.setWeight(reader.getNullable(JsonReader::getFloat)); + } else if ("threshold".equals(fieldName)) { + deserializedVectorizedQuery.setThreshold(VectorThreshold.fromJson(reader)); + } else if ("filterOverride".equals(fieldName)) { + deserializedVectorizedQuery.setFilterOverride(reader.getString()); + } else if ("perDocumentVectorLimit".equals(fieldName)) { + deserializedVectorizedQuery.setPerDocumentVectorLimit(reader.getNullable(JsonReader::getInt)); + } else if ("vector".equals(fieldName)) { + List vector = reader.readArray(reader1 -> reader1.getFloat()); + deserializedVectorizedQuery.vector = vector; + } else if ("kind".equals(fieldName)) { + deserializedVectorizedQuery.kind = VectorQueryKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVectorizedQuery; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorsDebugInfo.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorsDebugInfo.java new file mode 100644 index 000000000000..b98286de8303 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VectorsDebugInfo.java @@ -0,0 +1,81 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +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. + */ + @Generated + private QueryResultDocumentSubscores subscores; + + /** + * Creates an instance of VectorsDebugInfo class. + */ + @Generated + 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. + */ + @Generated + public QueryResultDocumentSubscores getSubscores() { + return this.subscores; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + 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/search/src/main/java/com/azure/search/models/VisionVectorizeSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VisionVectorizeSkill.java new file mode 100644 index 000000000000..07f4c3d48499 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VisionVectorizeSkill.java @@ -0,0 +1,187 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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 generate a vector embedding for a given image or text input using the Azure AI Services Vision + * Vectorize API. + */ +@Fluent +public final class VisionVectorizeSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Vision.VectorizeSkill"; + + /* + * The version of the model to use when calling the AI Services Vision service. It will default to the latest + * available when not specified. + */ + @Generated + private String modelVersion; + + /** + * Creates an instance of VisionVectorizeSkill class. + */ + @Generated + public VisionVectorizeSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @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. + */ + @Generated + public String getModelVersion() { + return this.modelVersion; + } + + /** + * Set 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. + * + * @param modelVersion the modelVersion value to set. + * @return the VisionVectorizeSkill object itself. + */ + @Generated + public VisionVectorizeSkill setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VisionVectorizeSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VisionVectorizeSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VisionVectorizeSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VisionVectorizeSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public VisionVectorizeSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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. + */ + @Generated + public static VisionVectorizeSkill fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VisionVectorizeSkill deserializedVisionVectorizeSkill = new VisionVectorizeSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedVisionVectorizeSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedVisionVectorizeSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedVisionVectorizeSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedVisionVectorizeSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedVisionVectorizeSkill.setContext(reader.getString()); + } else if ("modelVersion".equals(fieldName)) { + deserializedVisionVectorizeSkill.modelVersion = reader.getString(); + } else if ("@odata.type".equals(fieldName)) { + deserializedVisionVectorizeSkill.odataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVisionVectorizeSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VisualFeature.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VisualFeature.java new file mode 100644 index 000000000000..108e033f2bbc --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/VisualFeature.java @@ -0,0 +1,88 @@ +// 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.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The strings indicating what visual feature types to return. + */ +public final class VisualFeature extends ExpandableStringEnum { + /** + * Visual features recognized as adult persons. + */ + @Generated + public static final VisualFeature ADULT = fromString("adult"); + + /** + * Visual features recognized as commercial brands. + */ + @Generated + public static final VisualFeature BRANDS = fromString("brands"); + + /** + * Categories. + */ + @Generated + public static final VisualFeature CATEGORIES = fromString("categories"); + + /** + * Description. + */ + @Generated + public static final VisualFeature DESCRIPTION = fromString("description"); + + /** + * Visual features recognized as people faces. + */ + @Generated + public static final VisualFeature FACES = fromString("faces"); + + /** + * Visual features recognized as objects. + */ + @Generated + public static final VisualFeature OBJECTS = fromString("objects"); + + /** + * Tags. + */ + @Generated + public static final VisualFeature TAGS = fromString("tags"); + + /** + * Creates a new instance of VisualFeature value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public VisualFeature() { + } + + /** + * Creates or finds a VisualFeature from its string representation. + * + * @param name a name to look for. + * @return the corresponding VisualFeature. + */ + @Generated + public static VisualFeature fromString(String name) { + return fromString(name, VisualFeature.class); + } + + /** + * Gets known VisualFeature values. + * + * @return known VisualFeature values. + */ + @Generated + public static Collection values() { + return values(VisualFeature.class); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebApiParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebApiParameters.java new file mode 100644 index 000000000000..dc166048faa8 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebApiParameters.java @@ -0,0 +1,275 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; +import java.util.Map; + +/** + * Specifies the properties for connecting to a user-defined vectorizer. + */ +@Fluent +public final class WebApiParameters implements JsonSerializable { + /* + * The URI of the Web API providing the vectorizer. + */ + @Generated + private String uri; + + /* + * The headers required to make the HTTP request. + */ + @Generated + private Map httpHeaders; + + /* + * The method for the HTTP request. + */ + @Generated + private String httpMethod; + + /* + * The desired timeout for the request. Default is 30 seconds. + */ + @Generated + private Duration timeout; + + /* + * Applies to custom endpoints that connect to external code in an Azure function or some other application that + * provides the transformations. This value should be the application ID created for the function or app when it was + * registered with Azure Active Directory. When specified, the vectorization connects to the function or app using a + * managed ID (either system or user-assigned) of the search service and the access token of the function or app, + * using this value as the resource id for creating the scope of the access token. + */ + @Generated + private String authResourceId; + + /* + * 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 indexer, if the identity is + * unspecified, the value remains unchanged. If set to "none", the value of this property is cleared. + */ + @Generated + private SearchIndexerDataIdentity authIdentity; + + /** + * Creates an instance of WebApiParameters class. + */ + @Generated + public WebApiParameters() { + } + + /** + * Get the uri property: The URI of the Web API providing the vectorizer. + * + * @return the uri value. + */ + @Generated + public String getUri() { + return this.uri; + } + + /** + * Set the uri property: The URI of the Web API providing the vectorizer. + * + * @param uri the uri value to set. + * @return the WebApiParameters object itself. + */ + @Generated + public WebApiParameters setUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the httpHeaders property: The headers required to make the HTTP request. + * + * @return the httpHeaders value. + */ + @Generated + public Map getHttpHeaders() { + return this.httpHeaders; + } + + /** + * Set the httpHeaders property: The headers required to make the HTTP request. + * + * @param httpHeaders the httpHeaders value to set. + * @return the WebApiParameters object itself. + */ + @Generated + public WebApiParameters setHttpHeaders(Map httpHeaders) { + this.httpHeaders = httpHeaders; + return this; + } + + /** + * Get the httpMethod property: The method for the HTTP request. + * + * @return the httpMethod value. + */ + @Generated + public String getHttpMethod() { + return this.httpMethod; + } + + /** + * Set the httpMethod property: The method for the HTTP request. + * + * @param httpMethod the httpMethod value to set. + * @return the WebApiParameters object itself. + */ + @Generated + public WebApiParameters setHttpMethod(String httpMethod) { + this.httpMethod = httpMethod; + return this; + } + + /** + * Get the timeout property: The desired timeout for the request. Default is 30 seconds. + * + * @return the timeout value. + */ + @Generated + public Duration getTimeout() { + return this.timeout; + } + + /** + * Set the timeout property: The desired timeout for the request. Default is 30 seconds. + * + * @param timeout the timeout value to set. + * @return the WebApiParameters object itself. + */ + @Generated + public WebApiParameters setTimeout(Duration timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the authResourceId property: Applies to custom endpoints that connect to external code in an Azure function + * or some other application that provides the transformations. This value should be the application ID created for + * the function or app when it was registered with Azure Active Directory. When specified, the vectorization + * connects to the function or app using a managed ID (either system or user-assigned) of the search service and the + * access token of the function or app, using this value as the resource id for creating the scope of the access + * token. + * + * @return the authResourceId value. + */ + @Generated + public String getAuthResourceId() { + return this.authResourceId; + } + + /** + * Set the authResourceId property: Applies to custom endpoints that connect to external code in an Azure function + * or some other application that provides the transformations. This value should be the application ID created for + * the function or app when it was registered with Azure Active Directory. When specified, the vectorization + * connects to the function or app using a managed ID (either system or user-assigned) of the search service and the + * access token of the function or app, using this value as the resource id for creating the scope of the access + * token. + * + * @param authResourceId the authResourceId value to set. + * @return the WebApiParameters object itself. + */ + @Generated + public WebApiParameters setAuthResourceId(String authResourceId) { + this.authResourceId = authResourceId; + 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 indexer, if the identity is unspecified, the value remains unchanged. If set to "none", the value of this + * property is cleared. + * + * @return the authIdentity value. + */ + @Generated + 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 indexer, 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 WebApiParameters object itself. + */ + @Generated + public WebApiParameters setAuthIdentity(SearchIndexerDataIdentity authIdentity) { + this.authIdentity = authIdentity; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("uri", this.uri); + jsonWriter.writeMapField("httpHeaders", this.httpHeaders, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("httpMethod", this.httpMethod); + jsonWriter.writeStringField("timeout", CoreUtils.durationToStringWithDays(this.timeout)); + jsonWriter.writeStringField("authResourceId", this.authResourceId); + jsonWriter.writeJsonField("authIdentity", this.authIdentity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WebApiParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WebApiParameters 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 WebApiParameters. + */ + @Generated + public static WebApiParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WebApiParameters deserializedWebApiParameters = new WebApiParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("uri".equals(fieldName)) { + deserializedWebApiParameters.uri = reader.getString(); + } else if ("httpHeaders".equals(fieldName)) { + Map httpHeaders = reader.readMap(reader1 -> reader1.getString()); + deserializedWebApiParameters.httpHeaders = httpHeaders; + } else if ("httpMethod".equals(fieldName)) { + deserializedWebApiParameters.httpMethod = reader.getString(); + } else if ("timeout".equals(fieldName)) { + deserializedWebApiParameters.timeout + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("authResourceId".equals(fieldName)) { + deserializedWebApiParameters.authResourceId = reader.getString(); + } else if ("authIdentity".equals(fieldName)) { + deserializedWebApiParameters.authIdentity = SearchIndexerDataIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWebApiParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebApiSkill.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebApiSkill.java new file mode 100644 index 000000000000..01d5fa4bed3c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebApiSkill.java @@ -0,0 +1,451 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.List; +import java.util.Map; + +/** + * A skill that can call a Web API endpoint, allowing you to extend a skillset by having it call your custom code. + */ +@Fluent +public class WebApiSkill extends SearchIndexerSkill { + /* + * A URI fragment specifying the type of skill. + */ + @Generated + private String odataType = "#Microsoft.Skills.Custom.WebApiSkill"; + + /* + * The url for the Web API. + */ + @Generated + private String uri; + + /* + * The headers required to make the http request. + */ + @Generated + private Map httpHeaders; + + /* + * The method for the http request. + */ + @Generated + private String httpMethod; + + /* + * The desired timeout for the request. Default is 30 seconds. + */ + @Generated + private Duration timeout; + + /* + * The desired batch size which indicates number of documents. + */ + @Generated + private Integer batchSize; + + /* + * If set, the number of parallel calls that can be made to the Web API. + */ + @Generated + private Integer degreeOfParallelism; + + /* + * Applies to custom skills that connect to external code in an Azure function or some other application that + * provides the transformations. This value should be the application ID created for the function or app when it was + * registered with Azure Active Directory. When specified, the custom skill connects to the function or app using a + * managed ID (either system or user-assigned) of the search service and the access token of the function or app, + * using this value as the resource id for creating the scope of the access token. + */ + @Generated + private String authResourceId; + + /* + * 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 indexer, if the identity is + * unspecified, the value remains unchanged. If set to "none", the value of this property is cleared. + */ + @Generated + private SearchIndexerDataIdentity authIdentity; + + /** + * Creates an instance of WebApiSkill class. + */ + @Generated + public WebApiSkill() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of skill. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the uri property: The url for the Web API. + * + * @return the uri value. + */ + @Generated + public String getUri() { + return this.uri; + } + + /** + * Set the uri property: The url for the Web API. + * + * @param uri the uri value to set. + * @return the WebApiSkill object itself. + */ + @Generated + public WebApiSkill setUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the httpHeaders property: The headers required to make the http request. + * + * @return the httpHeaders value. + */ + @Generated + public Map getHttpHeaders() { + return this.httpHeaders; + } + + /** + * Set the httpHeaders property: The headers required to make the http request. + * + * @param httpHeaders the httpHeaders value to set. + * @return the WebApiSkill object itself. + */ + @Generated + public WebApiSkill setHttpHeaders(Map httpHeaders) { + this.httpHeaders = httpHeaders; + return this; + } + + /** + * Get the httpMethod property: The method for the http request. + * + * @return the httpMethod value. + */ + @Generated + public String getHttpMethod() { + return this.httpMethod; + } + + /** + * Set the httpMethod property: The method for the http request. + * + * @param httpMethod the httpMethod value to set. + * @return the WebApiSkill object itself. + */ + @Generated + public WebApiSkill setHttpMethod(String httpMethod) { + this.httpMethod = httpMethod; + return this; + } + + /** + * Get the timeout property: The desired timeout for the request. Default is 30 seconds. + * + * @return the timeout value. + */ + @Generated + public Duration getTimeout() { + return this.timeout; + } + + /** + * Set the timeout property: The desired timeout for the request. Default is 30 seconds. + * + * @param timeout the timeout value to set. + * @return the WebApiSkill object itself. + */ + @Generated + public WebApiSkill setTimeout(Duration timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the batchSize property: The desired batch size which indicates number of documents. + * + * @return the batchSize value. + */ + @Generated + public Integer getBatchSize() { + return this.batchSize; + } + + /** + * Set the batchSize property: The desired batch size which indicates number of documents. + * + * @param batchSize the batchSize value to set. + * @return the WebApiSkill object itself. + */ + @Generated + public WebApiSkill setBatchSize(Integer batchSize) { + this.batchSize = batchSize; + return this; + } + + /** + * Get the degreeOfParallelism property: If set, the number of parallel calls that can be made to the Web API. + * + * @return the degreeOfParallelism value. + */ + @Generated + public Integer getDegreeOfParallelism() { + return this.degreeOfParallelism; + } + + /** + * Set the degreeOfParallelism property: If set, the number of parallel calls that can be made to the Web API. + * + * @param degreeOfParallelism the degreeOfParallelism value to set. + * @return the WebApiSkill object itself. + */ + @Generated + public WebApiSkill setDegreeOfParallelism(Integer degreeOfParallelism) { + this.degreeOfParallelism = degreeOfParallelism; + return this; + } + + /** + * Get the authResourceId property: Applies to custom skills that connect to external code in an Azure function or + * some other application that provides the transformations. This value should be the application ID created for the + * function or app when it was registered with Azure Active Directory. When specified, the custom skill connects to + * the function or app using a managed ID (either system or user-assigned) of the search service and the access + * token of the function or app, using this value as the resource id for creating the scope of the access token. + * + * @return the authResourceId value. + */ + @Generated + public String getAuthResourceId() { + return this.authResourceId; + } + + /** + * Set the authResourceId property: Applies to custom skills that connect to external code in an Azure function or + * some other application that provides the transformations. This value should be the application ID created for the + * function or app when it was registered with Azure Active Directory. When specified, the custom skill connects to + * the function or app using a managed ID (either system or user-assigned) of the search service and the access + * token of the function or app, using this value as the resource id for creating the scope of the access token. + * + * @param authResourceId the authResourceId value to set. + * @return the WebApiSkill object itself. + */ + @Generated + public WebApiSkill setAuthResourceId(String authResourceId) { + this.authResourceId = authResourceId; + 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 indexer, if the identity is unspecified, the value remains unchanged. If set to "none", the value of this + * property is cleared. + * + * @return the authIdentity value. + */ + @Generated + 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 indexer, 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 WebApiSkill object itself. + */ + @Generated + public WebApiSkill setAuthIdentity(SearchIndexerDataIdentity authIdentity) { + this.authIdentity = authIdentity; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public WebApiSkill setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public WebApiSkill setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public WebApiSkill setContext(String context) { + super.setContext(context); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public WebApiSkill setInputs(List inputs) { + super.setInputs(inputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public WebApiSkill setOutputs(List outputs) { + super.setOutputs(outputs); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @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("uri", this.uri); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeMapField("httpHeaders", this.httpHeaders, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("httpMethod", this.httpMethod); + jsonWriter.writeStringField("timeout", CoreUtils.durationToStringWithDays(this.timeout)); + jsonWriter.writeNumberField("batchSize", this.batchSize); + jsonWriter.writeNumberField("degreeOfParallelism", this.degreeOfParallelism); + jsonWriter.writeStringField("authResourceId", this.authResourceId); + jsonWriter.writeJsonField("authIdentity", this.authIdentity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WebApiSkill from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WebApiSkill 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 WebApiSkill. + */ + @Generated + public static WebApiSkill 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.Skills.Custom.ChatCompletionSkill".equals(discriminatorValue)) { + return ChatCompletionSkill.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static WebApiSkill fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WebApiSkill deserializedWebApiSkill = new WebApiSkill(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + List inputs + = reader.readArray(reader1 -> InputFieldMappingEntry.fromJson(reader1)); + deserializedWebApiSkill.setInputs(inputs); + } else if ("outputs".equals(fieldName)) { + List outputs + = reader.readArray(reader1 -> OutputFieldMappingEntry.fromJson(reader1)); + deserializedWebApiSkill.setOutputs(outputs); + } else if ("name".equals(fieldName)) { + deserializedWebApiSkill.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedWebApiSkill.setDescription(reader.getString()); + } else if ("context".equals(fieldName)) { + deserializedWebApiSkill.setContext(reader.getString()); + } else if ("uri".equals(fieldName)) { + deserializedWebApiSkill.uri = reader.getString(); + } else if ("@odata.type".equals(fieldName)) { + deserializedWebApiSkill.odataType = reader.getString(); + } else if ("httpHeaders".equals(fieldName)) { + Map httpHeaders = reader.readMap(reader1 -> reader1.getString()); + deserializedWebApiSkill.httpHeaders = httpHeaders; + } else if ("httpMethod".equals(fieldName)) { + deserializedWebApiSkill.httpMethod = reader.getString(); + } else if ("timeout".equals(fieldName)) { + deserializedWebApiSkill.timeout + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("batchSize".equals(fieldName)) { + deserializedWebApiSkill.batchSize = reader.getNullable(JsonReader::getInt); + } else if ("degreeOfParallelism".equals(fieldName)) { + deserializedWebApiSkill.degreeOfParallelism = reader.getNullable(JsonReader::getInt); + } else if ("authResourceId".equals(fieldName)) { + deserializedWebApiSkill.authResourceId = reader.getString(); + } else if ("authIdentity".equals(fieldName)) { + deserializedWebApiSkill.authIdentity = SearchIndexerDataIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWebApiSkill; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebApiVectorizer.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebApiVectorizer.java new file mode 100644 index 000000000000..ab3f01572c07 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebApiVectorizer.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specifies a user-defined vectorizer for generating the vector embedding of a query string. Integration of an external + * vectorizer is achieved using the custom Web API interface of a skillset. + */ +@Fluent +public final class WebApiVectorizer extends VectorSearchVectorizer { + /* + * The name of the kind of vectorization method being configured for use with vector search. + */ + @Generated + private VectorSearchVectorizerKind kind = VectorSearchVectorizerKind.CUSTOM_WEB_API; + + /* + * Specifies the properties of the user-defined vectorizer. + */ + @Generated + private WebApiParameters webApiParameters; + + /** + * Creates an instance of WebApiVectorizer class. + */ + @Generated + public WebApiVectorizer() { + } + + /** + * Get the kind property: The name of the kind of vectorization method being configured for use with vector search. + * + * @return the kind value. + */ + @Generated + @Override + public VectorSearchVectorizerKind getKind() { + return this.kind; + } + + /** + * Get the webApiParameters property: Specifies the properties of the user-defined vectorizer. + * + * @return the webApiParameters value. + */ + @Generated + public WebApiParameters getWebApiParameters() { + return this.webApiParameters; + } + + /** + * Set the webApiParameters property: Specifies the properties of the user-defined vectorizer. + * + * @param webApiParameters the webApiParameters value to set. + * @return the WebApiVectorizer object itself. + */ + @Generated + public WebApiVectorizer setWebApiParameters(WebApiParameters webApiParameters) { + this.webApiParameters = webApiParameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public WebApiVectorizer setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("customWebApiParameters", this.webApiParameters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WebApiVectorizer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WebApiVectorizer 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 WebApiVectorizer. + */ + @Generated + public static WebApiVectorizer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WebApiVectorizer deserializedWebApiVectorizer = new WebApiVectorizer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedWebApiVectorizer.setName(reader.getString()); + } else if ("kind".equals(fieldName)) { + deserializedWebApiVectorizer.kind = VectorSearchVectorizerKind.fromString(reader.getString()); + } else if ("customWebApiParameters".equals(fieldName)) { + deserializedWebApiVectorizer.webApiParameters = WebApiParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWebApiVectorizer; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSource.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSource.java new file mode 100644 index 000000000000..4623a84ea644 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSource.java @@ -0,0 +1,165 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Knowledge Source targeting web results. + */ +@Fluent +public final class WebKnowledgeSource extends KnowledgeSource { + /* + * The type of the knowledge source. + */ + @Generated + private KnowledgeSourceKind kind = KnowledgeSourceKind.WEB; + + /* + * The parameters for the web knowledge source. + */ + @Generated + private WebKnowledgeSourceParameters webParameters; + + /** + * Creates an instance of WebKnowledgeSource class. + */ + @Generated + public WebKnowledgeSource() { + } + + /** + * Get the kind property: The type of the knowledge source. + * + * @return the kind value. + */ + @Generated + @Override + public KnowledgeSourceKind getKind() { + return this.kind; + } + + /** + * Get the webParameters property: The parameters for the web knowledge source. + * + * @return the webParameters value. + */ + @Generated + public WebKnowledgeSourceParameters getWebParameters() { + return this.webParameters; + } + + /** + * Set the webParameters property: The parameters for the web knowledge source. + * + * @param webParameters the webParameters value to set. + * @return the WebKnowledgeSource object itself. + */ + @Generated + public WebKnowledgeSource setWebParameters(WebKnowledgeSourceParameters webParameters) { + this.webParameters = webParameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public WebKnowledgeSource setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public WebKnowledgeSource setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public WebKnowledgeSource setETag(String eTag) { + super.setETag(eTag); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public WebKnowledgeSource setEncryptionKey(SearchResourceEncryptionKey encryptionKey) { + super.setEncryptionKey(encryptionKey); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("description", getDescription()); + jsonWriter.writeStringField("@odata.etag", getETag()); + jsonWriter.writeJsonField("encryptionKey", getEncryptionKey()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("webParameters", this.webParameters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WebKnowledgeSource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WebKnowledgeSource 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 WebKnowledgeSource. + */ + @Generated + public static WebKnowledgeSource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WebKnowledgeSource deserializedWebKnowledgeSource = new WebKnowledgeSource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedWebKnowledgeSource.setName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedWebKnowledgeSource.setDescription(reader.getString()); + } else if ("@odata.etag".equals(fieldName)) { + deserializedWebKnowledgeSource.setETag(reader.getString()); + } else if ("encryptionKey".equals(fieldName)) { + deserializedWebKnowledgeSource.setEncryptionKey(SearchResourceEncryptionKey.fromJson(reader)); + } else if ("kind".equals(fieldName)) { + deserializedWebKnowledgeSource.kind = KnowledgeSourceKind.fromString(reader.getString()); + } else if ("webParameters".equals(fieldName)) { + deserializedWebKnowledgeSource.webParameters = WebKnowledgeSourceParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWebKnowledgeSource; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSourceDomain.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSourceDomain.java new file mode 100644 index 000000000000..7b262d8b587b --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSourceDomain.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Configuration for web knowledge source domain. + */ +@Fluent +public final class WebKnowledgeSourceDomain implements JsonSerializable { + /* + * The address of the domain. + */ + @Generated + private String address; + + /* + * Whether or not to include subpages from this domain. + */ + @Generated + private Boolean includeSubpages; + + /** + * Creates an instance of WebKnowledgeSourceDomain class. + */ + @Generated + public WebKnowledgeSourceDomain() { + } + + /** + * Get the address property: The address of the domain. + * + * @return the address value. + */ + @Generated + public String getAddress() { + return this.address; + } + + /** + * Set the address property: The address of the domain. + * + * @param address the address value to set. + * @return the WebKnowledgeSourceDomain object itself. + */ + @Generated + public WebKnowledgeSourceDomain setAddress(String address) { + this.address = address; + return this; + } + + /** + * Get the includeSubpages property: Whether or not to include subpages from this domain. + * + * @return the includeSubpages value. + */ + @Generated + public Boolean isIncludeSubpages() { + return this.includeSubpages; + } + + /** + * Set the includeSubpages property: Whether or not to include subpages from this domain. + * + * @param includeSubpages the includeSubpages value to set. + * @return the WebKnowledgeSourceDomain object itself. + */ + @Generated + public WebKnowledgeSourceDomain setIncludeSubpages(Boolean includeSubpages) { + this.includeSubpages = includeSubpages; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("address", this.address); + jsonWriter.writeBooleanField("includeSubpages", this.includeSubpages); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WebKnowledgeSourceDomain from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WebKnowledgeSourceDomain 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 WebKnowledgeSourceDomain. + */ + @Generated + public static WebKnowledgeSourceDomain fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WebKnowledgeSourceDomain deserializedWebKnowledgeSourceDomain = new WebKnowledgeSourceDomain(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("address".equals(fieldName)) { + deserializedWebKnowledgeSourceDomain.address = reader.getString(); + } else if ("includeSubpages".equals(fieldName)) { + deserializedWebKnowledgeSourceDomain.includeSubpages = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedWebKnowledgeSourceDomain; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSourceDomains.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSourceDomains.java new file mode 100644 index 000000000000..856b0b6bb342 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSourceDomains.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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; + +/** + * Domain allow/block configuration for web knowledge source. + */ +@Fluent +public final class WebKnowledgeSourceDomains implements JsonSerializable { + /* + * Domains that are allowed for web results + */ + @Generated + private List allowedDomains; + + /* + * Domains that are blocked from web results + */ + @Generated + private List blockedDomains; + + /** + * Creates an instance of WebKnowledgeSourceDomains class. + */ + @Generated + public WebKnowledgeSourceDomains() { + } + + /** + * Get the allowedDomains property: Domains that are allowed for web results. + * + * @return the allowedDomains value. + */ + @Generated + public List getAllowedDomains() { + return this.allowedDomains; + } + + /** + * Set the allowedDomains property: Domains that are allowed for web results. + * + * @param allowedDomains the allowedDomains value to set. + * @return the WebKnowledgeSourceDomains object itself. + */ + @Generated + public WebKnowledgeSourceDomains setAllowedDomains(List allowedDomains) { + this.allowedDomains = allowedDomains; + return this; + } + + /** + * Get the blockedDomains property: Domains that are blocked from web results. + * + * @return the blockedDomains value. + */ + @Generated + public List getBlockedDomains() { + return this.blockedDomains; + } + + /** + * Set the blockedDomains property: Domains that are blocked from web results. + * + * @param blockedDomains the blockedDomains value to set. + * @return the WebKnowledgeSourceDomains object itself. + */ + @Generated + public WebKnowledgeSourceDomains setBlockedDomains(List blockedDomains) { + this.blockedDomains = blockedDomains; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("allowedDomains", this.allowedDomains, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("blockedDomains", this.blockedDomains, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WebKnowledgeSourceDomains from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WebKnowledgeSourceDomains 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 WebKnowledgeSourceDomains. + */ + @Generated + public static WebKnowledgeSourceDomains fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WebKnowledgeSourceDomains deserializedWebKnowledgeSourceDomains = new WebKnowledgeSourceDomains(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("allowedDomains".equals(fieldName)) { + List allowedDomains + = reader.readArray(reader1 -> WebKnowledgeSourceDomain.fromJson(reader1)); + deserializedWebKnowledgeSourceDomains.allowedDomains = allowedDomains; + } else if ("blockedDomains".equals(fieldName)) { + List blockedDomains + = reader.readArray(reader1 -> WebKnowledgeSourceDomain.fromJson(reader1)); + deserializedWebKnowledgeSourceDomains.blockedDomains = blockedDomains; + } else { + reader.skipChildren(); + } + } + + return deserializedWebKnowledgeSourceDomains; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSourceParameters.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSourceParameters.java new file mode 100644 index 000000000000..63ce4f476d41 --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSourceParameters.java @@ -0,0 +1,93 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Parameters for web knowledge source. + */ +@Fluent +public final class WebKnowledgeSourceParameters implements JsonSerializable { + /* + * Domain allow/block configuration for web results. + */ + @Generated + private WebKnowledgeSourceDomains domains; + + /** + * Creates an instance of WebKnowledgeSourceParameters class. + */ + @Generated + public WebKnowledgeSourceParameters() { + } + + /** + * Get the domains property: Domain allow/block configuration for web results. + * + * @return the domains value. + */ + @Generated + public WebKnowledgeSourceDomains getDomains() { + return this.domains; + } + + /** + * Set the domains property: Domain allow/block configuration for web results. + * + * @param domains the domains value to set. + * @return the WebKnowledgeSourceParameters object itself. + */ + @Generated + public WebKnowledgeSourceParameters setDomains(WebKnowledgeSourceDomains domains) { + this.domains = domains; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("domains", this.domains); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WebKnowledgeSourceParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WebKnowledgeSourceParameters 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 WebKnowledgeSourceParameters. + */ + @Generated + public static WebKnowledgeSourceParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WebKnowledgeSourceParameters deserializedWebKnowledgeSourceParameters = new WebKnowledgeSourceParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("domains".equals(fieldName)) { + deserializedWebKnowledgeSourceParameters.domains = WebKnowledgeSourceDomains.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWebKnowledgeSourceParameters; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSourceParams.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSourceParams.java new file mode 100644 index 000000000000..34858ecbc29a --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WebKnowledgeSourceParams.java @@ -0,0 +1,274 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specifies runtime parameters for a web knowledge source. + */ +@Fluent +public final class WebKnowledgeSourceParams extends KnowledgeSourceParams { + /* + * The type of the knowledge source. + */ + @Generated + private KnowledgeSourceKind kind = KnowledgeSourceKind.WEB; + + /* + * The language of the web results. + */ + @Generated + private String language; + + /* + * The market of the web results. + */ + @Generated + private String market; + + /* + * The number of web results to return. + */ + @Generated + private Integer count; + + /* + * The freshness of web results. + */ + @Generated + private String freshness; + + /** + * Creates an instance of WebKnowledgeSourceParams class. + */ + @Generated + public WebKnowledgeSourceParams() { + } + + /** + * Get the kind property: The type of the knowledge source. + * + * @return the kind value. + */ + @Generated + @Override + public KnowledgeSourceKind getKind() { + return this.kind; + } + + /** + * Get the language property: The language of the web results. + * + * @return the language value. + */ + @Generated + public String getLanguage() { + return this.language; + } + + /** + * Set the language property: The language of the web results. + * + * @param language the language value to set. + * @return the WebKnowledgeSourceParams object itself. + */ + @Generated + public WebKnowledgeSourceParams setLanguage(String language) { + this.language = language; + return this; + } + + /** + * Get the market property: The market of the web results. + * + * @return the market value. + */ + @Generated + public String getMarket() { + return this.market; + } + + /** + * Set the market property: The market of the web results. + * + * @param market the market value to set. + * @return the WebKnowledgeSourceParams object itself. + */ + @Generated + public WebKnowledgeSourceParams setMarket(String market) { + this.market = market; + return this; + } + + /** + * Get the count property: The number of web results to return. + * + * @return the count value. + */ + @Generated + public Integer getCount() { + return this.count; + } + + /** + * Set the count property: The number of web results to return. + * + * @param count the count value to set. + * @return the WebKnowledgeSourceParams object itself. + */ + @Generated + public WebKnowledgeSourceParams setCount(Integer count) { + this.count = count; + return this; + } + + /** + * Get the freshness property: The freshness of web results. + * + * @return the freshness value. + */ + @Generated + public String getFreshness() { + return this.freshness; + } + + /** + * Set the freshness property: The freshness of web results. + * + * @param freshness the freshness value to set. + * @return the WebKnowledgeSourceParams object itself. + */ + @Generated + public WebKnowledgeSourceParams setFreshness(String freshness) { + this.freshness = freshness; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public WebKnowledgeSourceParams setKnowledgeSourceName(String knowledgeSourceName) { + super.setKnowledgeSourceName(knowledgeSourceName); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public WebKnowledgeSourceParams setIncludeReferences(Boolean includeReferences) { + super.setIncludeReferences(includeReferences); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public WebKnowledgeSourceParams setIncludeReferenceSourceData(Boolean includeReferenceSourceData) { + super.setIncludeReferenceSourceData(includeReferenceSourceData); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public WebKnowledgeSourceParams setAlwaysQuerySource(Boolean alwaysQuerySource) { + super.setAlwaysQuerySource(alwaysQuerySource); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public WebKnowledgeSourceParams setRerankerThreshold(Float rerankerThreshold) { + super.setRerankerThreshold(rerankerThreshold); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("knowledgeSourceName", getKnowledgeSourceName()); + jsonWriter.writeBooleanField("includeReferences", isIncludeReferences()); + jsonWriter.writeBooleanField("includeReferenceSourceData", isIncludeReferenceSourceData()); + jsonWriter.writeBooleanField("alwaysQuerySource", isAlwaysQuerySource()); + jsonWriter.writeNumberField("rerankerThreshold", getRerankerThreshold()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("language", this.language); + jsonWriter.writeStringField("market", this.market); + jsonWriter.writeNumberField("count", this.count); + jsonWriter.writeStringField("freshness", this.freshness); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WebKnowledgeSourceParams from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WebKnowledgeSourceParams 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 WebKnowledgeSourceParams. + */ + @Generated + public static WebKnowledgeSourceParams fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WebKnowledgeSourceParams deserializedWebKnowledgeSourceParams = new WebKnowledgeSourceParams(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("knowledgeSourceName".equals(fieldName)) { + deserializedWebKnowledgeSourceParams.setKnowledgeSourceName(reader.getString()); + } else if ("includeReferences".equals(fieldName)) { + deserializedWebKnowledgeSourceParams + .setIncludeReferences(reader.getNullable(JsonReader::getBoolean)); + } else if ("includeReferenceSourceData".equals(fieldName)) { + deserializedWebKnowledgeSourceParams + .setIncludeReferenceSourceData(reader.getNullable(JsonReader::getBoolean)); + } else if ("alwaysQuerySource".equals(fieldName)) { + deserializedWebKnowledgeSourceParams + .setAlwaysQuerySource(reader.getNullable(JsonReader::getBoolean)); + } else if ("rerankerThreshold".equals(fieldName)) { + deserializedWebKnowledgeSourceParams.setRerankerThreshold(reader.getNullable(JsonReader::getFloat)); + } else if ("kind".equals(fieldName)) { + deserializedWebKnowledgeSourceParams.kind = KnowledgeSourceKind.fromString(reader.getString()); + } else if ("language".equals(fieldName)) { + deserializedWebKnowledgeSourceParams.language = reader.getString(); + } else if ("market".equals(fieldName)) { + deserializedWebKnowledgeSourceParams.market = reader.getString(); + } else if ("count".equals(fieldName)) { + deserializedWebKnowledgeSourceParams.count = reader.getNullable(JsonReader::getInt); + } else if ("freshness".equals(fieldName)) { + deserializedWebKnowledgeSourceParams.freshness = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWebKnowledgeSourceParams; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WordDelimiterTokenFilter.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WordDelimiterTokenFilter.java new file mode 100644 index 000000000000..8100db1142ef --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/WordDelimiterTokenFilter.java @@ -0,0 +1,433 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Splits words into subwords and performs optional transformations on subword groups. This token filter is implemented + * using Apache Lucene. + */ +@Fluent +public final class WordDelimiterTokenFilter extends TokenFilter { + /* + * A URI fragment specifying the type of token filter. + */ + @Generated + private String odataType = "#Microsoft.Azure.Search.WordDelimiterTokenFilter"; + + /* + * A value indicating whether to generate part words. If set, causes parts of words to be generated; for example + * "AzureSearch" becomes "Azure" "Search". Default is true. + */ + @Generated + private Boolean generateWordParts; + + /* + * A value indicating whether to generate number subwords. Default is true. + */ + @Generated + private Boolean generateNumberParts; + + /* + * A value indicating whether maximum runs of word parts will be catenated. For example, if this is set to true, + * "Azure-Search" becomes "AzureSearch". Default is false. + */ + @Generated + private Boolean catenateWords; + + /* + * A value indicating whether maximum runs of number parts will be catenated. For example, if this is set to true, + * "1-2" becomes "12". Default is false. + */ + @Generated + private Boolean catenateNumbers; + + /* + * A value indicating whether all subword parts will be catenated. For example, if this is set to true, + * "Azure-Search-1" becomes "AzureSearch1". Default is false. + */ + @Generated + private Boolean catenateAll; + + /* + * A value indicating whether to split words on caseChange. For example, if this is set to true, "AzureSearch" + * becomes "Azure" "Search". Default is true. + */ + @Generated + private Boolean splitOnCaseChange; + + /* + * A value indicating whether original words will be preserved and added to the subword list. Default is false. + */ + @Generated + private Boolean preserveOriginal; + + /* + * A value indicating whether to split on numbers. For example, if this is set to true, "Azure1Search" becomes + * "Azure" "1" "Search". Default is true. + */ + @Generated + private Boolean splitOnNumerics; + + /* + * A value indicating whether to remove trailing "'s" for each subword. Default is true. + */ + @Generated + private Boolean stemEnglishPossessive; + + /* + * A list of tokens to protect from being delimited. + */ + @Generated + private List protectedWords; + + /** + * Creates an instance of WordDelimiterTokenFilter class. + */ + @Generated + public WordDelimiterTokenFilter() { + } + + /** + * Get the odataType property: A URI fragment specifying the type of token filter. + * + * @return the odataType value. + */ + @Generated + @Override + public String getOdataType() { + return this.odataType; + } + + /** + * Get the generateWordParts property: A value indicating whether to generate part words. If set, causes parts of + * words to be generated; for example "AzureSearch" becomes "Azure" "Search". Default is true. + * + * @return the generateWordParts value. + */ + @Generated + public Boolean isGenerateWordParts() { + return this.generateWordParts; + } + + /** + * Set the generateWordParts property: A value indicating whether to generate part words. If set, causes parts of + * words to be generated; for example "AzureSearch" becomes "Azure" "Search". Default is true. + * + * @param generateWordParts the generateWordParts value to set. + * @return the WordDelimiterTokenFilter object itself. + */ + @Generated + public WordDelimiterTokenFilter setGenerateWordParts(Boolean generateWordParts) { + this.generateWordParts = generateWordParts; + return this; + } + + /** + * Get the generateNumberParts property: A value indicating whether to generate number subwords. Default is true. + * + * @return the generateNumberParts value. + */ + @Generated + public Boolean isGenerateNumberParts() { + return this.generateNumberParts; + } + + /** + * Set the generateNumberParts property: A value indicating whether to generate number subwords. Default is true. + * + * @param generateNumberParts the generateNumberParts value to set. + * @return the WordDelimiterTokenFilter object itself. + */ + @Generated + public WordDelimiterTokenFilter setGenerateNumberParts(Boolean generateNumberParts) { + this.generateNumberParts = generateNumberParts; + return this; + } + + /** + * Get the catenateWords property: A value indicating whether maximum runs of word parts will be catenated. For + * example, if this is set to true, "Azure-Search" becomes "AzureSearch". Default is false. + * + * @return the catenateWords value. + */ + @Generated + public Boolean isCatenateWords() { + return this.catenateWords; + } + + /** + * Set the catenateWords property: A value indicating whether maximum runs of word parts will be catenated. For + * example, if this is set to true, "Azure-Search" becomes "AzureSearch". Default is false. + * + * @param catenateWords the catenateWords value to set. + * @return the WordDelimiterTokenFilter object itself. + */ + @Generated + public WordDelimiterTokenFilter setCatenateWords(Boolean catenateWords) { + this.catenateWords = catenateWords; + return this; + } + + /** + * Get the catenateNumbers property: A value indicating whether maximum runs of number parts will be catenated. For + * example, if this is set to true, "1-2" becomes "12". Default is false. + * + * @return the catenateNumbers value. + */ + @Generated + public Boolean isCatenateNumbers() { + return this.catenateNumbers; + } + + /** + * Set the catenateNumbers property: A value indicating whether maximum runs of number parts will be catenated. For + * example, if this is set to true, "1-2" becomes "12". Default is false. + * + * @param catenateNumbers the catenateNumbers value to set. + * @return the WordDelimiterTokenFilter object itself. + */ + @Generated + public WordDelimiterTokenFilter setCatenateNumbers(Boolean catenateNumbers) { + this.catenateNumbers = catenateNumbers; + return this; + } + + /** + * Get the catenateAll property: A value indicating whether all subword parts will be catenated. For example, if + * this is set to true, "Azure-Search-1" becomes "AzureSearch1". Default is false. + * + * @return the catenateAll value. + */ + @Generated + public Boolean isCatenateAll() { + return this.catenateAll; + } + + /** + * Set the catenateAll property: A value indicating whether all subword parts will be catenated. For example, if + * this is set to true, "Azure-Search-1" becomes "AzureSearch1". Default is false. + * + * @param catenateAll the catenateAll value to set. + * @return the WordDelimiterTokenFilter object itself. + */ + @Generated + public WordDelimiterTokenFilter setCatenateAll(Boolean catenateAll) { + this.catenateAll = catenateAll; + return this; + } + + /** + * Get the splitOnCaseChange property: A value indicating whether to split words on caseChange. For example, if this + * is set to true, "AzureSearch" becomes "Azure" "Search". Default is true. + * + * @return the splitOnCaseChange value. + */ + @Generated + public Boolean isSplitOnCaseChange() { + return this.splitOnCaseChange; + } + + /** + * Set the splitOnCaseChange property: A value indicating whether to split words on caseChange. For example, if this + * is set to true, "AzureSearch" becomes "Azure" "Search". Default is true. + * + * @param splitOnCaseChange the splitOnCaseChange value to set. + * @return the WordDelimiterTokenFilter object itself. + */ + @Generated + public WordDelimiterTokenFilter setSplitOnCaseChange(Boolean splitOnCaseChange) { + this.splitOnCaseChange = splitOnCaseChange; + return this; + } + + /** + * Get the preserveOriginal property: A value indicating whether original words will be preserved and added to the + * subword list. Default is false. + * + * @return the preserveOriginal value. + */ + @Generated + public Boolean isPreserveOriginal() { + return this.preserveOriginal; + } + + /** + * Set the preserveOriginal property: A value indicating whether original words will be preserved and added to the + * subword list. Default is false. + * + * @param preserveOriginal the preserveOriginal value to set. + * @return the WordDelimiterTokenFilter object itself. + */ + @Generated + public WordDelimiterTokenFilter setPreserveOriginal(Boolean preserveOriginal) { + this.preserveOriginal = preserveOriginal; + return this; + } + + /** + * Get the splitOnNumerics property: A value indicating whether to split on numbers. For example, if this is set to + * true, "Azure1Search" becomes "Azure" "1" "Search". Default is true. + * + * @return the splitOnNumerics value. + */ + @Generated + public Boolean isSplitOnNumerics() { + return this.splitOnNumerics; + } + + /** + * Set the splitOnNumerics property: A value indicating whether to split on numbers. For example, if this is set to + * true, "Azure1Search" becomes "Azure" "1" "Search". Default is true. + * + * @param splitOnNumerics the splitOnNumerics value to set. + * @return the WordDelimiterTokenFilter object itself. + */ + @Generated + public WordDelimiterTokenFilter setSplitOnNumerics(Boolean splitOnNumerics) { + this.splitOnNumerics = splitOnNumerics; + return this; + } + + /** + * Get the stemEnglishPossessive property: A value indicating whether to remove trailing "'s" for each subword. + * Default is true. + * + * @return the stemEnglishPossessive value. + */ + @Generated + public Boolean isStemEnglishPossessive() { + return this.stemEnglishPossessive; + } + + /** + * Set the stemEnglishPossessive property: A value indicating whether to remove trailing "'s" for each subword. + * Default is true. + * + * @param stemEnglishPossessive the stemEnglishPossessive value to set. + * @return the WordDelimiterTokenFilter object itself. + */ + @Generated + public WordDelimiterTokenFilter setStemEnglishPossessive(Boolean stemEnglishPossessive) { + this.stemEnglishPossessive = stemEnglishPossessive; + return this; + } + + /** + * Get the protectedWords property: A list of tokens to protect from being delimited. + * + * @return the protectedWords value. + */ + @Generated + public List getProtectedWords() { + return this.protectedWords; + } + + /** + * Set the protectedWords property: A list of tokens to protect from being delimited. + * + * @param protectedWords the protectedWords value to set. + * @return the WordDelimiterTokenFilter object itself. + */ + @Generated + public WordDelimiterTokenFilter setProtectedWords(List protectedWords) { + this.protectedWords = protectedWords; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public WordDelimiterTokenFilter setName(String name) { + super.setName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("@odata.type", this.odataType); + jsonWriter.writeBooleanField("generateWordParts", this.generateWordParts); + jsonWriter.writeBooleanField("generateNumberParts", this.generateNumberParts); + jsonWriter.writeBooleanField("catenateWords", this.catenateWords); + jsonWriter.writeBooleanField("catenateNumbers", this.catenateNumbers); + jsonWriter.writeBooleanField("catenateAll", this.catenateAll); + jsonWriter.writeBooleanField("splitOnCaseChange", this.splitOnCaseChange); + jsonWriter.writeBooleanField("preserveOriginal", this.preserveOriginal); + jsonWriter.writeBooleanField("splitOnNumerics", this.splitOnNumerics); + jsonWriter.writeBooleanField("stemEnglishPossessive", this.stemEnglishPossessive); + jsonWriter.writeArrayField("protectedWords", this.protectedWords, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WordDelimiterTokenFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WordDelimiterTokenFilter 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 WordDelimiterTokenFilter. + */ + @Generated + public static WordDelimiterTokenFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WordDelimiterTokenFilter deserializedWordDelimiterTokenFilter = new WordDelimiterTokenFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedWordDelimiterTokenFilter.setName(reader.getString()); + } else if ("@odata.type".equals(fieldName)) { + deserializedWordDelimiterTokenFilter.odataType = reader.getString(); + } else if ("generateWordParts".equals(fieldName)) { + deserializedWordDelimiterTokenFilter.generateWordParts = reader.getNullable(JsonReader::getBoolean); + } else if ("generateNumberParts".equals(fieldName)) { + deserializedWordDelimiterTokenFilter.generateNumberParts + = reader.getNullable(JsonReader::getBoolean); + } else if ("catenateWords".equals(fieldName)) { + deserializedWordDelimiterTokenFilter.catenateWords = reader.getNullable(JsonReader::getBoolean); + } else if ("catenateNumbers".equals(fieldName)) { + deserializedWordDelimiterTokenFilter.catenateNumbers = reader.getNullable(JsonReader::getBoolean); + } else if ("catenateAll".equals(fieldName)) { + deserializedWordDelimiterTokenFilter.catenateAll = reader.getNullable(JsonReader::getBoolean); + } else if ("splitOnCaseChange".equals(fieldName)) { + deserializedWordDelimiterTokenFilter.splitOnCaseChange = reader.getNullable(JsonReader::getBoolean); + } else if ("preserveOriginal".equals(fieldName)) { + deserializedWordDelimiterTokenFilter.preserveOriginal = reader.getNullable(JsonReader::getBoolean); + } else if ("splitOnNumerics".equals(fieldName)) { + deserializedWordDelimiterTokenFilter.splitOnNumerics = reader.getNullable(JsonReader::getBoolean); + } else if ("stemEnglishPossessive".equals(fieldName)) { + deserializedWordDelimiterTokenFilter.stemEnglishPossessive + = reader.getNullable(JsonReader::getBoolean); + } else if ("protectedWords".equals(fieldName)) { + List protectedWords = reader.readArray(reader1 -> reader1.getString()); + deserializedWordDelimiterTokenFilter.protectedWords = protectedWords; + } else { + reader.skipChildren(); + } + } + + return deserializedWordDelimiterTokenFilter; + }); + } +} diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/package-info.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/package-info.java new file mode 100644 index 000000000000..5a2aedc6fd3c --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/models/package-info.java @@ -0,0 +1,10 @@ +// 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 containing the data models for SearchClient. + * Client that can be used to query an knowledge base. + */ +package com.azure.search.models; diff --git a/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/package-info.java b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/package-info.java new file mode 100644 index 000000000000..dbf63c6e518e --- /dev/null +++ b/sdk/search/azure-search-documents/search/src/main/java/com/azure/search/package-info.java @@ -0,0 +1,10 @@ +// 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 containing the classes for SearchClient. + * Client that can be used to query an knowledge base. + */ +package com.azure.search; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/util/SearchPagedFlux.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/util/SearchPagedFlux.java index d6e7964c1a3a..99b96b96e7ef 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/util/SearchPagedFlux.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/util/SearchPagedFlux.java @@ -3,6 +3,11 @@ package com.azure.search.documents.util; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.function.Supplier; + import com.azure.core.http.rest.PagedFluxBase; import com.azure.core.util.paging.ContinuablePagedFlux; import com.azure.search.documents.implementation.models.SearchFirstPageResponseWrapper; @@ -10,14 +15,14 @@ import com.azure.search.documents.implementation.util.SemanticSearchResultsAccessHelper; import com.azure.search.documents.models.DebugInfo; import com.azure.search.documents.models.FacetResult; +import com.azure.search.documents.models.QueryAnswerResult; import com.azure.search.documents.models.SearchResult; +import com.azure.search.documents.models.SemanticErrorReason; +import com.azure.search.documents.models.SemanticQueryRewritesResultType; import com.azure.search.documents.models.SemanticSearchResults; -import reactor.core.publisher.Mono; +import com.azure.search.documents.models.SemanticSearchResultsType; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.function.Supplier; +import reactor.core.publisher.Mono; /** * Implementation of {@link ContinuablePagedFlux} where the continuation token type is {@link SearchRequest}, the @@ -127,4 +132,70 @@ public Mono getDebugInfo() { return Mono.just(metaData.getFirstPageResponse().getDebugInfo()); }); } + + /** + * The query answers returned based on the search request. + *

+ * If query answers weren't requested this will be {@code null}. + * + * @return The query answers if they were requested, otherwise {@code null}. + */ + public Mono> getQueryAnswers() { + return metadataSupplier.get().flatMap(metaData -> { + if (metaData.getFirstPageResponse().getQueryAnswers() == null) { + return Mono.empty(); + } + return Mono.just(metaData.getFirstPageResponse().getQueryAnswers()); + }); + } + + /** + * The reason for a semantic search failure based on the search request. + *

+ * If semantic search wasn't requested or there was no error this will be {@code null}. + * + * @return The reason for a semantic search failure if there was one, otherwise {@code null}. + */ + public Mono getSemanticErrorReason() { + return metadataSupplier.get().flatMap(metaData -> { + if (metaData.getFirstPageResponse().getSemanticErrorReason() == null) { + return Mono.empty(); + } + return Mono.just(metaData.getFirstPageResponse().getSemanticErrorReason()); + }); + } + + /** + * The type of semantic search results returned. + *

+ * If semantic search wasn't requested this will be {@code null}. + * + * @return The type of semantic search results if semantic search was requested, otherwise {@code null}. + */ + public Mono getSemanticSearchResultsType() { + return metadataSupplier.get().flatMap(metaData -> { + if (metaData.getFirstPageResponse().getSemanticSearchResultsType() == null) { + return Mono.empty(); + } + return Mono.just(metaData.getFirstPageResponse().getSemanticSearchResultsType()); + }); + } + + /** + * The type of semantic query rewrites applied during the search request. + *

+ * If semantic search wasn't requested or there were no rewrites this will be {@code null}. + * + * @return The type of semantic query rewrites applied if there were any, otherwise {@code null}. + */ + public MonogetSemanticQueryRewritesType() { + return metadataSupplier.get().flatMap(metaData -> { + if (metaData.getFirstPageResponse().getSemanticQueryRewritesResultType() == null) { + return Mono.empty(); + } + return Mono.just(metaData.getFirstPageResponse().getSemanticQueryRewritesResultType()); + }); + } + + } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/util/SearchPagedIterable.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/util/SearchPagedIterable.java index e94b97d60374..af5536437107 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/util/SearchPagedIterable.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/util/SearchPagedIterable.java @@ -3,6 +3,11 @@ package com.azure.search.documents.util; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.function.Supplier; + import com.azure.core.http.rest.PagedIterableBase; import com.azure.core.util.paging.ContinuablePagedIterable; import com.azure.core.util.paging.PageRetrieverSync; @@ -11,13 +16,12 @@ import com.azure.search.documents.implementation.util.SemanticSearchResultsAccessHelper; import com.azure.search.documents.models.DebugInfo; import com.azure.search.documents.models.FacetResult; +import com.azure.search.documents.models.QueryAnswerResult; import com.azure.search.documents.models.SearchResult; +import com.azure.search.documents.models.SemanticErrorReason; +import com.azure.search.documents.models.SemanticQueryRewritesResultType; import com.azure.search.documents.models.SemanticSearchResults; - -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.function.Supplier; +import com.azure.search.documents.models.SemanticSearchResultsType; /** * Implementation of {@link ContinuablePagedIterable} where the continuation token type is {@link SearchRequest}, the @@ -144,4 +148,60 @@ public DebugInfo getDebugInfo() { ? metadataSupplier.get().getFirstPageResponse().getDebugInfo() : pagedFlux.getDebugInfo().block(); } + + /** + * The query answers based on the search request. + *

+ * If query answers weren't requested this will be {@code null}. + * + * @return The query answers if they were requested, otherwise {@code null}. + */ + public List getQueryAnswers() { + return metadataSupplier != null + ? metadataSupplier.get().getFirstPageResponse().getQueryAnswers() + : pagedFlux.getQueryAnswers().block(); + } + + /** + * The reason for a semantic error if the semantic search request failed. + *

+ * If semantic search wasn't requested or the request was successful this will be {@code null}. + * + * @return The reason for a semantic error if the semantic search request failed, otherwise {@code null}. + */ + public SemanticErrorReason getSemanticErrorReason() { + return metadataSupplier != null + ? metadataSupplier.get().getFirstPageResponse().getSemanticErrorReason() + : pagedFlux.getSemanticErrorReason().block(); + } + + /** + * The type of semantic search results returned. + *

+ * If semantic search wasn't requested this will be {@code null}. + * + * @return The type of semantic search results if semantic search was requested, otherwise {@code null}. + */ + public SemanticSearchResultsType getSemanticSearchResultsType() { + return metadataSupplier != null + ? metadataSupplier.get().getFirstPageResponse().getSemanticSearchResultsType() + : pagedFlux.getSemanticSearchResultsType().block(); + } + + /** + * The type of semantic query rewrites applied during the search request. + *

+ * If semantic search wasn't requested this will be {@code null}. + * + * @return The type of semantic query rewrites if semantic search was requested, otherwise {@code null}. + */ + public SemanticQueryRewritesResultType getSemanticQueryRewritesResultType() { + return metadataSupplier != null + ? metadataSupplier.get().getFirstPageResponse().getSemanticQueryRewritesResultType() + : pagedFlux.getSemanticQueryRewritesType().block(); + } + + + + } diff --git a/sdk/search/azure-search-documents/src/main/java/module-info.java b/sdk/search/azure-search-documents/src/main/java/module-info.java deleted file mode 100644 index f135df68137d..000000000000 --- a/sdk/search/azure-search-documents/src/main/java/module-info.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -module com.azure.search.documents { - requires transitive com.azure.json; - requires transitive com.azure.core; - - opens com.azure.search.documents.models to com.azure.core; - opens com.azure.search.documents.implementation.models to com.azure.core; - - opens com.azure.search.documents.indexes.models to com.azure.core; - opens com.azure.search.documents.indexes.implementation.models to com.azure.core; - - exports com.azure.search.documents; - exports com.azure.search.documents.indexes; - exports com.azure.search.documents.indexes.models; - exports com.azure.search.documents.models; - exports com.azure.search.documents.options; - exports com.azure.search.documents.util; -}