diff --git a/sdk/search/perf-tests/search-documents/package.json b/sdk/search/perf-tests/search-documents/package.json index af26991f2971..8a0da13548d5 100644 --- a/sdk/search/perf-tests/search-documents/package.json +++ b/sdk/search/perf-tests/search-documents/package.json @@ -7,7 +7,7 @@ "author": "", "license": "ISC", "dependencies": { - "@azure/search-documents": "11.1.1", + "@azure/search-documents": "11.2.0-beta.1", "@azure/identity": "^1.1.0", "@azure/test-utils-perfstress": "^1.0.0", "dotenv": "^8.2.0" diff --git a/sdk/search/search-documents/CHANGELOG.md b/sdk/search/search-documents/CHANGELOG.md index 7a70ee811d65..995421f83279 100644 --- a/sdk/search/search-documents/CHANGELOG.md +++ b/sdk/search/search-documents/CHANGELOG.md @@ -1,6 +1,10 @@ # Release History -## 11.1.1 (Unreleased) +## 11.2.0-beta.1 (2021-04-06) + +- Added Support for new skills such as `CustomEntityLookupSkill`, `DocumentExtractionSkill`, etc. Please refer [#14620](https://github.com/Azure/azure-sdk-for-js/pull/14620) for further details. +- Added Support for new datasource `adlsgen2`. Please refer [#14620](https://github.com/Azure/azure-sdk-for-js/pull/14620) for further details. +- Added Support for normalizers `LexicalNormalizer` & `CustomNormalizer`. Please refer [#14620](https://github.com/Azure/azure-sdk-for-js/pull/14620) for further details. ## 11.1.0 (2021-02-11) @@ -45,11 +49,6 @@ - [Breaking] In `ServiceCounters`, the `skillsetCounter` property has been removed. - [Breaking] Modified the names of several properties. Please refer [#9321](https://github.com/Azure/azure-sdk-for-js/issues/9321) for a detailed list of renames. -## 11.0.0-preview.1 (2020-03-09) - -- Initial implementation of the data-plane Cognitive Search Client. The version number starts at 11 to align with client libraries in other languages. -- This first preview has support for document operations on an index, such as querying and document management. - ## 1.0.0-preview.4 (2020-06-08) - [Breaking] Changed `ListIndexes` operation to a pageable operation. @@ -84,3 +83,8 @@ - The type `IndexAction` was renamed to `IndexDocumentsAction`. - [Breaking] Removed `SearchApiKeyCredential` and replaced with `AzureKeyCredential`. - [Breaking] Search results accessed `byPage` now have an opaque `continuationToken` in place of `nextLink` and `nextPageParameters`. + +## 11.0.0-preview.1 (2020-03-09) + +- Initial implementation of the data-plane Cognitive Search Client. The version number starts at 11 to align with client libraries in other languages. +- This first preview has support for document operations on an index, such as querying and document management. diff --git a/sdk/search/search-documents/README.md b/sdk/search/search-documents/README.md index 488a9c72bff2..4914666e32a7 100644 --- a/sdk/search/search-documents/README.md +++ b/sdk/search/search-documents/README.md @@ -67,7 +67,7 @@ Once you have an api-key, you can use it as follows: const { SearchClient, SearchIndexClient, - SearchServiceClient, + SearchIndexerClient, AzureKeyCredential, } = require("@azure/search-documents"); diff --git a/sdk/search/search-documents/package.json b/sdk/search/search-documents/package.json index ebaf55543106..6cf5f7da7849 100644 --- a/sdk/search/search-documents/package.json +++ b/sdk/search/search-documents/package.json @@ -1,6 +1,6 @@ { "name": "@azure/search-documents", - "version": "11.1.1", + "version": "11.2.0-beta.1", "description": "Azure client library to use Cognitive Search for node.js and browser.", "sdk-type": "client", "main": "dist/index.js", diff --git a/sdk/search/search-documents/review/search-documents.api.md b/sdk/search/search-documents/review/search-documents.api.md index 79ea68db1eb2..28f9ef5101f3 100644 --- a/sdk/search/search-documents/review/search-documents.api.md +++ b/sdk/search/search-documents/review/search-documents.api.md @@ -128,7 +128,7 @@ export interface BaseSearchIndexerSkill { description?: string; inputs: InputFieldMappingEntry[]; name?: string; - odatatype: "#Microsoft.Skills.Util.ConditionalSkill" | "#Microsoft.Skills.Text.KeyPhraseExtractionSkill" | "#Microsoft.Skills.Vision.OcrSkill" | "#Microsoft.Skills.Vision.ImageAnalysisSkill" | "#Microsoft.Skills.Text.LanguageDetectionSkill" | "#Microsoft.Skills.Util.ShaperSkill" | "#Microsoft.Skills.Text.MergeSkill" | "#Microsoft.Skills.Text.EntityRecognitionSkill" | "#Microsoft.Skills.Text.SentimentSkill" | "#Microsoft.Skills.Text.SplitSkill" | "#Microsoft.Skills.Text.TranslationSkill" | "#Microsoft.Skills.Custom.WebApiSkill"; + odatatype: "#Microsoft.Skills.Util.ConditionalSkill" | "#Microsoft.Skills.Text.KeyPhraseExtractionSkill" | "#Microsoft.Skills.Vision.OcrSkill" | "#Microsoft.Skills.Vision.ImageAnalysisSkill" | "#Microsoft.Skills.Text.LanguageDetectionSkill" | "#Microsoft.Skills.Util.ShaperSkill" | "#Microsoft.Skills.Text.MergeSkill" | "#Microsoft.Skills.Text.EntityRecognitionSkill" | "#Microsoft.Skills.Text.SentimentSkill" | "#Microsoft.Skills.Text.SplitSkill" | "#Microsoft.Skills.Text.CustomEntityLookupSkill" | "#Microsoft.Skills.Text.TranslationSkill" | "#Microsoft.Skills.Util.DocumentExtractionSkill" | "#Microsoft.Skills.Custom.WebApiSkill"; outputs: OutputFieldMappingEntry[]; } @@ -160,6 +160,9 @@ export type BM25Similarity = Similarity & { // @public export type CharFilter = MappingCharFilter | PatternReplaceCharFilter; +// @public +export type CharFilterName = string; + // @public export type CjkBigramTokenFilter = BaseTokenFilter & { odatatype: "#Microsoft.Azure.Search.CjkBigramTokenFilter"; @@ -216,7 +219,7 @@ export type ConditionalSkill = BaseSearchIndexerSkill & { // @public export interface CorsOptions { allowedOrigins: string[]; - maxAgeInSeconds?: number; + maxAgeInSeconds?: number | null; } // @public @@ -272,6 +275,50 @@ export interface CustomAnalyzer { tokenizerName: string; } +// @public +export interface CustomEntity { + accentSensitive?: boolean | null; + aliases?: CustomEntityAlias[] | null; + caseSensitive?: boolean | null; + defaultAccentSensitive?: boolean | null; + defaultCaseSensitive?: boolean | null; + defaultFuzzyEditDistance?: number | null; + description?: string | null; + fuzzyEditDistance?: number | null; + id?: string | null; + name: string; + subtype?: string | null; + type?: string | null; +} + +// @public +export interface CustomEntityAlias { + accentSensitive?: boolean | null; + caseSensitive?: boolean | null; + fuzzyEditDistance?: number | null; + text: string; +} + +// @public +export type CustomEntityLookupSkill = BaseSearchIndexerSkill & { + odatatype: "#Microsoft.Skills.Text.CustomEntityLookupSkill"; + defaultLanguageCode?: CustomEntityLookupSkillLanguage | null; + entitiesDefinitionUri?: string | null; + inlineEntitiesDefinition?: CustomEntity[] | null; + globalDefaultCaseSensitive?: boolean | null; + globalDefaultAccentSensitive?: boolean | null; + globalDefaultFuzzyEditDistance?: number | null; +}; + +// @public +export type CustomEntityLookupSkillLanguage = string; + +// @public +export type CustomNormalizer = LexicalNormalizer & { + tokenFilters?: TokenFilterName[]; + charFilters?: CharFilterName[]; +}; + // @public export type DataChangeDetectionPolicy = HighWaterMarkChangeDetectionPolicy | SqlIntegratedChangeTrackingPolicy; @@ -342,6 +389,16 @@ export interface DistanceScoringParameters { referencePointParameter: string; } +// @public +export type DocumentExtractionSkill = BaseSearchIndexerSkill & { + odatatype: "#Microsoft.Skills.Util.DocumentExtractionSkill"; + parsingMode?: string | null; + dataToExtract?: string | null; + configuration?: { + [propertyName: string]: any; + } | null; +}; + // @public export interface EdgeNGramTokenFilter { maxGram?: number; @@ -601,6 +658,7 @@ export type KeyPhraseExtractionSkill = BaseSearchIndexerSkill & { odatatype: "#Microsoft.Skills.Text.KeyPhraseExtractionSkill"; defaultLanguageCode?: KeyPhraseExtractionSkillLanguage; maxKeyPhraseCount?: number | null; + modelVersion?: string | null; }; // @public @@ -747,11 +805,29 @@ export const enum KnownBlobIndexerPDFTextRotationAlgorithm { None = "none" } +// @public +export const enum KnownCharFilterName { + HtmlStrip = "html_strip" +} + // @public export enum KnownCharFilterNames { HtmlStrip = "html_strip" } +// @public +export const enum KnownCustomEntityLookupSkillLanguage { + Da = "da", + De = "de", + En = "en", + Es = "es", + Fi = "fi", + Fr = "fr", + It = "it", + Ko = "ko", + Pt = "pt" +} + // @public export const enum KnownEntityCategory { Datetime = "datetime", @@ -922,6 +998,15 @@ export const enum KnownLexicalAnalyzerName { ZhHantMicrosoft = "zh-Hant.microsoft" } +// @public +export const enum KnownLexicalNormalizerName { + AsciiFolding = "asciifolding", + Elision = "elision", + Lowercase = "lowercase", + Standard = "standard", + Uppercase = "uppercase" +} + // @public export const enum KnownOcrSkillLanguage { Ar = "ar", @@ -966,6 +1051,7 @@ export const enum KnownRegexFlags { // @public export const enum KnownSearchIndexerDataSourceType { + AdlsGen2 = "adlsgen2", AzureBlob = "azureblob", AzureSql = "azuresql", AzureTable = "azuretable", @@ -1078,6 +1164,44 @@ export const enum KnownTextTranslationSkillLanguage { ZhHant = "zh-Hant" } +// @public +export const enum KnownTokenFilterName { + Apostrophe = "apostrophe", + ArabicNormalization = "arabic_normalization", + AsciiFolding = "asciifolding", + CjkBigram = "cjk_bigram", + CjkWidth = "cjk_width", + Classic = "classic", + CommonGram = "common_grams", + EdgeNGram = "edgeNGram_v2", + Elision = "elision", + GermanNormalization = "german_normalization", + HindiNormalization = "hindi_normalization", + IndicNormalization = "indic_normalization", + KeywordRepeat = "keyword_repeat", + KStem = "kstem", + Length = "length", + Limit = "limit", + Lowercase = "lowercase", + NGram = "nGram_v2", + PersianNormalization = "persian_normalization", + Phonetic = "phonetic", + PorterStem = "porter_stem", + Reverse = "reverse", + ScandinavianFoldingNormalization = "scandinavian_folding", + ScandinavianNormalization = "scandinavian_normalization", + Shingle = "shingle", + Snowball = "snowball", + SoraniNormalization = "sorani_normalization", + Stemmer = "stemmer", + Stopwords = "stopwords", + Trim = "trim", + Truncate = "truncate", + Unique = "unique", + Uppercase = "uppercase", + WordDelimiter = "word_delimiter" +} + // @public export enum KnownTokenFilterNames { Apostrophe = "apostrophe", @@ -1147,6 +1271,8 @@ export const enum KnownVisualFeature { // @public export type LanguageDetectionSkill = BaseSearchIndexerSkill & { odatatype: "#Microsoft.Skills.Text.LanguageDetectionSkill"; + defaultCountryHint?: string | null; + modelVersion?: string | null; }; // @public @@ -1162,6 +1288,15 @@ export type LexicalAnalyzer = CustomAnalyzer | PatternAnalyzer | LuceneStandardA // @public export type LexicalAnalyzerName = string; +// @public +export interface LexicalNormalizer { + name: string; + odatatype: string; +} + +// @public +export type LexicalNormalizerName = string; + // @public export type LexicalTokenizer = ClassicTokenizer | EdgeNGramTokenizer | KeywordTokenizer | MicrosoftLanguageTokenizer | MicrosoftLanguageStemmingTokenizer | NGramTokenizer | PathHierarchyTokenizer | PatternTokenizer | LuceneStandardTokenizer | UaxUrlEmailTokenizer; @@ -1356,7 +1491,7 @@ export type PhoneticTokenFilter = BaseTokenFilter & { }; // @public -export type QueryType = "simple" | "full"; +export type QueryType = "simple" | "full" | "semantic"; // @public export type RegexFlags = string; @@ -1451,6 +1586,7 @@ export interface SearchIndex { etag?: string; fields: SearchField[]; name: string; + normalizers?: LexicalNormalizer[]; scoringProfiles?: ScoringProfile[]; similarity?: SimilarityAlgorithm; suggesters?: SearchSuggester[]; @@ -1571,7 +1707,7 @@ export interface SearchIndexerLimits { } // @public -export type SearchIndexerSkill = ConditionalSkill | KeyPhraseExtractionSkill | OcrSkill | ImageAnalysisSkill | LanguageDetectionSkill | ShaperSkill | MergeSkill | EntityRecognitionSkill | SentimentSkill | SplitSkill | TextTranslationSkill | WebApiSkill; +export type SearchIndexerSkill = ConditionalSkill | KeyPhraseExtractionSkill | OcrSkill | ImageAnalysisSkill | LanguageDetectionSkill | ShaperSkill | MergeSkill | EntityRecognitionSkill | SentimentSkill | SplitSkill | CustomEntityLookupSkill | TextTranslationSkill | DocumentExtractionSkill | WebApiSkill; // @public export interface SearchIndexerSkillset { @@ -1723,7 +1859,7 @@ export interface SearchResourceEncryptionKey { export type SearchResult = { readonly score: number; readonly highlights?: { - [propertyName: string]: string[]; + [k in keyof T]?: string[]; }; document: T; }; @@ -1756,6 +1892,7 @@ export interface ServiceCounters { documentCounter: ResourceCounter; indexCounter: ResourceCounter; indexerCounter: ResourceCounter; + skillsetCounter: ResourceCounter; storageSizeCounter: ResourceCounter; synonymMapCounter: ResourceCounter; } @@ -1801,6 +1938,7 @@ export interface SimpleField { indexAnalyzerName?: LexicalAnalyzerName; key?: boolean; name: string; + normalizerName?: LexicalNormalizerName; searchable?: boolean; searchAnalyzerName?: LexicalAnalyzerName; sortable?: boolean; @@ -1955,6 +2093,9 @@ export type TokenCharacterKind = "letter" | "digit" | "whitespace" | "punctuatio // @public export type TokenFilter = AsciiFoldingTokenFilter | CjkBigramTokenFilter | CommonGramTokenFilter | DictionaryDecompounderTokenFilter | EdgeNGramTokenFilter | ElisionTokenFilter | KeepTokenFilter | KeywordMarkerTokenFilter | LengthTokenFilter | LimitTokenFilter | NGramTokenFilter | PatternCaptureTokenFilter | PatternReplaceTokenFilter | PhoneticTokenFilter | ShingleTokenFilter | SnowballTokenFilter | StemmerTokenFilter | StemmerOverrideTokenFilter | StopwordsTokenFilter | SynonymTokenFilter | TruncateTokenFilter | UniqueTokenFilter | WordDelimiterTokenFilter; +// @public +export type TokenFilterName = string; + // @public export type TruncateTokenFilter = BaseTokenFilter & { odatatype: "#Microsoft.Azure.Search.TruncateTokenFilter"; diff --git a/sdk/search/search-documents/src/constants.ts b/sdk/search/search-documents/src/constants.ts index 15cbaa77a7ae..eb78e31a91ea 100644 --- a/sdk/search/search-documents/src/constants.ts +++ b/sdk/search/search-documents/src/constants.ts @@ -1,4 +1,4 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export const SDK_VERSION: string = "11.1.1"; +export const SDK_VERSION: string = "11.2.0-beta.1"; diff --git a/sdk/search/search-documents/src/generated/data/models/index.ts b/sdk/search/search-documents/src/generated/data/models/index.ts index 6f98ea640204..29cda4887e22 100644 --- a/sdk/search/search-documents/src/generated/data/models/index.ts +++ b/sdk/search/search-documents/src/generated/data/models/index.ts @@ -44,6 +44,11 @@ export interface SearchDocumentsResult { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly facets?: { [propertyName: string]: FacetResult[] }; + /** + * The answers query results for the search operation; null if the answers query parameter was not specified or set to 'none'. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly answers?: { [propertyName: string]: AnswerResult[] } | null; /** * Continuation JSON payload returned when Azure Cognitive Search can't return all the requested results in a single Search 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. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -72,6 +77,32 @@ export interface FacetResult { readonly count?: number; } +/** 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. */ +export interface AnswerResult { + /** Describes unknown properties. The value of an unknown property can be of "any" type. */ + [property: string]: any; + /** + * The score value represents how relevant the answer is to the the query relative to other answers returned for the query. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly score?: number; + /** + * The key of the document the answer was extracted from. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly key?: string; + /** + * The text passage extracted from the document contents as the answer. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly text?: string; + /** + * Same text passage as in the Text property with highlighted text phrases most relevant to the query. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly highlights?: string | null; +} + /** Parameters for filtering, sorting, faceting, paging, and other search query behaviors. */ export interface SearchRequest { /** 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. */ @@ -106,6 +137,12 @@ export interface SearchRequest { searchFields?: string; /** A value that specifies whether any or all of the search terms must be matched in order to count the document as a match. */ searchMode?: SearchMode; + /** A value that specifies the language of the search query. */ + queryLanguage?: QueryLanguage; + /** A value that specified the type of the speller to use to spell-correct individual search query terms. */ + speller?: Speller; + /** A value that specifies whether answers should be returned as part of the search response. */ + answers?: Answers; /** The comma-separated list of fields to retrieve. If unspecified, all fields marked as retrievable in the schema are included. */ select?: string; /** 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. */ @@ -123,11 +160,37 @@ export interface SearchResult { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly _score: number; + /** + * 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'. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly rerankerScore?: number | null; /** * 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. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly _highlights?: { [propertyName: string]: string[] }; + /** + * 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'. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly captions?: { [propertyName: string]: CaptionResult[] } | null; +} + +/** 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'.. */ +export interface CaptionResult { + /** Describes unknown properties. The value of an unknown property can be of "any" type. */ + [property: string]: any; + /** + * A representative text passage extracted from the document most relevant to the search query. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly text?: string; + /** + * Same text passage as in the Text property with highlighted phrases most relevant to the query. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly highlights?: string | null; } /** Response containing suggestion query results from an index. */ @@ -312,6 +375,12 @@ export interface SearchOptions { scoringProfile?: string; /** 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. */ searchFields?: string[]; + /** The language of the query. */ + queryLanguage?: QueryLanguage; + /** Improve search recall by spell-correcting individual search query terms. */ + speller?: Speller; + /** 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. */ + answers?: Answers; /** A value that specifies whether any or all of the search terms must be matched in order to count the document as a match. */ 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. */ @@ -368,22 +437,76 @@ export interface AutocompleteOptions { top?: number; } -/** Known values of {@link ApiVersion20200630} that the service accepts. */ -export const enum KnownApiVersion20200630 { - /** Api Version '2020-06-30' */ - TwoThousandTwenty0630 = "2020-06-30" +/** Known values of {@link ApiVersion20200630Preview} that the service accepts. */ +export const enum KnownApiVersion20200630Preview { + /** Api Version '2020-06-30-Preview' */ + TwoThousandTwenty0630Preview = "2020-06-30-Preview" +} + +/** + * Defines values for ApiVersion20200630Preview. \ + * {@link KnownApiVersion20200630Preview} can be used interchangeably with ApiVersion20200630Preview, + * this enum contains the known values that the service supports. + * ### Know values supported by the service + * **2020-06-30-Preview**: Api Version '2020-06-30-Preview' + */ +export type ApiVersion20200630Preview = string; + +/** Known values of {@link QueryLanguage} that the service accepts. */ +export const enum KnownQueryLanguage { + /** Query language not specified. */ + None = "none", + /** English */ + EnUs = "en-us" +} + +/** + * Defines values for QueryLanguage. \ + * {@link KnownQueryLanguage} can be used interchangeably with QueryLanguage, + * this enum contains the known values that the service supports. + * ### Know values supported by the service + * **none**: Query language not specified. \ + * **en-us**: English + */ +export type QueryLanguage = string; + +/** Known values of {@link Speller} that the service accepts. */ +export const enum KnownSpeller { + /** Speller not enabled. */ + None = "none", + /** Speller corrects individual query terms using a static lexicon for the language specified by the queryLanguage parameter. */ + Lexicon = "lexicon" +} + +/** + * Defines values for Speller. \ + * {@link KnownSpeller} can be used interchangeably with Speller, + * this enum contains the known values that the service supports. + * ### Know values supported by the service + * **none**: Speller not enabled. \ + * **lexicon**: Speller corrects individual query terms using a static lexicon for the language specified by the queryLanguage parameter. + */ +export type Speller = string; + +/** Known values of {@link Answers} that the service accepts. */ +export const enum KnownAnswers { + /** Do not return answers for the query. */ + None = "none", + /** Extracts answer candidates from the contents of the documents returned in response to a query expressed as a question in natural language. */ + Extractive = "extractive" } /** - * Defines values for ApiVersion20200630. \ - * {@link KnownApiVersion20200630} can be used interchangeably with ApiVersion20200630, + * Defines values for Answers. \ + * {@link KnownAnswers} can be used interchangeably with Answers, * this enum contains the known values that the service supports. * ### Know values supported by the service - * **2020-06-30**: Api Version '2020-06-30' + * **none**: Do not return answers for the query. \ + * **extractive**: Extracts answer candidates from the contents of the documents returned in response to a query expressed as a question in natural language. */ -export type ApiVersion20200630 = string; +export type Answers = string; /** Defines values for QueryType. */ -export type QueryType = "simple" | "full"; +export type QueryType = "simple" | "full" | "semantic"; /** Defines values for SearchMode. */ export type SearchMode = "any" | "all"; /** Defines values for ScoringStatistics. */ diff --git a/sdk/search/search-documents/src/generated/data/models/mappers.ts b/sdk/search/search-documents/src/generated/data/models/mappers.ts index 1c09a0595d80..9c9a98647776 100644 --- a/sdk/search/search-documents/src/generated/data/models/mappers.ts +++ b/sdk/search/search-documents/src/generated/data/models/mappers.ts @@ -77,6 +77,22 @@ export const SearchDocumentsResult: coreHttp.CompositeMapper = { } } }, + answers: { + serializedName: "@search\\.answers", + readOnly: true, + nullable: true, + type: { + name: "Dictionary", + value: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "AnswerResult" } + } + } + } + } + }, nextPageParameters: { serializedName: "@search\\.nextPageParameters", type: { @@ -126,6 +142,45 @@ export const FacetResult: coreHttp.CompositeMapper = { } }; +export const AnswerResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "AnswerResult", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + score: { + serializedName: "score", + readOnly: true, + type: { + name: "Number" + } + }, + key: { + serializedName: "key", + readOnly: true, + type: { + name: "String" + } + }, + text: { + serializedName: "text", + readOnly: true, + type: { + name: "String" + } + }, + highlights: { + serializedName: "highlights", + readOnly: true, + nullable: true, + type: { + name: "String" + } + } + } + } +}; + export const SearchRequest: coreHttp.CompositeMapper = { type: { name: "Composite", @@ -188,7 +243,7 @@ export const SearchRequest: coreHttp.CompositeMapper = { serializedName: "queryType", type: { name: "Enum", - allowedValues: ["simple", "full"] + allowedValues: ["simple", "full", "semantic"] } }, scoringStatistics: { @@ -240,6 +295,24 @@ export const SearchRequest: coreHttp.CompositeMapper = { allowedValues: ["any", "all"] } }, + queryLanguage: { + serializedName: "queryLanguage", + type: { + name: "String" + } + }, + speller: { + serializedName: "speller", + type: { + name: "String" + } + }, + answers: { + serializedName: "answers", + type: { + name: "String" + } + }, select: { serializedName: "select", type: { @@ -276,6 +349,14 @@ export const SearchResult: coreHttp.CompositeMapper = { name: "Number" } }, + rerankerScore: { + serializedName: "@search\\.rerankerScore", + readOnly: true, + nullable: true, + type: { + name: "Number" + } + }, _highlights: { serializedName: "@search\\.highlights", readOnly: true, @@ -285,6 +366,47 @@ export const SearchResult: coreHttp.CompositeMapper = { type: { name: "Sequence", element: { type: { name: "String" } } } } } + }, + captions: { + serializedName: "@search\\.captions", + readOnly: true, + nullable: true, + type: { + name: "Dictionary", + value: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "CaptionResult" } + } + } + } + } + } + } + } +}; + +export const CaptionResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CaptionResult", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + text: { + serializedName: "text", + readOnly: true, + type: { + name: "String" + } + }, + highlights: { + serializedName: "highlights", + readOnly: true, + nullable: true, + type: { + name: "String" + } } } } diff --git a/sdk/search/search-documents/src/generated/data/models/parameters.ts b/sdk/search/search-documents/src/generated/data/models/parameters.ts index 56e10b8f66de..c9f82c40a7d6 100644 --- a/sdk/search/search-documents/src/generated/data/models/parameters.ts +++ b/sdk/search/search-documents/src/generated/data/models/parameters.ts @@ -189,7 +189,7 @@ export const queryType: OperationQueryParameter = { serializedName: "queryType", type: { name: "Enum", - allowedValues: ["simple", "full"] + allowedValues: ["simple", "full", "semantic"] } } }; @@ -236,6 +236,36 @@ export const searchFields: OperationQueryParameter = { collectionFormat: QueryCollectionFormat.Csv }; +export const queryLanguage: OperationQueryParameter = { + parameterPath: ["options", "searchOptions", "queryLanguage"], + mapper: { + serializedName: "queryLanguage", + type: { + name: "String" + } + } +}; + +export const speller: OperationQueryParameter = { + parameterPath: ["options", "searchOptions", "speller"], + mapper: { + serializedName: "speller", + type: { + name: "String" + } + } +}; + +export const answers: OperationQueryParameter = { + parameterPath: ["options", "searchOptions", "answers"], + mapper: { + serializedName: "answers", + type: { + name: "String" + } + } +}; + export const searchMode: OperationQueryParameter = { parameterPath: ["options", "searchOptions", "searchMode"], mapper: { diff --git a/sdk/search/search-documents/src/generated/data/operations/documents.ts b/sdk/search/search-documents/src/generated/data/operations/documents.ts index c99a44b4e372..c34030c449e4 100644 --- a/sdk/search/search-documents/src/generated/data/operations/documents.ts +++ b/sdk/search/search-documents/src/generated/data/operations/documents.ts @@ -266,6 +266,9 @@ const searchGetOperationSpec: coreHttp.OperationSpec = { Parameters.scoringParameters, Parameters.scoringProfile, Parameters.searchFields, + Parameters.queryLanguage, + Parameters.speller, + Parameters.answers, Parameters.searchMode, Parameters.scoringStatistics, Parameters.sessionId, diff --git a/sdk/search/search-documents/src/generated/data/searchClient.ts b/sdk/search/search-documents/src/generated/data/searchClient.ts index 1eab727ffc07..38a23a27d609 100644 --- a/sdk/search/search-documents/src/generated/data/searchClient.ts +++ b/sdk/search/search-documents/src/generated/data/searchClient.ts @@ -8,7 +8,10 @@ import { Documents } from "./operations"; import { SearchClientContext } from "./searchClientContext"; -import { SearchClientOptionalParams, ApiVersion20200630 } from "./models"; +import { + SearchClientOptionalParams, + ApiVersion20200630Preview +} from "./models"; /** @internal */ export class SearchClient extends SearchClientContext { @@ -22,7 +25,7 @@ export class SearchClient extends SearchClientContext { constructor( endpoint: string, indexName: string, - apiVersion: ApiVersion20200630, + apiVersion: ApiVersion20200630Preview, options?: SearchClientOptionalParams ) { super(endpoint, indexName, apiVersion, options); diff --git a/sdk/search/search-documents/src/generated/data/searchClientContext.ts b/sdk/search/search-documents/src/generated/data/searchClientContext.ts index b72d1cbdba7f..260ca2b9aa2f 100644 --- a/sdk/search/search-documents/src/generated/data/searchClientContext.ts +++ b/sdk/search/search-documents/src/generated/data/searchClientContext.ts @@ -7,16 +7,19 @@ */ import * as coreHttp from "@azure/core-http"; -import { ApiVersion20200630, SearchClientOptionalParams } from "./models"; +import { + ApiVersion20200630Preview, + SearchClientOptionalParams +} from "./models"; const packageName = "@azure/search-documents"; -const packageVersion = "11.1.1"; +const packageVersion = "11.2.0-beta.1"; /** @internal */ export class SearchClientContext extends coreHttp.ServiceClient { endpoint: string; indexName: string; - apiVersion: ApiVersion20200630; + apiVersion: ApiVersion20200630Preview; /** * Initializes a new instance of the SearchClientContext class. @@ -28,7 +31,7 @@ export class SearchClientContext extends coreHttp.ServiceClient { constructor( endpoint: string, indexName: string, - apiVersion: ApiVersion20200630, + apiVersion: ApiVersion20200630Preview, options?: SearchClientOptionalParams ) { if (endpoint === undefined) { diff --git a/sdk/search/search-documents/src/generated/service/models/index.ts b/sdk/search/search-documents/src/generated/service/models/index.ts index 1387bbc91cd4..094fbcd479d0 100644 --- a/sdk/search/search-documents/src/generated/service/models/index.ts +++ b/sdk/search/search-documents/src/generated/service/models/index.ts @@ -27,7 +27,9 @@ export type SearchIndexerSkillUnion = | EntityRecognitionSkill | SentimentSkill | SplitSkill + | CustomEntityLookupSkill | TextTranslationSkill + | DocumentExtractionSkill | WebApiSkill; export type CognitiveServicesAccountUnion = | CognitiveServicesAccount @@ -116,7 +118,7 @@ export interface SearchIndexerDataSource { /** Represents credentials that can be used to connect to a datasource. */ export interface DataSourceCredentials { - /** The connection string for the datasource. */ + /** The connection string for the datasource. Set to '' if you do not want the connection string updated. */ connectionString?: string; } @@ -492,7 +494,9 @@ export interface SearchIndexerSkill { | "#Microsoft.Skills.Text.EntityRecognitionSkill" | "#Microsoft.Skills.Text.SentimentSkill" | "#Microsoft.Skills.Text.SplitSkill" + | "#Microsoft.Skills.Text.CustomEntityLookupSkill" | "#Microsoft.Skills.Text.TranslationSkill" + | "#Microsoft.Skills.Util.DocumentExtractionSkill" | "#Microsoft.Skills.Custom.WebApiSkill"; /** 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 '#'. */ name?: string; @@ -590,6 +594,8 @@ export interface SearchIndex { tokenFilters?: TokenFilterUnion[]; /** The character filters for the index. */ charFilters?: CharFilterUnion[]; + /** The normalizers for the index. */ + normalizers?: LexicalNormalizer[]; /** 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 in Azure Cognitive Search. Once you have encrypted your data, it will always remain encrypted. Azure Cognitive Search 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. */ encryptionKey?: SearchResourceEncryptionKey | null; /** 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. */ @@ -622,6 +628,8 @@ export interface SearchField { searchAnalyzer?: LexicalAnalyzerName | null; /** 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. */ indexAnalyzer?: LexicalAnalyzerName | null; + /** 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. */ + normalizer?: LexicalNormalizerName | null; /** 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. */ synonymMaps?: string[]; /** 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. */ @@ -663,7 +671,7 @@ export interface CorsOptions { /** 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). */ allowedOrigins: string[]; /** The duration for which browsers should cache CORS preflight responses. Defaults to 5 minutes. */ - maxAgeInSeconds?: number; + maxAgeInSeconds?: number | null; } /** Defines how the Suggest API should apply to a group of fields in the index. */ @@ -751,6 +759,14 @@ export interface CharFilter { name: string; } +/** Base type for normalizers. */ +export interface LexicalNormalizer { + /** Identifies the concrete type of the normalizer. */ + odatatype: string; + /** 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'. */ + name: string; +} + /** 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. */ export interface Similarity { /** Polymorphic discriminator, which specifies the different types this object can be */ @@ -848,6 +864,8 @@ export interface ServiceCounters { storageSizeCounter: ResourceCounter; /** Total number of synonym maps. */ synonymMapCounter: ResourceCounter; + /** Total number of skillsets. */ + skillsetCounter: ResourceCounter; } /** Represents a resource's usage and quota. */ @@ -900,6 +918,46 @@ export interface TagScoringParameters { tagsParameter: string; } +/** An object that contains information about the matches that were found, and related metadata. */ +export interface CustomEntity { + /** 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. */ + name: string; + /** 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. */ + description?: string | null; + /** 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. */ + type?: string | null; + /** 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. */ + subtype?: string | null; + /** 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. */ + id?: string | null; + /** 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. */ + caseSensitive?: boolean | null; + /** Defaults to false. Boolean value denoting whether comparisons with the entity name should be sensitive to accent. */ + accentSensitive?: boolean | null; + /** 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. */ + fuzzyEditDistance?: number | null; + /** Changes the default case sensitivity value for this entity. It be used to change the default value of all aliases caseSensitive values. */ + defaultCaseSensitive?: boolean | null; + /** Changes the default accent sensitivity value for this entity. It be used to change the default value of all aliases accentSensitive values. */ + defaultAccentSensitive?: boolean | null; + /** Changes the default fuzzy edit distance value for this entity. It can be used to change the default value of all aliases fuzzyEditDistance values. */ + defaultFuzzyEditDistance?: number | null; + /** An array of complex objects that can be used to specify alternative spellings or synonyms to the root entity name. */ + aliases?: CustomEntityAlias[] | null; +} + +/** A complex object that can be used to specify alternative spellings or synonyms to the root entity name. */ +export interface CustomEntityAlias { + /** The text of the alias. */ + text: string; + /** Determine if the alias is case sensitive. */ + caseSensitive?: boolean | null; + /** Determine if the alias is accent sensitive. */ + accentSensitive?: boolean | null; + /** Determine the fuzzy edit distance of the alias. */ + fuzzyEditDistance?: number | null; +} + /** Defines a data change detection policy that captures changes based on the value of a high water mark column. */ export type HighWaterMarkChangeDetectionPolicy = DataChangeDetectionPolicy & { /** Polymorphic discriminator, which specifies the different types this object can be */ @@ -938,6 +996,8 @@ export type KeyPhraseExtractionSkill = SearchIndexerSkill & { defaultLanguageCode?: KeyPhraseExtractionSkillLanguage; /** A number indicating how many key phrases to return. If absent, all identified key phrases will be returned. */ maxKeyPhraseCount?: number | null; + /** 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. */ + modelVersion?: string | null; }; /** A skill that extracts text from image files. */ @@ -966,6 +1026,10 @@ export type ImageAnalysisSkill = SearchIndexerSkill & { export type LanguageDetectionSkill = SearchIndexerSkill & { /** Polymorphic discriminator, which specifies the different types this object can be */ odatatype: "#Microsoft.Skills.Text.LanguageDetectionSkill"; + /** A country code to use as a hint to the language detection model if it cannot disambiguate the language. */ + defaultCountryHint?: string | null; + /** 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. */ + modelVersion?: string | null; }; /** A skill for reshaping the outputs. It creates a complex type to support composite fields (also known as multipart fields). */ @@ -1018,6 +1082,24 @@ export type SplitSkill = SearchIndexerSkill & { maxPageLength?: number | null; }; +/** A skill looks for text from a custom, user-defined list of words and phrases. */ +export type CustomEntityLookupSkill = SearchIndexerSkill & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + odatatype: "#Microsoft.Skills.Text.CustomEntityLookupSkill"; + /** A value indicating which language code to use. Default is en. */ + defaultLanguageCode?: CustomEntityLookupSkillLanguage | null; + /** 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. */ + entitiesDefinitionUri?: string | null; + /** The inline CustomEntity definition. */ + inlineEntitiesDefinition?: CustomEntity[] | null; + /** A global flag for CaseSensitive. If CaseSensitive is not set in CustomEntity, this value will be the default value. */ + globalDefaultCaseSensitive?: boolean | null; + /** A global flag for AccentSensitive. If AccentSensitive is not set in CustomEntity, this value will be the default value. */ + globalDefaultAccentSensitive?: boolean | null; + /** A global flag for FuzzyEditDistance. If FuzzyEditDistance is not set in CustomEntity, this value will be the default value. */ + globalDefaultFuzzyEditDistance?: number | null; +}; + /** A skill to translate text from one language to another. */ export type TextTranslationSkill = SearchIndexerSkill & { /** Polymorphic discriminator, which specifies the different types this object can be */ @@ -1030,6 +1112,18 @@ export type TextTranslationSkill = SearchIndexerSkill & { suggestedFrom?: TextTranslationSkillLanguage | null; }; +/** A skill that extracts content from a file within the enrichment pipeline. */ +export type DocumentExtractionSkill = SearchIndexerSkill & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + odatatype: "#Microsoft.Skills.Util.DocumentExtractionSkill"; + /** The parsingMode for the skill. Will be set to 'default' if not defined. */ + parsingMode?: string | null; + /** The type of data to be extracted for the skill. Will be set to 'contentAndMetadata' if not defined. */ + dataToExtract?: string | null; + /** A dictionary of configurations for the skill. */ + configuration?: { [propertyName: string]: any } | null; +}; + /** A skill that can call a Web API endpoint, allowing you to extend a skillset by having it call your custom code. */ export type WebApiSkill = SearchIndexerSkill & { /** Polymorphic discriminator, which specifies the different types this object can be */ @@ -1558,6 +1652,14 @@ export type PatternReplaceCharFilter = CharFilter & { replacement: string; }; +/** 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. */ +export type CustomNormalizer = LexicalNormalizer & { + /** 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. */ + tokenFilters?: TokenFilterName[]; + /** 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. */ + charFilters?: CharFilterName[]; +}; + /** 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. */ export type ClassicSimilarity = Similarity & { /** Polymorphic discriminator, which specifies the different types this object can be */ @@ -1580,20 +1682,20 @@ export interface RequestOptions { xMsClientRequestId?: string; } -/** Known values of {@link ApiVersion20200630} that the service accepts. */ -export const enum KnownApiVersion20200630 { - /** Api Version '2020-06-30' */ - TwoThousandTwenty0630 = "2020-06-30" +/** Known values of {@link ApiVersion20200630Preview} that the service accepts. */ +export const enum KnownApiVersion20200630Preview { + /** Api Version '2020-06-30-Preview' */ + TwoThousandTwenty0630Preview = "2020-06-30-Preview" } /** - * Defines values for ApiVersion20200630. \ - * {@link KnownApiVersion20200630} can be used interchangeably with ApiVersion20200630, + * Defines values for ApiVersion20200630Preview. \ + * {@link KnownApiVersion20200630Preview} can be used interchangeably with ApiVersion20200630Preview, * this enum contains the known values that the service supports. * ### Know values supported by the service - * **2020-06-30**: Api Version '2020-06-30' + * **2020-06-30-Preview**: Api Version '2020-06-30-Preview' */ -export type ApiVersion20200630 = string; +export type ApiVersion20200630Preview = string; /** Known values of {@link SearchIndexerDataSourceType} that the service accepts. */ export const enum KnownSearchIndexerDataSourceType { @@ -1601,12 +1703,14 @@ export const enum KnownSearchIndexerDataSourceType { AzureSql = "azuresql", /** Indicates a CosmosDB datasource. */ CosmosDb = "cosmosdb", - /** Indicates a Azure Blob datasource. */ + /** Indicates an Azure Blob datasource. */ AzureBlob = "azureblob", - /** Indicates a Azure Table datasource. */ + /** Indicates an Azure Table datasource. */ AzureTable = "azuretable", /** Indicates a MySql datasource. */ - MySql = "mysql" + MySql = "mysql", + /** Indicates an ADLS Gen2 datasource. */ + AdlsGen2 = "adlsgen2" } /** @@ -1616,9 +1720,10 @@ export const enum KnownSearchIndexerDataSourceType { * ### Know values supported by the service * **azuresql**: Indicates an Azure SQL datasource. \ * **cosmosdb**: Indicates a CosmosDB datasource. \ - * **azureblob**: Indicates a Azure Blob datasource. \ - * **azuretable**: Indicates a Azure Table datasource. \ - * **mysql**: Indicates a MySql datasource. + * **azureblob**: Indicates an Azure Blob datasource. \ + * **azuretable**: Indicates an Azure Table datasource. \ + * **mysql**: Indicates a MySql datasource. \ + * **adlsgen2**: Indicates an ADLS Gen2 datasource. */ export type SearchIndexerDataSourceType = string; @@ -2073,6 +2178,33 @@ export const enum KnownLexicalAnalyzerName { */ export type LexicalAnalyzerName = string; +/** Known values of {@link LexicalNormalizerName} that the service accepts. */ +export const enum KnownLexicalNormalizerName { + /** 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 */ + AsciiFolding = "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 */ + Elision = "elision", + /** Normalizes token text to lowercase. See https://lucene.apache.org/core/6_6_1/analyzers-common/org/apache/lucene/analysis/core/LowerCaseFilter.html */ + Lowercase = "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 */ + Standard = "standard", + /** Normalizes token text to uppercase. See https://lucene.apache.org/core/6_6_1/analyzers-common/org/apache/lucene/analysis/core/UpperCaseFilter.html */ + Uppercase = "uppercase" +} + +/** + * Defines values for LexicalNormalizerName. \ + * {@link KnownLexicalNormalizerName} can be used interchangeably with LexicalNormalizerName, + * this enum contains the known values that the service supports. + * ### Know values supported by the service + * **asciifolding**: 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 \ + * **elision**: 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 \ + * **lowercase**: Normalizes token text to lowercase. See https://lucene.apache.org/core/6_6_1/analyzers-common/org/apache/lucene/analysis/core/LowerCaseFilter.html \ + * **standard**: 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 \ + * **uppercase**: Normalizes token text to uppercase. See https://lucene.apache.org/core/6_6_1/analyzers-common/org/apache/lucene/analysis/core/UpperCaseFilter.html + */ +export type LexicalNormalizerName = string; + /** Known values of {@link KeyPhraseExtractionSkillLanguage} that the service accepts. */ export const enum KnownKeyPhraseExtractionSkillLanguage { /** Danish */ @@ -2529,6 +2661,45 @@ export const enum KnownTextSplitMode { */ export type TextSplitMode = string; +/** Known values of {@link CustomEntityLookupSkillLanguage} that the service accepts. */ +export const enum KnownCustomEntityLookupSkillLanguage { + /** Danish */ + Da = "da", + /** German */ + De = "de", + /** English */ + En = "en", + /** Spanish */ + Es = "es", + /** Finnish */ + Fi = "fi", + /** French */ + Fr = "fr", + /** Italian */ + It = "it", + /** Korean */ + Ko = "ko", + /** Portuguese */ + Pt = "pt" +} + +/** + * Defines values for CustomEntityLookupSkillLanguage. \ + * {@link KnownCustomEntityLookupSkillLanguage} can be used interchangeably with CustomEntityLookupSkillLanguage, + * this enum contains the known values that the service supports. + * ### Know values supported by the service + * **da**: Danish \ + * **de**: German \ + * **en**: English \ + * **es**: Spanish \ + * **fi**: Finnish \ + * **fr**: French \ + * **it**: Italian \ + * **ko**: Korean \ + * **pt**: Portuguese + */ +export type CustomEntityLookupSkillLanguage = string; + /** Known values of {@link TextTranslationSkillLanguage} that the service accepts. */ export const enum KnownTextTranslationSkillLanguage { /** Afrikaans */ @@ -2815,7 +2986,7 @@ export const enum KnownTokenFilterName { Length = "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 */ Limit = "limit", - /** Normalizes token text to lower case. See http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/core/LowerCaseFilter.htm */ + /** Normalizes token text to lower case. See https://lucene.apache.org/core/6_6_1/analyzers-common/org/apache/lucene/analysis/core/LowerCaseFilter.html */ Lowercase = "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 */ NGram = "nGram_v2", @@ -2847,7 +3018,7 @@ export const enum KnownTokenFilterName { Truncate = "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 */ Unique = "unique", - /** Normalizes token text to upper case. See http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/core/UpperCaseFilter.html */ + /** Normalizes token text to upper case. See https://lucene.apache.org/core/6_6_1/analyzers-common/org/apache/lucene/analysis/core/UpperCaseFilter.html */ Uppercase = "uppercase", /** Splits words into subwords and performs optional transformations on subword groups. */ WordDelimiter = "word_delimiter" @@ -2874,7 +3045,7 @@ export const enum KnownTokenFilterName { * **kstem**: 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 \ * **length**: 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 \ * **limit**: 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 \ - * **lowercase**: Normalizes token text to lower case. See http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/core/LowerCaseFilter.htm \ + * **lowercase**: Normalizes token text to lower case. See https://lucene.apache.org/core/6_6_1/analyzers-common/org/apache/lucene/analysis/core/LowerCaseFilter.html \ * **nGram_v2**: 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 \ * **persian_normalization**: Applies normalization for Persian. See http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/fa/PersianNormalizationFilter.html \ * **phonetic**: Create tokens for phonetic matches. See https://lucene.apache.org/core/4_10_3/analyzers-phonetic/org/apache/lucene/analysis/phonetic/package-tree.html \ @@ -2890,7 +3061,7 @@ export const enum KnownTokenFilterName { * **trim**: 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 \ * **truncate**: 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 \ * **unique**: 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 \ - * **uppercase**: Normalizes token text to upper case. See http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/core/UpperCaseFilter.html \ + * **uppercase**: Normalizes token text to upper case. See https://lucene.apache.org/core/6_6_1/analyzers-common/org/apache/lucene/analysis/core/UpperCaseFilter.html \ * **word_delimiter**: Splits words into subwords and performs optional transformations on subword groups. */ export type TokenFilterName = string; diff --git a/sdk/search/search-documents/src/generated/service/models/mappers.ts b/sdk/search/search-documents/src/generated/service/models/mappers.ts index 7e1a7225ef2d..dd6402a78bb9 100644 --- a/sdk/search/search-documents/src/generated/service/models/mappers.ts +++ b/sdk/search/search-documents/src/generated/service/models/mappers.ts @@ -1304,6 +1304,18 @@ export const SearchIndex: coreHttp.CompositeMapper = { } } }, + normalizers: { + serializedName: "normalizers", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "LexicalNormalizer" + } + } + } + }, encryptionKey: { serializedName: "encryptionKey", type: { @@ -1404,6 +1416,13 @@ export const SearchField: coreHttp.CompositeMapper = { name: "String" } }, + normalizer: { + serializedName: "normalizer", + nullable: true, + type: { + name: "String" + } + }, synonymMaps: { serializedName: "synonymMaps", type: { @@ -1557,6 +1576,7 @@ export const CorsOptions: coreHttp.CompositeMapper = { }, maxAgeInSeconds: { serializedName: "maxAgeInSeconds", + nullable: true, type: { name: "Number" } @@ -1713,6 +1733,29 @@ export const CharFilter: coreHttp.CompositeMapper = { } }; +export const LexicalNormalizer: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "LexicalNormalizer", + modelProperties: { + odatatype: { + serializedName: "@odata\\.type", + required: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + } + } + } +}; + export const Similarity: coreHttp.CompositeMapper = { type: { name: "Composite", @@ -1964,6 +2007,13 @@ export const ServiceCounters: coreHttp.CompositeMapper = { name: "Composite", className: "ResourceCounter" } + }, + skillsetCounter: { + serializedName: "skillsetCount", + type: { + name: "Composite", + className: "ResourceCounter" + } } } } @@ -2113,6 +2163,142 @@ export const TagScoringParameters: coreHttp.CompositeMapper = { } }; +export const CustomEntity: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CustomEntity", + modelProperties: { + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + }, + description: { + serializedName: "description", + nullable: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + nullable: true, + type: { + name: "String" + } + }, + subtype: { + serializedName: "subtype", + nullable: true, + type: { + name: "String" + } + }, + id: { + serializedName: "id", + nullable: true, + type: { + name: "String" + } + }, + caseSensitive: { + serializedName: "caseSensitive", + nullable: true, + type: { + name: "Boolean" + } + }, + accentSensitive: { + serializedName: "accentSensitive", + nullable: true, + type: { + name: "Boolean" + } + }, + fuzzyEditDistance: { + serializedName: "fuzzyEditDistance", + nullable: true, + type: { + name: "Number" + } + }, + defaultCaseSensitive: { + serializedName: "defaultCaseSensitive", + nullable: true, + type: { + name: "Boolean" + } + }, + defaultAccentSensitive: { + serializedName: "defaultAccentSensitive", + nullable: true, + type: { + name: "Boolean" + } + }, + defaultFuzzyEditDistance: { + serializedName: "defaultFuzzyEditDistance", + nullable: true, + type: { + name: "Number" + } + }, + aliases: { + serializedName: "aliases", + nullable: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CustomEntityAlias" + } + } + } + } + } + } +}; + +export const CustomEntityAlias: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CustomEntityAlias", + modelProperties: { + text: { + serializedName: "text", + required: true, + type: { + name: "String" + } + }, + caseSensitive: { + serializedName: "caseSensitive", + nullable: true, + type: { + name: "Boolean" + } + }, + accentSensitive: { + serializedName: "accentSensitive", + nullable: true, + type: { + name: "Boolean" + } + }, + fuzzyEditDistance: { + serializedName: "fuzzyEditDistance", + nullable: true, + type: { + name: "Number" + } + } + } + } +}; + export const HighWaterMarkChangeDetectionPolicy: coreHttp.CompositeMapper = { serializedName: "#Microsoft.Azure.Search.HighWaterMarkChangeDetectionPolicy", type: { @@ -2209,6 +2395,13 @@ export const KeyPhraseExtractionSkill: coreHttp.CompositeMapper = { type: { name: "Number" } + }, + modelVersion: { + serializedName: "modelVersion", + nullable: true, + type: { + name: "String" + } } } } @@ -2288,7 +2481,21 @@ export const LanguageDetectionSkill: coreHttp.CompositeMapper = { uberParent: "SearchIndexerSkill", polymorphicDiscriminator: SearchIndexerSkill.type.polymorphicDiscriminator, modelProperties: { - ...SearchIndexerSkill.type.modelProperties + ...SearchIndexerSkill.type.modelProperties, + defaultCountryHint: { + serializedName: "defaultCountryHint", + nullable: true, + type: { + name: "String" + } + }, + modelVersion: { + serializedName: "modelVersion", + nullable: true, + type: { + name: "String" + } + } } } }; @@ -2428,6 +2635,67 @@ export const SplitSkill: coreHttp.CompositeMapper = { } }; +export const CustomEntityLookupSkill: coreHttp.CompositeMapper = { + serializedName: "#Microsoft.Skills.Text.CustomEntityLookupSkill", + type: { + name: "Composite", + className: "CustomEntityLookupSkill", + uberParent: "SearchIndexerSkill", + polymorphicDiscriminator: SearchIndexerSkill.type.polymorphicDiscriminator, + modelProperties: { + ...SearchIndexerSkill.type.modelProperties, + defaultLanguageCode: { + serializedName: "defaultLanguageCode", + nullable: true, + type: { + name: "String" + } + }, + entitiesDefinitionUri: { + serializedName: "entitiesDefinitionUri", + nullable: true, + type: { + name: "String" + } + }, + inlineEntitiesDefinition: { + serializedName: "inlineEntitiesDefinition", + nullable: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CustomEntity" + } + } + } + }, + globalDefaultCaseSensitive: { + serializedName: "globalDefaultCaseSensitive", + nullable: true, + type: { + name: "Boolean" + } + }, + globalDefaultAccentSensitive: { + serializedName: "globalDefaultAccentSensitive", + nullable: true, + type: { + name: "Boolean" + } + }, + globalDefaultFuzzyEditDistance: { + serializedName: "globalDefaultFuzzyEditDistance", + nullable: true, + type: { + name: "Number" + } + } + } + } +}; + export const TextTranslationSkill: coreHttp.CompositeMapper = { serializedName: "#Microsoft.Skills.Text.TranslationSkill", type: { @@ -2461,6 +2729,41 @@ export const TextTranslationSkill: coreHttp.CompositeMapper = { } }; +export const DocumentExtractionSkill: coreHttp.CompositeMapper = { + serializedName: "#Microsoft.Skills.Util.DocumentExtractionSkill", + type: { + name: "Composite", + className: "DocumentExtractionSkill", + uberParent: "SearchIndexerSkill", + polymorphicDiscriminator: SearchIndexerSkill.type.polymorphicDiscriminator, + modelProperties: { + ...SearchIndexerSkill.type.modelProperties, + parsingMode: { + serializedName: "parsingMode", + nullable: true, + type: { + name: "String" + } + }, + dataToExtract: { + serializedName: "dataToExtract", + nullable: true, + type: { + name: "String" + } + }, + configuration: { + serializedName: "configuration", + nullable: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + export const WebApiSkill: coreHttp.CompositeMapper = { serializedName: "#Microsoft.Skills.Custom.WebApiSkill", type: { @@ -4270,6 +4573,39 @@ export const PatternReplaceCharFilter: coreHttp.CompositeMapper = { } }; +export const CustomNormalizer: coreHttp.CompositeMapper = { + serializedName: "#Microsoft.Azure.Search.CustomNormalizer", + type: { + name: "Composite", + className: "CustomNormalizer", + modelProperties: { + ...LexicalNormalizer.type.modelProperties, + tokenFilters: { + serializedName: "tokenFilters", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + charFilters: { + serializedName: "charFilters", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + export const ClassicSimilarity: coreHttp.CompositeMapper = { serializedName: "#Microsoft.Azure.Search.ClassicSimilarity", type: { @@ -4334,7 +4670,9 @@ export let discriminators = { "SearchIndexerSkill.#Microsoft.Skills.Text.EntityRecognitionSkill": EntityRecognitionSkill, "SearchIndexerSkill.#Microsoft.Skills.Text.SentimentSkill": SentimentSkill, "SearchIndexerSkill.#Microsoft.Skills.Text.SplitSkill": SplitSkill, + "SearchIndexerSkill.#Microsoft.Skills.Text.CustomEntityLookupSkill": CustomEntityLookupSkill, "SearchIndexerSkill.#Microsoft.Skills.Text.TranslationSkill": TextTranslationSkill, + "SearchIndexerSkill.#Microsoft.Skills.Util.DocumentExtractionSkill": DocumentExtractionSkill, "SearchIndexerSkill.#Microsoft.Skills.Custom.WebApiSkill": WebApiSkill, "CognitiveServicesAccount.#Microsoft.Azure.Search.DefaultCognitiveServices": DefaultCognitiveServicesAccount, "CognitiveServicesAccount.#Microsoft.Azure.Search.CognitiveServicesByKey": CognitiveServicesAccountKey, diff --git a/sdk/search/search-documents/src/generated/service/searchServiceClient.ts b/sdk/search/search-documents/src/generated/service/searchServiceClient.ts index 32bf288d0415..a035214ed8e2 100644 --- a/sdk/search/search-documents/src/generated/service/searchServiceClient.ts +++ b/sdk/search/search-documents/src/generated/service/searchServiceClient.ts @@ -19,7 +19,7 @@ import * as Mappers from "./models/mappers"; import { SearchServiceClientContext } from "./searchServiceClientContext"; import { SearchServiceClientOptionalParams, - ApiVersion20200630, + ApiVersion20200630Preview, SearchServiceClientGetServiceStatisticsOptionalParams, SearchServiceClientGetServiceStatisticsResponse } from "./models"; @@ -34,7 +34,7 @@ export class SearchServiceClient extends SearchServiceClientContext { */ constructor( endpoint: string, - apiVersion: ApiVersion20200630, + apiVersion: ApiVersion20200630Preview, options?: SearchServiceClientOptionalParams ) { super(endpoint, apiVersion, options); diff --git a/sdk/search/search-documents/src/generated/service/searchServiceClientContext.ts b/sdk/search/search-documents/src/generated/service/searchServiceClientContext.ts index 13806bd4afcf..792fc7ebd7ad 100644 --- a/sdk/search/search-documents/src/generated/service/searchServiceClientContext.ts +++ b/sdk/search/search-documents/src/generated/service/searchServiceClientContext.ts @@ -8,17 +8,17 @@ import * as coreHttp from "@azure/core-http"; import { - ApiVersion20200630, + ApiVersion20200630Preview, SearchServiceClientOptionalParams } from "./models"; const packageName = "@azure/search-documents"; -const packageVersion = "11.1.1"; +const packageVersion = "11.2.0-beta.1"; /** @internal */ export class SearchServiceClientContext extends coreHttp.ServiceClient { endpoint: string; - apiVersion: ApiVersion20200630; + apiVersion: ApiVersion20200630Preview; /** * Initializes a new instance of the SearchServiceClientContext class. @@ -28,7 +28,7 @@ export class SearchServiceClientContext extends coreHttp.ServiceClient { */ constructor( endpoint: string, - apiVersion: ApiVersion20200630, + apiVersion: ApiVersion20200630Preview, options?: SearchServiceClientOptionalParams ) { if (endpoint === undefined) { diff --git a/sdk/search/search-documents/src/index.ts b/sdk/search/search-documents/src/index.ts index d85a55ac74c5..a4a4ec1bc9de 100644 --- a/sdk/search/search-documents/src/index.ts +++ b/sdk/search/search-documents/src/index.ts @@ -196,6 +196,12 @@ export { MergeSkill, EntityRecognitionSkill, SentimentSkill, + CustomEntityLookupSkill, + CustomEntityLookupSkillLanguage, + KnownCustomEntityLookupSkillLanguage, + DocumentExtractionSkill, + CustomEntity, + CustomEntityAlias, SplitSkill, TextTranslationSkill, WebApiSkill, @@ -268,6 +274,14 @@ export { DataChangeDetectionPolicy as BaseDataChangeDetectionPolicy, LexicalAnalyzer as BaseLexicalAnalyzer, CharFilter as BaseCharFilter, - DataDeletionDetectionPolicy as BaseDataDeletionDetectionPolicy + DataDeletionDetectionPolicy as BaseDataDeletionDetectionPolicy, + LexicalNormalizer, + LexicalNormalizerName, + KnownLexicalNormalizerName, + CustomNormalizer, + TokenFilterName, + KnownTokenFilterName, + CharFilterName, + KnownCharFilterName } from "./generated/service/models"; export { AzureKeyCredential } from "@azure/core-auth"; diff --git a/sdk/search/search-documents/src/indexModels.ts b/sdk/search/search-documents/src/indexModels.ts index 2df76235b9b0..cb42989e0d75 100644 --- a/sdk/search/search-documents/src/indexModels.ts +++ b/sdk/search/search-documents/src/indexModels.ts @@ -398,7 +398,7 @@ export type SearchResult = { * applicable field; null if hit highlighting was not enabled for the query. * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - readonly highlights?: { [propertyName: string]: string[] }; + readonly highlights?: { [k in keyof T]?: string[] }; document: T; }; diff --git a/sdk/search/search-documents/src/serviceModels.ts b/sdk/search/search-documents/src/serviceModels.ts index ce1844f0072a..b407ab71a51b 100644 --- a/sdk/search/search-documents/src/serviceModels.ts +++ b/sdk/search/search-documents/src/serviceModels.ts @@ -54,6 +54,8 @@ import { EntityRecognitionSkill, SentimentSkill, SplitSkill, + CustomEntityLookupSkill, + DocumentExtractionSkill, TextTranslationSkill, WebApiSkill, DefaultCognitiveServicesAccount, @@ -71,7 +73,9 @@ import { ServiceLimits, FieldMapping, IndexingParameters, - IndexingSchedule + IndexingSchedule, + LexicalNormalizer, + LexicalNormalizerName } from "./generated/service/models"; import { PagedAsyncIterableIterator } from "@azure/core-paging"; @@ -453,7 +457,9 @@ export type SearchIndexerSkill = | EntityRecognitionSkill | SentimentSkill | SplitSkill + | CustomEntityLookupSkill | TextTranslationSkill + | DocumentExtractionSkill | WebApiSkill; /** @@ -801,6 +807,10 @@ export interface SimpleField { * fields. */ synonymMapNames?: string[]; + /** + * The name of the normalizer used at indexing time for the field. + */ + normalizerName?: LexicalNormalizerName; } export function isComplexField(field: SearchField): field is ComplexField { @@ -920,6 +930,10 @@ export interface SearchIndex { * The character filters for the index. */ charFilters?: CharFilter[]; + /** + * The normalizers for the index. + */ + normalizers?: LexicalNormalizer[]; /** * 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 @@ -1772,7 +1786,7 @@ export interface SearchIndexerDataSourceConnection { description?: string; /** * The type of the datasource. Possible values include: 'AzureSql', 'CosmosDb', 'AzureBlob', - * 'AzureTable', 'MySql' + * 'AzureTable', 'MySql', 'AdlsGen2' */ type: SearchIndexerDataSourceType; /** diff --git a/sdk/search/search-documents/src/serviceUtils.ts b/sdk/search/search-documents/src/serviceUtils.ts index 245c4f20e06c..53a90235358a 100644 --- a/sdk/search/search-documents/src/serviceUtils.ts +++ b/sdk/search/search-documents/src/serviceUtils.ts @@ -36,6 +36,8 @@ import { MergeSkill, EntityRecognitionSkill, SentimentSkill, + DocumentExtractionSkill, + CustomEntityLookupSkill, SplitSkill, TextTranslationSkill, WebApiSkill, @@ -43,7 +45,9 @@ import { StopAnalyzer, PatternAnalyzer as GeneratedPatternAnalyzer, CustomAnalyzer, - PatternTokenizer + PatternTokenizer, + LexicalNormalizer, + LexicalNormalizerName } from "./generated/service/models"; import { LexicalAnalyzer, @@ -118,6 +122,12 @@ export function convertSkillsToPublic(skills: SearchIndexerSkillUnion[]): Search case "#Microsoft.Skills.Custom.WebApiSkill": result.push(skill as WebApiSkill); break; + case "#Microsoft.Skills.Text.CustomEntityLookupSkill": + result.push(skill as CustomEntityLookupSkill); + break; + case "#Microsoft.Skills.Util.DocumentExtractionSkill": + result.push(skill as DocumentExtractionSkill); + break; } } return result; @@ -242,6 +252,7 @@ export function convertFieldsToPublic(fields: GeneratedSearchField[]): SearchFie const searchAnalyzerName: LexicalAnalyzerName | undefined | null = field.searchAnalyzer; const indexAnalyzerName: LexicalAnalyzerName | undefined | null = field.indexAnalyzer; const synonymMapNames: string[] | undefined = field.synonymMaps; + const normalizerNames: LexicalNormalizerName | undefined | null = field.normalizer; const { retrievable, ...restField } = field; const hidden = typeof retrievable === "boolean" ? !retrievable : retrievable; @@ -252,7 +263,8 @@ export function convertFieldsToPublic(fields: GeneratedSearchField[]): SearchFie anayzerName, searchAnalyzerName, indexAnalyzerName, - synonymMapNames + synonymMapNames, + normalizerNames } as SimpleField; } return result; @@ -277,7 +289,8 @@ export function convertFieldsToGenerated(fields: SearchField[]): GeneratedSearch analyzer: field.analyzerName, searchAnalyzer: field.searchAnalyzerName, indexAnalyzer: field.indexAnalyzerName, - synonymMaps: field.synonymMapNames + synonymMaps: field.synonymMapNames, + normalizer: field.normalizerName }; } }); @@ -425,6 +438,7 @@ export function generatedIndexToPublicIndex(generatedIndex: GeneratedSearchIndex tokenizers: convertTokenizersToPublic(generatedIndex.tokenizers), tokenFilters: generatedIndex.tokenFilters as TokenFilter[], charFilters: generatedIndex.charFilters as CharFilter[], + normalizers: generatedIndex.normalizers as LexicalNormalizer[], scoringProfiles: generatedIndex.scoringProfiles as ScoringProfile[], fields: convertFieldsToPublic(generatedIndex.fields), similarity: convertSimilarityToPublic(generatedIndex.similarity) @@ -485,6 +499,7 @@ export function publicIndexToGeneratedIndex(index: SearchIndex): GeneratedSearch etag: index.etag, tokenFilters: convertTokenFiltersToGenerated(index.tokenFilters), charFilters: index.charFilters, + normalizers: index.normalizers, scoringProfiles: index.scoringProfiles, analyzers: convertAnalyzersToGenerated(index.analyzers), tokenizers: convertTokenizersToGenerated(index.tokenizers), diff --git a/sdk/search/search-documents/swagger/Data.md b/sdk/search/search-documents/swagger/Data.md index 6bfdc88a2b10..95efadfc5454 100644 --- a/sdk/search/search-documents/swagger/Data.md +++ b/sdk/search/search-documents/swagger/Data.md @@ -10,7 +10,7 @@ generate-metadata: false license-header: MICROSOFT_MIT_NO_VERSION output-folder: ../ source-code-folder-path: ./src/generated/data -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/55c3979124d193ab8cd4c5409a3e9f67739ca571/specification/search/data-plane/Azure.Search/preview/2020-06-30/searchindex.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/e6fa7db931a3e5182e5685630971b64987719938/specification/search/data-plane/Azure.Search/preview/2020-06-30-Preview/searchindex.json add-credentials: false title: SearchClient use-extension: diff --git a/sdk/search/search-documents/swagger/Service.md b/sdk/search/search-documents/swagger/Service.md index a3d06c10e591..958fa88b89c1 100644 --- a/sdk/search/search-documents/swagger/Service.md +++ b/sdk/search/search-documents/swagger/Service.md @@ -10,7 +10,7 @@ generate-metadata: false license-header: MICROSOFT_MIT_NO_VERSION output-folder: ../ source-code-folder-path: ./src/generated/service -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/55c3979124d193ab8cd4c5409a3e9f67739ca571/specification/search/data-plane/Azure.Search/preview/2020-06-30/searchservice.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/e6fa7db931a3e5182e5685630971b64987719938/specification/search/data-plane/Azure.Search/preview/2020-06-30-Preview/searchservice.json add-credentials: false use-extension: "@autorest/typescript": "6.0.0-dev.20210121.1" diff --git a/sdk/search/search-documents/test/public/node/searchIndexerClient.spec.ts b/sdk/search/search-documents/test/public/node/searchIndexerClient.spec.ts deleted file mode 100644 index 43ed66a4f67e..000000000000 --- a/sdk/search/search-documents/test/public/node/searchIndexerClient.spec.ts +++ /dev/null @@ -1,231 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { isPlaybackMode, record, Recorder, isLiveMode } from "@azure/test-utils-recorder"; -import { Context } from "mocha"; -import { Suite } from "mocha"; -import { assert } from "chai"; -import { - SearchIndexClient, - SearchIndexerClient, - SearchIndexerSkillset, - SearchIndexer -} from "../../../src"; -import { Hotel } from "../utils/interfaces"; -import { createClients, environmentSetup } from "../utils/recordedClient"; -import { - createIndex, - deleteDataSourceConnections, - createSkillsets, - deleteSkillsets, - createIndexers, - deleteIndexers, - WAIT_TIME, - createRandomIndexName -} from "../utils/setup"; -import { delay } from "@azure/core-http"; - -const TEST_INDEX_NAME = isLiveMode() ? createRandomIndexName() : "hotel-live-test2"; - -describe("SearchIndexerClient", function(this: Suite) { - let recorder: Recorder; - let indexerClient: SearchIndexerClient; - let indexClient: SearchIndexClient; - - this.timeout(99999); - - beforeEach(async function(this: Context) { - ({ indexClient, indexerClient } = createClients(TEST_INDEX_NAME)); - if (!isPlaybackMode()) { - await createSkillsets(indexerClient); - await createIndex(indexClient, TEST_INDEX_NAME); - await delay(5000); - await createIndexers(indexerClient, TEST_INDEX_NAME); - } - recorder = record(this, environmentSetup); - // create the clients again, but hooked up to the recorder - ({ indexClient, indexerClient } = createClients(TEST_INDEX_NAME)); - }); - - afterEach(async function() { - if (recorder) { - await recorder.stop(); - } - if (!isPlaybackMode()) { - await indexClient.deleteIndex(TEST_INDEX_NAME); - await delay(WAIT_TIME); - await deleteDataSourceConnections(indexerClient); - await deleteSkillsets(indexerClient); - await deleteIndexers(indexerClient); - } - }); - - describe("#indexers", function() { - it("gets the list of indexers", async function() { - const indexers = await indexerClient.listIndexers(); - assert.equal(indexers.length, 2); - }); - - it("gets the list of indexer names", async function() { - const indexers = await indexerClient.listIndexersNames(); - assert.equal(indexers.length, 2); - for (let i = 1; i <= 2; i++) { - assert.include(indexers, `my-azure-indexer-${i}`); - } - }); - - it("gets the correct indexer object", async function() { - const indexer = await indexerClient.getIndexer("my-azure-indexer-1"); - assert.equal(indexer.name, "my-azure-indexer-1"); - assert.equal(indexer.dataSourceName, "my-data-source-1"); - assert.equal(indexer.targetIndexName, TEST_INDEX_NAME); - assert.isFalse(indexer.isDisabled); - }); - - it("throws error for invalid indexer object", async function() { - let retrievalError: boolean = false; - try { - await indexerClient.getIndexer("garbxyz"); - } catch (ex) { - retrievalError = true; - } - assert.isTrue(retrievalError); - }); - - it("creates the indexer object using createOrUpdateIndexer", async function() { - let indexer: SearchIndexer = { - name: "my-azure-indexer-3", - description: "Description for Sample Indexer", - dataSourceName: "my-data-source-1", - targetIndexName: TEST_INDEX_NAME, - isDisabled: false - }; - await indexerClient.createOrUpdateIndexer(indexer); - try { - indexer = await indexerClient.getIndexer("my-azure-indexer-3"); - assert.equal(indexer.name, "my-azure-indexer-3"); - assert.equal(indexer.dataSourceName, "my-data-source-1"); - assert.equal(indexer.targetIndexName, TEST_INDEX_NAME); - assert.isFalse(indexer.isDisabled); - } finally { - await indexerClient.deleteIndexer(indexer); - } - }); - - it("modify and updates the indexer object", async function() { - let indexer = await indexerClient.getIndexer("my-azure-indexer-1"); - indexer.isDisabled = true; - await indexerClient.createOrUpdateIndexer(indexer); - indexer = await indexerClient.getIndexer("my-azure-indexer-1"); - assert.isTrue(indexer.isDisabled); - }); - - it("gets the status of the indexer", async function() { - const indexerStatus = await indexerClient.getIndexerStatus("my-azure-indexer-1"); - const statuses: string[] = ["unknown", "error", "running"]; - assert.include(statuses, indexerStatus.status); - }); - }); - - describe("#datasourceconnections", function() { - it("throws error for invalid datasourceconnection object", async function() { - let retrievalError: boolean = false; - try { - await indexerClient.getDataSourceConnection("garbxyz"); - } catch (ex) { - retrievalError = true; - } - assert.isTrue(retrievalError); - }); - }); - - describe("#skillsets", function() { - it("gets the list of skillsets", async function() { - const skillsets = await indexerClient.listSkillsets(); - assert.equal(skillsets.length, 2); - }); - - it("gets the list of skillset names", async function() { - const skillsets = await indexerClient.listSkillsetsNames(); - assert.equal(skillsets.length, 2); - for (let i = 1; i <= 2; i++) { - assert.include(skillsets, `my-azureblob-skillset-${i}`); - } - }); - - it("gets the correct skillset object", async function() { - const skillSet = await indexerClient.getSkillset("my-azureblob-skillset-1"); - assert.equal(skillSet.name, "my-azureblob-skillset-1"); - assert.equal(skillSet.skills.length, 1); - assert.equal(skillSet.skills[0].inputs.length, 2); - assert.equal(skillSet.skills[0].outputs.length, 2); - }); - - it("throws error for invalid skillset object", async function() { - let retrievalError: boolean = false; - try { - await indexerClient.getSkillset("garbxyz"); - } catch (ex) { - retrievalError = true; - } - assert.isTrue(retrievalError); - }); - - it("creates the skillset object using createOrUpdateSkillset", async function() { - let skillSet: SearchIndexerSkillset = { - name: `my-azureblob-skillset-3`, - description: `Skillset description`, - skills: [ - { - odatatype: "#Microsoft.Skills.Text.EntityRecognitionSkill", - inputs: [ - { - name: "text", - source: "/document/merged_content" - }, - { - name: "languageCode", - source: "/document/language" - } - ], - outputs: [ - { - name: "persons", - targetName: "people" - }, - { - name: "organizations", - targetName: "organizations" - }, - { - name: "locations", - targetName: "locations" - } - ] - } - ] - }; - await indexerClient.createOrUpdateSkillset(skillSet); - try { - skillSet = await indexerClient.getSkillset("my-azureblob-skillset-3"); - assert.equal(skillSet.name, "my-azureblob-skillset-3"); - assert.equal(skillSet.skills.length, 1); - assert.equal(skillSet.skills[0].inputs.length, 2); - assert.equal(skillSet.skills[0].outputs.length, 3); - } finally { - await indexerClient.deleteSkillset(skillSet); - } - }); - - it("modify and updates the skillsets object", async function() { - let skillSet = await indexerClient.getSkillset("my-azureblob-skillset-2"); - skillSet.skills[0].outputs.push({ - name: "organizations", - targetName: "organizations" - }); - await indexerClient.createOrUpdateSkillset(skillSet); - skillSet = await indexerClient.getSkillset("my-azureblob-skillset-2"); - assert.equal(skillSet.skills[0].outputs.length, 3); - }); - }); -});