From ef70ff9b3fa346f6a2b812b32a7bc4337a841475 Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Fri, 20 Mar 2020 18:14:28 -0700 Subject: [PATCH] Initial SearchIndex creation model changes Also prototypes SynonymMap changes discussed in #10725 --- .../Azure.Search.Documents/CHANGELOG.md | 6 + .../Azure.Search.Documents.netstandard2.0.cs | 72 ++- .../samples/Sample01b_HelloWorldAsync.md | 2 +- .../samples/Sample02_Service.md | 2 +- .../src/Generated/Models/Analyzer.cs | 2 +- .../src/Generated/Models/AnalyzerName.cs | 198 +++---- .../src/Generated/Models/CharFilter.cs | 2 +- .../Models/CognitiveServicesAccount.cs | 2 +- .../Models/DataChangeDetectionPolicy.cs | 2 +- .../Models/DataDeletionDetectionPolicy.cs | 2 +- .../src/Generated/Models/DataType.cs | 32 +- .../src/Generated/Models/ScoringFunction.cs | 2 +- .../Models/SearchField.Serialization.cs | 4 +- .../src/Generated/Models/SearchField.cs | 39 +- .../src/Generated/Models/SearchIndex.cs | 24 - .../src/Generated/Models/Skill.cs | 2 +- .../src/Generated/Models/SynonymMap.cs | 27 - .../src/Generated/Models/TokenFilter.cs | 2 +- .../src/Generated/Models/Tokenizer.cs | 2 +- .../src/Models/ComplexField.cs | 58 ++ .../src/Models/DataType.cs | 52 ++ .../src/Models/FieldBase.cs | 62 +++ .../src/Models/SearchField.cs | 53 ++ .../src/Models/SearchIndex.cs | 61 ++ .../src/Models/SearchableField.cs | 70 +++ .../src/Models/SimpleField.cs | 72 +++ .../src/Models/SynonymMap.cs | 78 +++ .../src/SearchServiceClient.cs | 151 +++-- .../src/swagger/searchservice.json | 526 +++++++++++++++++- .../tests/Samples/HelloWorld.cs | 6 +- .../tests/SearchServiceClientTests.cs | 16 +- 31 files changed, 1337 insertions(+), 292 deletions(-) create mode 100644 sdk/search/Azure.Search.Documents/src/Models/ComplexField.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Models/DataType.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Models/FieldBase.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Models/SearchableField.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Models/SimpleField.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Models/SynonymMap.cs diff --git a/sdk/search/Azure.Search.Documents/CHANGELOG.md b/sdk/search/Azure.Search.Documents/CHANGELOG.md index 04d94e008b9a3..7dc0c233848bb 100644 --- a/sdk/search/Azure.Search.Documents/CHANGELOG.md +++ b/sdk/search/Azure.Search.Documents/CHANGELOG.md @@ -2,9 +2,15 @@ ## 1.0.0-preview.2 (Unreleased) +### Added + +- Added models and methods to `SearchServiceClient` to create and manage indexes. + ### Breaking Changes + - Renamed to Azure.Search.Documents (assembly, namespace, and package) - Replaced SearchApiKeyCredential with AzureKeyCredential +- Renamed `SearchServiceClient.GetStatistics` and `SearchServiceClient.GetStatisticsAsync` to `SearchServiceClient.GetServiceStatistics` and `SearchServiceClient.GetServiceStatisticsAsync` ## 11.0.0-preview.1 (2020-03-13) diff --git a/sdk/search/Azure.Search.Documents/api/Azure.Search.Documents.netstandard2.0.cs b/sdk/search/Azure.Search.Documents/api/Azure.Search.Documents.netstandard2.0.cs index d77387f45181e..afc4f6483cd8c 100644 --- a/sdk/search/Azure.Search.Documents/api/Azure.Search.Documents.netstandard2.0.cs +++ b/sdk/search/Azure.Search.Documents/api/Azure.Search.Documents.netstandard2.0.cs @@ -97,9 +97,11 @@ public SearchServiceClient(System.Uri endpoint, Azure.AzureKeyCredential credent public SearchServiceClient(System.Uri endpoint, Azure.AzureKeyCredential credential, Azure.Search.Documents.SearchClientOptions options) { } public virtual System.Uri Endpoint { get { throw null; } } public virtual string ServiceName { get { throw null; } } + public virtual Azure.Response CreateIndex(Azure.Search.Documents.Models.SearchIndex index, Azure.Search.Documents.SearchRequestOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateIndexAsync(Azure.Search.Documents.Models.SearchIndex index, Azure.Search.Documents.SearchRequestOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Search.Documents.SearchIndexClient GetSearchIndexClient(string indexName) { throw null; } - public virtual Azure.Response GetStatistics(Azure.Search.Documents.SearchRequestOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetStatisticsAsync(Azure.Search.Documents.SearchRequestOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetServiceStatistics(Azure.Search.Documents.SearchRequestOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetServiceStatisticsAsync(Azure.Search.Documents.SearchRequestOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class SuggestOptions : Azure.Search.Documents.SearchRequestOptions { @@ -203,8 +205,8 @@ internal AnalyzeResult() { } public static Azure.Search.Documents.Models.AnalyzerName Pattern { get { throw null; } } public static Azure.Search.Documents.Models.AnalyzerName PlLucene { get { throw null; } } public static Azure.Search.Documents.Models.AnalyzerName PlMicrosoft { get { throw null; } } - public static Azure.Search.Documents.Models.AnalyzerName PtBRLucene { get { throw null; } } - public static Azure.Search.Documents.Models.AnalyzerName PtBRMicrosoft { get { throw null; } } + public static Azure.Search.Documents.Models.AnalyzerName PtBrLucene { get { throw null; } } + public static Azure.Search.Documents.Models.AnalyzerName PtBrMicrosoft { get { throw null; } } public static Azure.Search.Documents.Models.AnalyzerName PtLucene { get { throw null; } } public static Azure.Search.Documents.Models.AnalyzerName PtMicrosoft { get { throw null; } } public static Azure.Search.Documents.Models.AnalyzerName RoLucene { get { throw null; } } @@ -216,7 +218,7 @@ internal AnalyzeResult() { } public static Azure.Search.Documents.Models.AnalyzerName SlMicrosoft { get { throw null; } } public static Azure.Search.Documents.Models.AnalyzerName SrCyrillicMicrosoft { get { throw null; } } public static Azure.Search.Documents.Models.AnalyzerName SrLatinMicrosoft { get { throw null; } } - public static Azure.Search.Documents.Models.AnalyzerName StandardasciifoldingLucene { get { throw null; } } + public static Azure.Search.Documents.Models.AnalyzerName StandardAsciiFoldingLucene { get { throw null; } } public static Azure.Search.Documents.Models.AnalyzerName StandardLucene { get { throw null; } } public static Azure.Search.Documents.Models.AnalyzerName Stop { get { throw null; } } public static Azure.Search.Documents.Models.AnalyzerName SvLucene { get { throw null; } } @@ -314,6 +316,15 @@ public CommonGramTokenFilter(System.Collections.Generic.IEnumerable comm public bool? IgnoreCase { get { throw null; } set { } } public bool? UseQueryMode { get { throw null; } set { } } } + public partial class ComplexField : Azure.Search.Documents.Models.FieldBase, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + public ComplexField(string name, bool collection = false) : base (default(string), default(Azure.Search.Documents.Models.DataType)) { } + public System.Collections.Generic.IList Fields { get { throw null; } } + public void Add(Azure.Search.Documents.Models.FieldBase field) { } + protected override void Save(Azure.Search.Documents.Models.SearchField field) { } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } public partial class ConditionalSkill : Azure.Search.Documents.Models.Skill { public ConditionalSkill(System.Collections.Generic.IEnumerable inputs, System.Collections.Generic.IEnumerable outputs) : base (default(System.Collections.Generic.IEnumerable), default(System.Collections.Generic.IEnumerable)) { } @@ -389,14 +400,15 @@ public DataSourceCredentials() { } private readonly object _dummy; private readonly int _dummyPrimitive; public DataType(string value) { throw null; } - public static Azure.Search.Documents.Models.DataType EdmBoolean { get { throw null; } } - public static Azure.Search.Documents.Models.DataType EdmComplexType { get { throw null; } } - public static Azure.Search.Documents.Models.DataType EdmDateTimeOffset { get { throw null; } } - public static Azure.Search.Documents.Models.DataType EdmDouble { get { throw null; } } - public static Azure.Search.Documents.Models.DataType EdmGeographyPoint { get { throw null; } } - public static Azure.Search.Documents.Models.DataType EdmInt32 { get { throw null; } } - public static Azure.Search.Documents.Models.DataType EdmInt64 { get { throw null; } } - public static Azure.Search.Documents.Models.DataType EdmString { get { throw null; } } + public static Azure.Search.Documents.Models.DataType Boolean { get { throw null; } } + public static Azure.Search.Documents.Models.DataType Complex { get { throw null; } } + public static Azure.Search.Documents.Models.DataType DateTimeOffset { get { throw null; } } + public static Azure.Search.Documents.Models.DataType Double { get { throw null; } } + public static Azure.Search.Documents.Models.DataType GeographyPoint { get { throw null; } } + public static Azure.Search.Documents.Models.DataType Int32 { get { throw null; } } + public static Azure.Search.Documents.Models.DataType Int64 { get { throw null; } } + public static Azure.Search.Documents.Models.DataType String { get { throw null; } } + public static Azure.Search.Documents.Models.DataType Collection(Azure.Search.Documents.Models.DataType type) { throw null; } public bool Equals(Azure.Search.Documents.Models.DataType other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } @@ -540,6 +552,14 @@ internal FacetResult() { } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } public bool TryGetValue(string key, out object value) { throw null; } } + public abstract partial class FieldBase + { + public FieldBase(string name, Azure.Search.Documents.Models.DataType type) { } + public string Name { get { throw null; } } + public Azure.Search.Documents.Models.DataType Type { get { throw null; } } + public static implicit operator Azure.Search.Documents.Models.SearchField (Azure.Search.Documents.Models.FieldBase value) { throw null; } + protected abstract void Save(Azure.Search.Documents.Models.SearchField field); + } public partial class FieldMapping { public FieldMapping(string sourceFieldName) { } @@ -1147,6 +1167,15 @@ public ScoringProfile(string name) { } public string Name { get { throw null; } } public Azure.Search.Documents.Models.TextWeights TextWeights { get { throw null; } set { } } } + public partial class SearchableField : Azure.Search.Documents.Models.SimpleField + { + public SearchableField(string name, bool collection = false) : base (default(string), default(Azure.Search.Documents.Models.DataType)) { } + public Azure.Search.Documents.Models.AnalyzerName? Analyzer { get { throw null; } set { } } + public Azure.Search.Documents.Models.AnalyzerName? IndexAnalyzer { get { throw null; } set { } } + public Azure.Search.Documents.Models.AnalyzerName? SearchAnalyzer { get { throw null; } set { } } + public System.Collections.Generic.IList SynonymMaps { get { throw null; } } + protected override void Save(Azure.Search.Documents.Models.SearchField field) { } + } public partial class SearchDocument : System.Dynamic.DynamicObject, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable { public SearchDocument() { } @@ -1179,17 +1208,19 @@ public SearchField(string name, Azure.Search.Documents.Models.DataType type) { } public System.Collections.Generic.IList Fields { get { throw null; } set { } } public bool? Filterable { get { throw null; } set { } } public Azure.Search.Documents.Models.AnalyzerName? IndexAnalyzer { get { throw null; } set { } } + public bool? IsHidden { get { throw null; } set { } } public bool? Key { get { throw null; } set { } } public string Name { get { throw null; } } - public bool? Retrievable { get { throw null; } set { } } public bool? Searchable { get { throw null; } set { } } public Azure.Search.Documents.Models.AnalyzerName? SearchAnalyzer { get { throw null; } set { } } public bool? Sortable { get { throw null; } set { } } public System.Collections.Generic.IList SynonymMaps { get { throw null; } set { } } public Azure.Search.Documents.Models.DataType Type { get { throw null; } } + public override string ToString() { throw null; } } public partial class SearchIndex { + public SearchIndex(string name) { } public SearchIndex(string name, System.Collections.Generic.IEnumerable fields) { } public System.Collections.Generic.IList Analyzers { get { throw null; } set { } } public System.Collections.Generic.IList CharFilters { get { throw null; } set { } } @@ -1343,6 +1374,16 @@ public ShingleTokenFilter(string name) : base (default(string)) { } public bool? OutputUnigramsIfNoShingles { get { throw null; } set { } } public string TokenSeparator { get { throw null; } set { } } } + public partial class SimpleField : Azure.Search.Documents.Models.FieldBase + { + public SimpleField(string name, Azure.Search.Documents.Models.DataType type) : base (default(string), default(Azure.Search.Documents.Models.DataType)) { } + public bool IsFacetable { get { throw null; } set { } } + public bool IsFilterable { get { throw null; } set { } } + public bool IsHidden { get { throw null; } set { } } + public bool IsKey { get { throw null; } set { } } + public bool IsSortable { get { throw null; } set { } } + protected override void Save(Azure.Search.Documents.Models.SearchField field) { } + } public partial class Skill { public Skill(System.Collections.Generic.IEnumerable inputs, System.Collections.Generic.IEnumerable outputs) { } @@ -1578,7 +1619,8 @@ internal SuggestResults() { } } public partial class SynonymMap { - public SynonymMap(string name, string synonyms) { } + public SynonymMap(string name, System.Collections.Generic.IEnumerable synonyms, string format = "soln") { } + public SynonymMap(string name, string synonym, string format = "soln") { } public Azure.Search.Documents.Models.EncryptionKey EncryptionKey { get { throw null; } set { } } public string ETag { get { throw null; } set { } } public string Format { get { throw null; } } diff --git a/sdk/search/Azure.Search.Documents/samples/Sample01b_HelloWorldAsync.md b/sdk/search/Azure.Search.Documents/samples/Sample01b_HelloWorldAsync.md index 3f08254f17d2f..4b49ad843793a 100644 --- a/sdk/search/Azure.Search.Documents/samples/Sample01b_HelloWorldAsync.md +++ b/sdk/search/Azure.Search.Documents/samples/Sample01b_HelloWorldAsync.md @@ -18,7 +18,7 @@ AzureKeyCredential credential = new AzureKeyCredential( SearchServiceClient search = new SearchServiceClient(endpoint, credential); // Perform an operation -Response stats = await search.GetStatisticsAsync(); +Response stats = await search.GetServiceStatisticsAsync(); Console.WriteLine($"You are using {stats.Value.Counters.IndexCounter.Usage} indexes."); ``` diff --git a/sdk/search/Azure.Search.Documents/samples/Sample02_Service.md b/sdk/search/Azure.Search.Documents/samples/Sample02_Service.md index 779526630b1a3..2b62ef36064ea 100644 --- a/sdk/search/Azure.Search.Documents/samples/Sample02_Service.md +++ b/sdk/search/Azure.Search.Documents/samples/Sample02_Service.md @@ -20,6 +20,6 @@ AzureKeyCredential credential = new AzureKeyCredential( SearchServiceClient search = new SearchServiceClient(endpoint, credential); // Get and report the Search Service statistics -Response stats = await search.GetStatisticsAsync(); +Response stats = await search.GetServiceStatisticsAsync(); Console.WriteLine($"You are using {stats.Value.Counters.IndexCounter.Usage} of {stats.Value.Counters.IndexCounter.Quota} indexes."); ``` diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/Analyzer.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/Analyzer.cs index 283b72e76f7fb..cbedfc49fe5ba 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/Analyzer.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/Analyzer.cs @@ -9,7 +9,7 @@ namespace Azure.Search.Documents.Models { - /// Abstract base class for analyzers. + /// Base type for analyzers. public partial class Analyzer { /// Initializes a new instance of Analyzer. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/AnalyzerName.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/AnalyzerName.cs index e9999e08ce998..d0bf6e6b9dcc4 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/AnalyzerName.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/AnalyzerName.cs @@ -81,8 +81,8 @@ public AnalyzerName(string value) private const string FaLuceneValue = "fa.lucene"; private const string PlMicrosoftValue = "pl.microsoft"; private const string PlLuceneValue = "pl.lucene"; - private const string PtBRMicrosoftValue = "pt-BR.microsoft"; - private const string PtBRLuceneValue = "pt-BR.lucene"; + private const string PtBrMicrosoftValue = "pt-BR.microsoft"; + private const string PtBrLuceneValue = "pt-BR.lucene"; private const string PtMicrosoftValue = "pt-PT.microsoft"; private const string PtLuceneValue = "pt-PT.lucene"; private const string PaMicrosoftValue = "pa.microsoft"; @@ -108,198 +108,198 @@ public AnalyzerName(string value) private const string UrMicrosoftValue = "ur.microsoft"; private const string ViMicrosoftValue = "vi.microsoft"; private const string StandardLuceneValue = "standard.lucene"; - private const string StandardasciifoldingLuceneValue = "standardasciifolding.lucene"; + private const string StandardAsciiFoldingLuceneValue = "standardasciifolding.lucene"; private const string KeywordValue = "keyword"; private const string PatternValue = "pattern"; private const string SimpleValue = "simple"; private const string StopValue = "stop"; private const string WhitespaceValue = "whitespace"; - /// ar.microsoft. + /// Microsoft analyzer for Arabic. public static AnalyzerName ArMicrosoft { get; } = new AnalyzerName(ArMicrosoftValue); - /// ar.lucene. + /// Lucene analyzer for Arabic. public static AnalyzerName ArLucene { get; } = new AnalyzerName(ArLuceneValue); - /// hy.lucene. + /// Lucene analyzer for Armenian. public static AnalyzerName HyLucene { get; } = new AnalyzerName(HyLuceneValue); - /// bn.microsoft. + /// Microsoft analyzer for Bangla. public static AnalyzerName BnMicrosoft { get; } = new AnalyzerName(BnMicrosoftValue); - /// eu.lucene. + /// Lucene analyzer for Basque. public static AnalyzerName EuLucene { get; } = new AnalyzerName(EuLuceneValue); - /// bg.microsoft. + /// Microsoft analyzer for Bulgarian. public static AnalyzerName BgMicrosoft { get; } = new AnalyzerName(BgMicrosoftValue); - /// bg.lucene. + /// Lucene analyzer for Bulgarian. public static AnalyzerName BgLucene { get; } = new AnalyzerName(BgLuceneValue); - /// ca.microsoft. + /// Microsoft analyzer for Catalan. public static AnalyzerName CaMicrosoft { get; } = new AnalyzerName(CaMicrosoftValue); - /// ca.lucene. + /// Lucene analyzer for Catalan. public static AnalyzerName CaLucene { get; } = new AnalyzerName(CaLuceneValue); - /// zh-Hans.microsoft. + /// Microsoft analyzer for Chinese (Simplified). public static AnalyzerName ZhHansMicrosoft { get; } = new AnalyzerName(ZhHansMicrosoftValue); - /// zh-Hans.lucene. + /// Lucene analyzer for Chinese (Simplified). public static AnalyzerName ZhHansLucene { get; } = new AnalyzerName(ZhHansLuceneValue); - /// zh-Hant.microsoft. + /// Microsoft analyzer for Chinese (Traditional). public static AnalyzerName ZhHantMicrosoft { get; } = new AnalyzerName(ZhHantMicrosoftValue); - /// zh-Hant.lucene. + /// Lucene analyzer for Chinese (Traditional). public static AnalyzerName ZhHantLucene { get; } = new AnalyzerName(ZhHantLuceneValue); - /// hr.microsoft. + /// Microsoft analyzer for Croatian. public static AnalyzerName HrMicrosoft { get; } = new AnalyzerName(HrMicrosoftValue); - /// cs.microsoft. + /// Microsoft analyzer for Czech. public static AnalyzerName CsMicrosoft { get; } = new AnalyzerName(CsMicrosoftValue); - /// cs.lucene. + /// Lucene analyzer for Czech. public static AnalyzerName CsLucene { get; } = new AnalyzerName(CsLuceneValue); - /// da.microsoft. + /// Microsoft analyzer for Danish. public static AnalyzerName DaMicrosoft { get; } = new AnalyzerName(DaMicrosoftValue); - /// da.lucene. + /// Lucene analyzer for Danish. public static AnalyzerName DaLucene { get; } = new AnalyzerName(DaLuceneValue); - /// nl.microsoft. + /// Microsoft analyzer for Dutch. public static AnalyzerName NlMicrosoft { get; } = new AnalyzerName(NlMicrosoftValue); - /// nl.lucene. + /// Lucene analyzer for Dutch. public static AnalyzerName NlLucene { get; } = new AnalyzerName(NlLuceneValue); - /// en.microsoft. + /// Microsoft analyzer for English. public static AnalyzerName EnMicrosoft { get; } = new AnalyzerName(EnMicrosoftValue); - /// en.lucene. + /// Lucene analyzer for English. public static AnalyzerName EnLucene { get; } = new AnalyzerName(EnLuceneValue); - /// et.microsoft. + /// Microsoft analyzer for Estonian. public static AnalyzerName EtMicrosoft { get; } = new AnalyzerName(EtMicrosoftValue); - /// fi.microsoft. + /// Microsoft analyzer for Finnish. public static AnalyzerName FiMicrosoft { get; } = new AnalyzerName(FiMicrosoftValue); - /// fi.lucene. + /// Lucene analyzer for Finnish. public static AnalyzerName FiLucene { get; } = new AnalyzerName(FiLuceneValue); - /// fr.microsoft. + /// Microsoft analyzer for French. public static AnalyzerName FrMicrosoft { get; } = new AnalyzerName(FrMicrosoftValue); - /// fr.lucene. + /// Lucene analyzer for French. public static AnalyzerName FrLucene { get; } = new AnalyzerName(FrLuceneValue); - /// gl.lucene. + /// Lucene analyzer for Galician. public static AnalyzerName GlLucene { get; } = new AnalyzerName(GlLuceneValue); - /// de.microsoft. + /// Microsoft analyzer for German. public static AnalyzerName DeMicrosoft { get; } = new AnalyzerName(DeMicrosoftValue); - /// de.lucene. + /// Lucene analyzer for German. public static AnalyzerName DeLucene { get; } = new AnalyzerName(DeLuceneValue); - /// el.microsoft. + /// Microsoft analyzer for Greek. public static AnalyzerName ElMicrosoft { get; } = new AnalyzerName(ElMicrosoftValue); - /// el.lucene. + /// Lucene analyzer for Greek. public static AnalyzerName ElLucene { get; } = new AnalyzerName(ElLuceneValue); - /// gu.microsoft. + /// Microsoft analyzer for Gujarati. public static AnalyzerName GuMicrosoft { get; } = new AnalyzerName(GuMicrosoftValue); - /// he.microsoft. + /// Microsoft analyzer for Hebrew. public static AnalyzerName HeMicrosoft { get; } = new AnalyzerName(HeMicrosoftValue); - /// hi.microsoft. + /// Microsoft analyzer for Hindi. public static AnalyzerName HiMicrosoft { get; } = new AnalyzerName(HiMicrosoftValue); - /// hi.lucene. + /// Lucene analyzer for Hindi. public static AnalyzerName HiLucene { get; } = new AnalyzerName(HiLuceneValue); - /// hu.microsoft. + /// Microsoft analyzer for Hungarian. public static AnalyzerName HuMicrosoft { get; } = new AnalyzerName(HuMicrosoftValue); - /// hu.lucene. + /// Lucene analyzer for Hungarian. public static AnalyzerName HuLucene { get; } = new AnalyzerName(HuLuceneValue); - /// is.microsoft. + /// Microsoft analyzer for Icelandic. public static AnalyzerName IsMicrosoft { get; } = new AnalyzerName(IsMicrosoftValue); - /// id.microsoft. + /// Microsoft analyzer for Indonesian (Bahasa). public static AnalyzerName IdMicrosoft { get; } = new AnalyzerName(IdMicrosoftValue); - /// id.lucene. + /// Lucene analyzer for Indonesian. public static AnalyzerName IdLucene { get; } = new AnalyzerName(IdLuceneValue); - /// ga.lucene. + /// Lucene analyzer for Irish. public static AnalyzerName GaLucene { get; } = new AnalyzerName(GaLuceneValue); - /// it.microsoft. + /// Microsoft analyzer for Italian. public static AnalyzerName ItMicrosoft { get; } = new AnalyzerName(ItMicrosoftValue); - /// it.lucene. + /// Lucene analyzer for Italian. public static AnalyzerName ItLucene { get; } = new AnalyzerName(ItLuceneValue); - /// ja.microsoft. + /// Microsoft analyzer for Japanese. public static AnalyzerName JaMicrosoft { get; } = new AnalyzerName(JaMicrosoftValue); - /// ja.lucene. + /// Lucene analyzer for Japanese. public static AnalyzerName JaLucene { get; } = new AnalyzerName(JaLuceneValue); - /// kn.microsoft. + /// Microsoft analyzer for Kannada. public static AnalyzerName KnMicrosoft { get; } = new AnalyzerName(KnMicrosoftValue); - /// ko.microsoft. + /// Microsoft analyzer for Korean. public static AnalyzerName KoMicrosoft { get; } = new AnalyzerName(KoMicrosoftValue); - /// ko.lucene. + /// Lucene analyzer for Korean. public static AnalyzerName KoLucene { get; } = new AnalyzerName(KoLuceneValue); - /// lv.microsoft. + /// Microsoft analyzer for Latvian. public static AnalyzerName LvMicrosoft { get; } = new AnalyzerName(LvMicrosoftValue); - /// lv.lucene. + /// Lucene analyzer for Latvian. public static AnalyzerName LvLucene { get; } = new AnalyzerName(LvLuceneValue); - /// lt.microsoft. + /// Microsoft analyzer for Lithuanian. public static AnalyzerName LtMicrosoft { get; } = new AnalyzerName(LtMicrosoftValue); - /// ml.microsoft. + /// Microsoft analyzer for Malayalam. public static AnalyzerName MlMicrosoft { get; } = new AnalyzerName(MlMicrosoftValue); - /// ms.microsoft. + /// Microsoft analyzer for Malay (Latin). public static AnalyzerName MsMicrosoft { get; } = new AnalyzerName(MsMicrosoftValue); - /// mr.microsoft. + /// Microsoft analyzer for Marathi. public static AnalyzerName MrMicrosoft { get; } = new AnalyzerName(MrMicrosoftValue); - /// nb.microsoft. + /// Microsoft analyzer for Norwegian (Bokmål). public static AnalyzerName NbMicrosoft { get; } = new AnalyzerName(NbMicrosoftValue); - /// no.lucene. + /// Lucene analyzer for Norwegian. public static AnalyzerName NoLucene { get; } = new AnalyzerName(NoLuceneValue); - /// fa.lucene. + /// Lucene analyzer for Persian. public static AnalyzerName FaLucene { get; } = new AnalyzerName(FaLuceneValue); - /// pl.microsoft. + /// Microsoft analyzer for Polish. public static AnalyzerName PlMicrosoft { get; } = new AnalyzerName(PlMicrosoftValue); - /// pl.lucene. + /// Lucene analyzer for Polish. public static AnalyzerName PlLucene { get; } = new AnalyzerName(PlLuceneValue); - /// pt-BR.microsoft. - public static AnalyzerName PtBRMicrosoft { get; } = new AnalyzerName(PtBRMicrosoftValue); - /// pt-BR.lucene. - public static AnalyzerName PtBRLucene { get; } = new AnalyzerName(PtBRLuceneValue); - /// pt-PT.microsoft. + /// Microsoft analyzer for Portuguese (Brazil). + public static AnalyzerName PtBrMicrosoft { get; } = new AnalyzerName(PtBrMicrosoftValue); + /// Lucene analyzer for Portuguese (Brazil). + public static AnalyzerName PtBrLucene { get; } = new AnalyzerName(PtBrLuceneValue); + /// Microsoft analyzer for Portuguese (Portugal). public static AnalyzerName PtMicrosoft { get; } = new AnalyzerName(PtMicrosoftValue); - /// pt-PT.lucene. + /// Lucene analyzer for Portuguese (Portugal). public static AnalyzerName PtLucene { get; } = new AnalyzerName(PtLuceneValue); - /// pa.microsoft. + /// Microsoft analyzer for Punjabi. public static AnalyzerName PaMicrosoft { get; } = new AnalyzerName(PaMicrosoftValue); - /// ro.microsoft. + /// Microsoft analyzer for Romanian. public static AnalyzerName RoMicrosoft { get; } = new AnalyzerName(RoMicrosoftValue); - /// ro.lucene. + /// Lucene analyzer for Romanian. public static AnalyzerName RoLucene { get; } = new AnalyzerName(RoLuceneValue); - /// ru.microsoft. + /// Microsoft analyzer for Russian. public static AnalyzerName RuMicrosoft { get; } = new AnalyzerName(RuMicrosoftValue); - /// ru.lucene. + /// Lucene analyzer for Russian. public static AnalyzerName RuLucene { get; } = new AnalyzerName(RuLuceneValue); - /// sr-cyrillic.microsoft. + /// Microsoft analyzer for Serbian (Cyrillic). public static AnalyzerName SrCyrillicMicrosoft { get; } = new AnalyzerName(SrCyrillicMicrosoftValue); - /// sr-latin.microsoft. + /// Microsoft analyzer for Serbian (Latin). public static AnalyzerName SrLatinMicrosoft { get; } = new AnalyzerName(SrLatinMicrosoftValue); - /// sk.microsoft. + /// Microsoft analyzer for Slovak. public static AnalyzerName SkMicrosoft { get; } = new AnalyzerName(SkMicrosoftValue); - /// sl.microsoft. + /// Microsoft analyzer for Slovenian. public static AnalyzerName SlMicrosoft { get; } = new AnalyzerName(SlMicrosoftValue); - /// es.microsoft. + /// Microsoft analyzer for Spanish. public static AnalyzerName EsMicrosoft { get; } = new AnalyzerName(EsMicrosoftValue); - /// es.lucene. + /// Lucene analyzer for Spanish. public static AnalyzerName EsLucene { get; } = new AnalyzerName(EsLuceneValue); - /// sv.microsoft. + /// Microsoft analyzer for Swedish. public static AnalyzerName SvMicrosoft { get; } = new AnalyzerName(SvMicrosoftValue); - /// sv.lucene. + /// Lucene analyzer for Swedish. public static AnalyzerName SvLucene { get; } = new AnalyzerName(SvLuceneValue); - /// ta.microsoft. + /// Microsoft analyzer for Tamil. public static AnalyzerName TaMicrosoft { get; } = new AnalyzerName(TaMicrosoftValue); - /// te.microsoft. + /// Microsoft analyzer for Telugu. public static AnalyzerName TeMicrosoft { get; } = new AnalyzerName(TeMicrosoftValue); - /// th.microsoft. + /// Microsoft analyzer for Thai. public static AnalyzerName ThMicrosoft { get; } = new AnalyzerName(ThMicrosoftValue); - /// th.lucene. + /// Lucene analyzer for Thai. public static AnalyzerName ThLucene { get; } = new AnalyzerName(ThLuceneValue); - /// tr.microsoft. + /// Microsoft analyzer for Turkish. public static AnalyzerName TrMicrosoft { get; } = new AnalyzerName(TrMicrosoftValue); - /// tr.lucene. + /// Lucene analyzer for Turkish. public static AnalyzerName TrLucene { get; } = new AnalyzerName(TrLuceneValue); - /// uk.microsoft. + /// Microsoft analyzer for Ukrainian. public static AnalyzerName UkMicrosoft { get; } = new AnalyzerName(UkMicrosoftValue); - /// ur.microsoft. + /// Microsoft analyzer for Urdu. public static AnalyzerName UrMicrosoft { get; } = new AnalyzerName(UrMicrosoftValue); - /// vi.microsoft. + /// Microsoft analyzer for Vietnamese. public static AnalyzerName ViMicrosoft { get; } = new AnalyzerName(ViMicrosoftValue); - /// standard.lucene. + /// Standard Lucene analyzer. public static AnalyzerName StandardLucene { get; } = new AnalyzerName(StandardLuceneValue); - /// standardasciifolding.lucene. - public static AnalyzerName StandardasciifoldingLucene { get; } = new AnalyzerName(StandardasciifoldingLuceneValue); - /// keyword. + /// Standard ASCII Folding Lucene analyzer. See https://docs.microsoft.com/rest/api/searchservice/Custom-analyzers-in-Azure-Search#Analyzers. + public static AnalyzerName StandardAsciiFoldingLucene { get; } = new AnalyzerName(StandardAsciiFoldingLuceneValue); + /// 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. public static AnalyzerName Keyword { get; } = new AnalyzerName(KeywordValue); - /// pattern. + /// 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. public static AnalyzerName Pattern { get; } = new AnalyzerName(PatternValue); - /// simple. + /// 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. public static AnalyzerName Simple { get; } = new AnalyzerName(SimpleValue); - /// stop. + /// 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. public static AnalyzerName Stop { get; } = new AnalyzerName(StopValue); - /// whitespace. + /// 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. public static AnalyzerName Whitespace { get; } = new AnalyzerName(WhitespaceValue); /// Determines if two values are the same. public static bool operator ==(AnalyzerName left, AnalyzerName right) => left.Equals(right); diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/CharFilter.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/CharFilter.cs index 69c6597526aa2..64ed14f02a410 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/CharFilter.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/CharFilter.cs @@ -9,7 +9,7 @@ namespace Azure.Search.Documents.Models { - /// Abstract base class for character filters. + /// Base type for character filters. public partial class CharFilter { /// Initializes a new instance of CharFilter. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/CognitiveServicesAccount.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/CognitiveServicesAccount.cs index 5935ac312185a..43ba12290f125 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/CognitiveServicesAccount.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/CognitiveServicesAccount.cs @@ -7,7 +7,7 @@ namespace Azure.Search.Documents.Models { - /// Abstract base class for describing any cognitive service resource attached to the skillset. + /// Base type for describing any cognitive service resource attached to a skillset. public partial class CognitiveServicesAccount { /// Initializes a new instance of CognitiveServicesAccount. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/DataChangeDetectionPolicy.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/DataChangeDetectionPolicy.cs index 545a074fff6d8..c01d394887de3 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/DataChangeDetectionPolicy.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/DataChangeDetectionPolicy.cs @@ -7,7 +7,7 @@ namespace Azure.Search.Documents.Models { - /// Abstract base class for data change detection policies. + /// Base type for data change detection policies. public partial class DataChangeDetectionPolicy { /// Initializes a new instance of DataChangeDetectionPolicy. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/DataDeletionDetectionPolicy.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/DataDeletionDetectionPolicy.cs index 2bcac979fc042..26461531f6265 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/DataDeletionDetectionPolicy.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/DataDeletionDetectionPolicy.cs @@ -7,7 +7,7 @@ namespace Azure.Search.Documents.Models { - /// Abstract base class for data deletion detection policies. + /// Base type for data deletion detection policies. public partial class DataDeletionDetectionPolicy { /// Initializes a new instance of DataDeletionDetectionPolicy. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/DataType.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/DataType.cs index bdbf853c3e533..e81303ed6590b 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/DataType.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/DataType.cs @@ -21,31 +21,15 @@ public DataType(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string EdmStringValue = "Edm.String"; - private const string EdmInt32Value = "Edm.Int32"; - private const string EdmInt64Value = "Edm.Int64"; - private const string EdmDoubleValue = "Edm.Double"; - private const string EdmBooleanValue = "Edm.Boolean"; - private const string EdmDateTimeOffsetValue = "Edm.DateTimeOffset"; - private const string EdmGeographyPointValue = "Edm.GeographyPoint"; - private const string EdmComplexTypeValue = "Edm.ComplexType"; + private const string StringValue = "Edm.String"; + private const string Int32Value = "Edm.Int32"; + private const string Int64Value = "Edm.Int64"; + private const string DoubleValue = "Edm.Double"; + private const string BooleanValue = "Edm.Boolean"; + private const string DateTimeOffsetValue = "Edm.DateTimeOffset"; + private const string GeographyPointValue = "Edm.GeographyPoint"; + private const string ComplexValue = "Edm.ComplexType"; - /// Edm.String. - public static DataType EdmString { get; } = new DataType(EdmStringValue); - /// Edm.Int32. - public static DataType EdmInt32 { get; } = new DataType(EdmInt32Value); - /// Edm.Int64. - public static DataType EdmInt64 { get; } = new DataType(EdmInt64Value); - /// Edm.Double. - public static DataType EdmDouble { get; } = new DataType(EdmDoubleValue); - /// Edm.Boolean. - public static DataType EdmBoolean { get; } = new DataType(EdmBooleanValue); - /// Edm.DateTimeOffset. - public static DataType EdmDateTimeOffset { get; } = new DataType(EdmDateTimeOffsetValue); - /// Edm.GeographyPoint. - public static DataType EdmGeographyPoint { get; } = new DataType(EdmGeographyPointValue); - /// Edm.ComplexType. - public static DataType EdmComplexType { get; } = new DataType(EdmComplexTypeValue); /// Determines if two values are the same. public static bool operator ==(DataType left, DataType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/ScoringFunction.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/ScoringFunction.cs index fe3f59d1c4368..de1c341f37830 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/ScoringFunction.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/ScoringFunction.cs @@ -9,7 +9,7 @@ namespace Azure.Search.Documents.Models { - /// Abstract base class for functions that can modify document scores during ranking. + /// Base type for functions that can modify document scores during ranking. public partial class ScoringFunction { /// Initializes a new instance of ScoringFunction. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchField.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchField.Serialization.cs index 7dfb7ee9df48c..d9bcbc2fabf2e 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchField.Serialization.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchField.Serialization.cs @@ -25,10 +25,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("key"); writer.WriteBooleanValue(Key.Value); } - if (Retrievable != null) + if (IsHidden != null) { writer.WritePropertyName("retrievable"); - writer.WriteBooleanValue(Retrievable.Value); + writer.WriteBooleanValue(IsHidden.Value); } if (Searchable != null) { diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchField.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchField.cs index c32ca3b58e59e..e941a214c4483 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchField.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchField.cs @@ -5,7 +5,6 @@ #nullable disable -using System; using System.Collections.Generic; namespace Azure.Search.Documents.Models @@ -13,40 +12,26 @@ namespace Azure.Search.Documents.Models /// Represents a field in an index definition, which describes the name, data type, and search behavior of a field. public partial class SearchField { - /// Initializes a new instance of SearchField. - /// The name of the field, which must be unique within the fields collection of the index or parent field. - /// The data type of the field. - public SearchField(string name, DataType type) - { - if (name == null) - { - throw new ArgumentNullException(nameof(name)); - } - - Name = name; - Type = type; - } - /// Initializes a new instance of SearchField. /// The name of the field, which must be unique within the fields collection of the index or parent field. /// The data type of the field. /// 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. - /// 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 and null for complex fields. + /// 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 and null for complex fields. /// 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 since Azure Cognitive Search will store an additional tokenized version 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. /// 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. /// A value indicating whether to enable the field to be referenced in $orderby expressions. By default Azure Cognitive Search 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. /// 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. - /// The name of the language 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. - /// 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 analyzer can be updated on an existing field. Must be null for complex fields. - /// 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. Once the analyzer is chosen, it cannot be changed for the field. Must be null for complex fields. + /// 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. + /// 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. + /// 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. /// 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. /// 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. - internal SearchField(string name, DataType type, bool? key, bool? retrievable, bool? searchable, bool? filterable, bool? sortable, bool? facetable, AnalyzerName? analyzer, AnalyzerName? searchAnalyzer, AnalyzerName? indexAnalyzer, IList synonymMaps, IList fields) + internal SearchField(string name, DataType type, bool? key, bool? isHidden, bool? searchable, bool? filterable, bool? sortable, bool? facetable, AnalyzerName? analyzer, AnalyzerName? searchAnalyzer, AnalyzerName? indexAnalyzer, IList synonymMaps, IList fields) { Name = name; Type = type; Key = key; - Retrievable = retrievable; + IsHidden = isHidden; Searchable = searchable; Filterable = filterable; Sortable = sortable; @@ -58,14 +43,8 @@ internal SearchField(string name, DataType type, bool? key, bool? retrievable, b Fields = fields; } - /// The name of the field, which must be unique within the fields collection of the index or parent field. - public string Name { get; } - /// The data type of the field. - public DataType Type { get; } /// 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. public bool? Key { get; set; } - /// 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 and null for complex fields. - public bool? Retrievable { get; set; } /// 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 since Azure Cognitive Search will store an additional tokenized version 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. public bool? Searchable { get; set; } /// 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. @@ -74,11 +53,11 @@ internal SearchField(string name, DataType type, bool? key, bool? retrievable, b public bool? Sortable { get; set; } /// 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. public bool? Facetable { get; set; } - /// The name of the language 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. + /// 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. public AnalyzerName? Analyzer { get; set; } - /// 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 analyzer can be updated on an existing field. Must be null for complex fields. + /// 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. public AnalyzerName? SearchAnalyzer { get; set; } - /// 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. Once the analyzer is chosen, it cannot be changed for the field. Must be null for complex fields. + /// 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. public AnalyzerName? IndexAnalyzer { get; set; } /// 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. public IList SynonymMaps { get; set; } diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndex.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndex.cs index d2c0526a5fff5..856428d35572d 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndex.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndex.cs @@ -5,33 +5,13 @@ #nullable disable -using System; using System.Collections.Generic; -using System.Linq; namespace Azure.Search.Documents.Models { /// Represents a search index definition, which describes the fields and search behavior of an index. public partial class SearchIndex { - /// Initializes a new instance of SearchIndex. - /// The name of the index. - /// The fields of the index. - public SearchIndex(string name, IEnumerable fields) - { - if (name == null) - { - throw new ArgumentNullException(nameof(name)); - } - if (fields == null) - { - throw new ArgumentNullException(nameof(fields)); - } - - Name = name; - Fields = fields.ToArray(); - } - /// Initializes a new instance of SearchIndex. /// The name of the index. /// The fields of the index. @@ -61,10 +41,6 @@ internal SearchIndex(string name, IList fields, IList The name of the index. - public string Name { get; } - /// The fields of the index. - public IList Fields { get; } /// The scoring profiles for the index. public IList ScoringProfiles { get; set; } /// 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. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/Skill.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/Skill.cs index a06cf1c25bd03..e944cec67280f 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/Skill.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/Skill.cs @@ -11,7 +11,7 @@ namespace Azure.Search.Documents.Models { - /// Abstract base class for skills. + /// Base type for skills. public partial class Skill { /// Initializes a new instance of Skill. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/SynonymMap.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/SynonymMap.cs index be4c8931b0f67..4289fca7294c1 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/SynonymMap.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/SynonymMap.cs @@ -5,32 +5,11 @@ #nullable disable -using System; - namespace Azure.Search.Documents.Models { /// Represents a synonym map definition. public partial class SynonymMap { - /// Initializes a new instance of SynonymMap. - /// The name of the synonym map. - /// A series of synonym rules in the specified synonym map format. The rules must be separated by newlines. - public SynonymMap(string name, string synonyms) - { - if (name == null) - { - throw new ArgumentNullException(nameof(name)); - } - if (synonyms == null) - { - throw new ArgumentNullException(nameof(synonyms)); - } - - Name = name; - Format = "solr"; - Synonyms = synonyms; - } - /// Initializes a new instance of SynonymMap. /// The name of the synonym map. /// The format of the synonym map. Only the 'solr' format is currently supported. @@ -46,12 +25,6 @@ internal SynonymMap(string name, string format, string synonyms, EncryptionKey e ETag = eTag; } - /// The name of the synonym map. - public string Name { get; } - /// The format of the synonym map. Only the 'solr' format is currently supported. - public string Format { get; } - /// A series of synonym rules in the specified synonym map format. The rules must be separated by newlines. - public string Synonyms { get; } /// 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. public EncryptionKey EncryptionKey { get; set; } /// The ETag of the synonym map. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/TokenFilter.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/TokenFilter.cs index ccfa34fc7f0ce..c0c2d091a35d7 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/TokenFilter.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/TokenFilter.cs @@ -9,7 +9,7 @@ namespace Azure.Search.Documents.Models { - /// Abstract base class for token filters. + /// Base type for token filters. public partial class TokenFilter { /// Initializes a new instance of TokenFilter. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/Tokenizer.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/Tokenizer.cs index 8f241cb0b34d7..2b192dead49bf 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/Tokenizer.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/Tokenizer.cs @@ -9,7 +9,7 @@ namespace Azure.Search.Documents.Models { - /// Abstract base class for tokenizers. + /// Base type for tokenizers. public partial class Tokenizer { /// Initializes a new instance of Tokenizer. diff --git a/sdk/search/Azure.Search.Documents/src/Models/ComplexField.cs b/sdk/search/Azure.Search.Documents/src/Models/ComplexField.cs new file mode 100644 index 0000000000000..7b0769553067a --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Models/ComplexField.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Search.Documents.Models +{ + /// + /// A complex field or collection of complex fields that contain child fields. + /// Child fields may be or . + /// + public class ComplexField : FieldBase, IEnumerable + { + /// + /// Initializes a new instance of the class. + /// + /// The name of the field, which must be unique within the index or parent field. + /// Whether the field is a collection of strings. + /// is an empty string. + /// is null. + public ComplexField(string name, bool collection = false) : base(name, collection ? DataType.Collection(DataType.Complex) : DataType.Complex) + { + } + + /// + /// Gets a collection of or child fields. + /// + public IList Fields { get; } = new List(); + + /// + /// Adds a child or . + /// + /// The or to add. + /// is null. + public void Add(FieldBase field) + { + Argument.AssertNotNull(field, nameof(field)); + + Fields.Add(field); + } + + /// + protected override void Save(SearchField field) + { + foreach (FieldBase child in Fields) + { + field.Fields.Add(child); + } + } + + IEnumerator IEnumerable.GetEnumerator() => Fields.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() => Fields.GetEnumerator(); + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Models/DataType.cs b/sdk/search/Azure.Search.Documents/src/Models/DataType.cs new file mode 100644 index 0000000000000..651f368ba400d --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Models/DataType.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; + +namespace Azure.Search.Documents.Models +{ + [CodeGenSchema("DataType")] + public readonly partial struct DataType + { +#pragma warning disable CA1720 // Identifier contains type name + /// A type. + [CodeGenSchemaMember("EdmString")] + public static DataType String { get; } = new DataType(StringValue); + + /// An type, or something that can convert to an . + [CodeGenSchemaMember("EdmInt32")] + public static DataType Int32 { get; } = new DataType(Int32Value); + + /// An type, or something that can convert to an . + [CodeGenSchemaMember("EdmInt64")] + public static DataType Int64 { get; } = new DataType(Int64Value); + + /// A type, or something that can convert to a . + [CodeGenSchemaMember("EdmDouble")] + public static DataType Double { get; } = new DataType(DoubleValue); +#pragma warning restore CA1720 // Identifier contains type name + + /// A type. + [CodeGenSchemaMember("EdmBoolean")] + public static DataType Boolean { get; } = new DataType(BooleanValue); + + /// A type, or converted to a . + [CodeGenSchemaMember("EdmDateTimeOffset")] + public static DataType DateTimeOffset { get; } = new DataType(DateTimeOffsetValue); + + /// A geographic point type. + [CodeGenSchemaMember("EdmGeographyPoint")] + public static DataType GeographyPoint { get; } = new DataType(GeographyPointValue); + + /// A complex type with child fields. + [CodeGenSchemaMember("EdmComplexType")] + public static DataType Complex { get; } = new DataType(ComplexValue); + + /// + /// Gets a representing a collection of . + /// + /// The type of collection. + /// A representing a collection of . + public static DataType Collection(DataType type) => $"Collection({type})"; + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Models/FieldBase.cs b/sdk/search/Azure.Search.Documents/src/Models/FieldBase.cs new file mode 100644 index 0000000000000..57e62102f6698 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Models/FieldBase.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.Core; + +namespace Azure.Search.Documents.Models +{ + /// + /// Base field type for helper classes to more easily create a . + /// + public abstract class FieldBase + { + /// + /// Initializes a new instance of the class. + /// + /// The name of the field, which must be unique within the index or parent field. + /// The data type of the field. + /// is an empty string. + /// is null. + public FieldBase(string name, DataType type) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + Name = name; + Type = type; + } + + /// + /// Gets the name of the field. + /// + public string Name { get; } + + /// + /// Ge the data type of the field. + /// + public DataType Type { get; } + + // TODO: Remove "overrides" for boolean properties when https://github.com/Azure/autorest.csharp/issues/558 is fixed. + + /// + /// Persists class-specific properties into the given . + /// + /// The into which properties are persisted. + protected abstract void Save(SearchField field); + + /// + /// Casts a or derivative to a . + /// + /// The or derivative to cast. + /// is null. + public static implicit operator SearchField(FieldBase value) + { + Argument.AssertNotNull(value, nameof(value)); + + SearchField field = new SearchField(value.Name, value.Type); + value.Save(field); + + return field; + } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Models/SearchField.cs b/sdk/search/Azure.Search.Documents/src/Models/SearchField.cs index 2bdb4835d83fa..62a400e93989a 100644 --- a/sdk/search/Azure.Search.Documents/src/Models/SearchField.cs +++ b/sdk/search/Azure.Search.Documents/src/Models/SearchField.cs @@ -1,12 +1,65 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using Azure.Core; namespace Azure.Search.Documents.Models { + /// + /// Represents a field in an index definition, which describes the name, data type, and search behavior of a field. + /// + /// When creating an index, instead use the and classes to help you more easily create a . + /// + /// [CodeGenSchema("Field")] public partial class SearchField { + // TODO: Replace constructor and read-only properties when https://github.com/Azure/autorest.csharp/issues/554 is fixed. + + /// + /// Initializes a new instance of the class. + /// + /// The name of the field, which must be unique within the index or parent field. + /// The data type of the field. + /// is an empty string. + /// is null. + public SearchField(string name, DataType type) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + Name = name; + Type = type; + } + + private SearchField() + { + } + + /// + /// Gets the name of the field. + /// + [CodeGenSchemaMember("name")] + public string Name { get; internal set; } + + /// + /// Ge the data type of the field. + /// + [CodeGenSchemaMember("type")] + public DataType Type { get; internal set; } + + /// + /// Gets or sets 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 false 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 false for simple fields and null for complex fields. + /// + [CodeGenSchemaMember("retrievable")] + public bool? IsHidden { get; set; } + + /// + public override string ToString() => $"{Name} : {Type}"; } } diff --git a/sdk/search/Azure.Search.Documents/src/Models/SearchIndex.cs b/sdk/search/Azure.Search.Documents/src/Models/SearchIndex.cs index 4ef4247119575..5da3cd0ea955a 100644 --- a/sdk/search/Azure.Search.Documents/src/Models/SearchIndex.cs +++ b/sdk/search/Azure.Search.Documents/src/Models/SearchIndex.cs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Search.Documents.Models @@ -8,5 +10,64 @@ namespace Azure.Search.Documents.Models [CodeGenSchema("Index")] public partial class SearchIndex { + private List _fields; + + // TODO: Replace constructor and read-only properties when https://github.com/Azure/autorest.csharp/issues/554 is fixed. + + /// + /// Initializes a new instance of the class. + /// + /// The name of the index. + /// is an empty string. + /// is null. + public SearchIndex(string name) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + Name = name; + + _fields = new List(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The name of the index. + /// Fields to add to the index. + /// is an empty string. + /// or is null. + public SearchIndex(string name, IEnumerable fields) : this(name) + { + Argument.AssertNotNull(fields, nameof(fields)); + + // We define the field as List to take advantage of its faster AddRange. + _fields.AddRange(fields); + } + + private SearchIndex() + { + } + + /// + /// Gets the name of the index. + /// + [CodeGenSchemaMember("name")] + public string Name { get; internal set; } + + // TODO: Remove read-only collection properties when https://github.com/Azure/autorest.csharp/issues/521 is fixed. + + /// + /// Gets the fields in the index. + /// Use , , and for help defining valid indexes. + /// Index fields have many constraints that are not validated with until the index is created on the server. + /// + [CodeGenSchemaMember("fields")] + public IList Fields + { + get => _fields; + + // Make a shallow copy of the fields. + internal set => _fields = new List(value ?? throw new ArgumentNullException(nameof(value))); + } } } diff --git a/sdk/search/Azure.Search.Documents/src/Models/SearchableField.cs b/sdk/search/Azure.Search.Documents/src/Models/SearchableField.cs new file mode 100644 index 0000000000000..2e8ee23aa89c7 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Models/SearchableField.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Search.Documents.Models +{ + /// + /// A or "Collection(String)" field that can be searched. + /// + public class SearchableField : SimpleField + { + /// + /// Initializes a new instance of the class. + /// + /// The name of the field, which must be unique within the index or parent field. + /// Whether the field is a collection of strings. + /// is an empty string. + /// is null. + public SearchableField(string name, bool collection = false) : base(name, collection ? DataType.Collection(DataType.String) : DataType.String) + { + // NOTE: Types other than string may be searchable one day. Could add an overload in the future. + } + + /// + /// Gets or sets the name of the language analyzer. This property cannot be set when either or are set. + /// Once the analyzer is chosen, it cannot be changed for the field in the index. + /// + public AnalyzerName? Analyzer { get; set; } + + /// + /// Gets or sets the name of the language analyzer for searching. This property must be set together with , and cannot be set when is set. + /// Once the analyzer is chosen, it cannot be changed for the field in the index. + /// + public AnalyzerName? SearchAnalyzer { get; set; } + + /// + /// Gets or sets the name of the language analyzer for indexing. This property must be set together with , and cannot be set when is set. + /// Once the analyzer is chosen, it cannot be changed for the field in the index. + /// + public AnalyzerName? IndexAnalyzer { get; set; } + + /// + /// Gets a list of names of synonym maps to associate with this field. + /// 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. + /// + public IList SynonymMaps { get; } = new List(); + + /// + protected override void Save(SearchField field) + { + base.Save(field); + + field.Searchable = true; + field.Analyzer = Analyzer; + field.SearchAnalyzer = SearchAnalyzer; + field.IndexAnalyzer = IndexAnalyzer; + + // Do not serialize an empty collection. + if (SynonymMaps.Count > 0) + { + field.SynonymMaps = SynonymMaps; + } + } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Models/SimpleField.cs b/sdk/search/Azure.Search.Documents/src/Models/SimpleField.cs new file mode 100644 index 0000000000000..0bcab69d5c060 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Models/SimpleField.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; + +namespace Azure.Search.Documents.Models +{ + /// + /// A simple field using a primitive type or a collection of a primitive type. + /// + public class SimpleField : FieldBase + { + /// + /// Initializes a new instance of the class. + /// + /// The name of the field, which must be unique within the index or parent field. + /// The data type of the field. + /// is an empty string. + /// is null. + public SimpleField(string name, DataType type) : base(name, type) + { + } + + /// + /// Gets or sets whether the field is the key field. The default is false. + /// A must have exactly one key field of type . + /// + public bool IsKey { get; set; } + + /// + /// Gets or sets whether the field is returned in search results. The default is false. + /// A key field where is true must have this property set to false. + /// + public bool IsHidden { get; set; } + + /// + /// Gets or sets a value indicating whether the field can be referenced in $filter queries. The default is false. + /// + /// + /// Filterable differs from searchable in how strings are handled. Fields of type or "Collection(DataTime.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. + /// + public bool IsFilterable { get; set; } + + /// + /// Gets or sets a value indicating whether the field can be retrieved in facet queries. The default is false. + /// + /// + /// Facets are used in presentation of search results that include hit counts by categories. + /// For example, in a search for digital cameras, facets might include branch, megapixels, price, etc. + /// + public bool IsFacetable { get; set; } + + /// + /// Gets or sets a value indicating whether to enable the field can be referenced in $orderby expressions. The default is false. + /// + /// + /// By default Azure Cognitive Search sorts results by score, but in many experiences users may want to sort by fields in the documents. + /// + public bool IsSortable { get; set; } + + /// + protected override void Save(SearchField field) + { + field.Key = IsKey; + field.IsHidden = IsHidden; + field.Filterable = IsFilterable; + field.Facetable = IsFacetable; + field.Sortable = IsSortable; + } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Models/SynonymMap.cs b/sdk/search/Azure.Search.Documents/src/Models/SynonymMap.cs new file mode 100644 index 0000000000000..201ea771accb8 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Models/SynonymMap.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Search.Documents.Models +{ + [CodeGenSchema("SynonymMap")] + public partial class SynonymMap + { + private const string DefaultFormat = "soln"; + private const string NewLine = "\n"; + + // TODO: Replace constructor and read-only properties when https://github.com/Azure/autorest.csharp/issues/554 is fixed. + + /// + /// Initializes a new instance of the class. + /// + /// The name of the synonym map. + /// The synonym to define. + /// The format of the synonym map. Currently, only "soln" is supported and is the default value. + /// , , or is an empty string. + /// , , or is null. + public SynonymMap(string name, string synonym, string format = DefaultFormat) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNullOrEmpty(format, nameof(format)); + Argument.AssertNotNullOrEmpty(synonym, nameof(synonym)); + + Name = name; + Format = format; + Synonyms = synonym; + } + + /// + /// Initializes a new instance of the class. + /// + /// The name of the synonym map. + /// One or more synonyms to define. These values will be separated by line breaks automatically. + /// The format of the synonym map. Currently, only "soln" is supported and is the default value. + /// , , or is an empty string. + /// , , or is null. + public SynonymMap(string name, IEnumerable synonyms, string format = DefaultFormat) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNullOrEmpty(format, nameof(format)); + Argument.AssertNotNullOrEmpty(synonyms, nameof(synonyms)); + + Name = name; + Format = format; + Synonyms = string.Join(NewLine, synonyms); + } + + private SynonymMap() + { + } + + /// + /// Gets the name of the synonym map. + /// + [CodeGenSchemaMember("name")] + public string Name { get; internal set; } + + /// + /// Gets the format of the synonym map. + /// + [CodeGenSchemaMember("format")] + public string Format { get; internal set; } + + /// + /// Gets the synonym rules for this synonym map. + /// + [CodeGenSchemaMember("synonyms")] + public string Synonyms { get; internal set; } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/SearchServiceClient.cs b/sdk/search/Azure.Search.Documents/src/SearchServiceClient.cs index be949a5088974..9747b8e4ec9b3 100644 --- a/sdk/search/Azure.Search.Documents/src/SearchServiceClient.cs +++ b/sdk/search/Azure.Search.Documents/src/SearchServiceClient.cs @@ -17,27 +17,30 @@ namespace Azure.Search.Documents /// public class SearchServiceClient { + private ServiceRestClient _serviceClient; + private IndexesRestClient _indexesClient; + /// - /// Gets the URI endpoint of the Search Service. This is likely + /// Gets the URI endpoint of the Search service. This is likely /// to be similar to "https://{search_service}.search.windows.net". /// public virtual Uri Endpoint { get; } /// - /// The name of the Search Service, lazily obtained from the + /// The name of the Search service, lazily obtained from the /// . /// private string _serviceName = null; /// - /// Gets the name of the Search Service. + /// Gets the name of the Search service. /// public virtual string ServiceName => _serviceName ??= Endpoint.GetSearchServiceName(); /// /// Gets the authenticated used for sending - /// requests to the Search Service. + /// requests to the Search service. /// private HttpPipeline Pipeline { get; } @@ -48,15 +51,30 @@ public class SearchServiceClient private ClientDiagnostics ClientDiagnostics { get; } /// - /// Gets the REST API version of the Search Service to use when making + /// Gets the REST API version of the Search service to use when making /// requests. /// private SearchClientOptions.ServiceVersion Version { get; } /// - /// Gets the generated service level operations to make requests. + /// Gets the generated to make requests. + /// + private ServiceRestClient ServiceClient => LazyInitializer.EnsureInitialized(ref _serviceClient, () => new ServiceRestClient( + ClientDiagnostics, + Pipeline, + Endpoint.ToString(), + Version.ToVersionString()) + ); + + /// + /// Gets the generated to make requests. /// - private ServiceRestClient Protocol { get; } + private IndexesRestClient IndexesClient => LazyInitializer.EnsureInitialized(ref _indexesClient, () => new IndexesRestClient( + ClientDiagnostics, + Pipeline, + Endpoint.ToString(), + Version.ToVersionString()) + ); /// /// Initializes a new instance of the SearchServiceClient class for @@ -68,13 +86,13 @@ protected SearchServiceClient() { } /// Initializes a new instance of the SearchServiceClient class. /// /// - /// Required. The URI endpoint of the Search Service. This is likely + /// Required. The URI endpoint of the Search service. This is likely /// to be similar to "https://{search_service}.search.windows.net". /// The URI must use HTTPS. /// /// /// Required. The API key credential used to authenticate requests - /// against the search service. You need to use an admin key to + /// against the Search service. You need to use an admin key to /// perform any operations on the SearchServiceClient. See /// /// for more information about API keys in Azure Cognitive Search. @@ -95,13 +113,13 @@ public SearchServiceClient(Uri endpoint, AzureKeyCredential credential) : /// Initializes a new instance of the SearchServiceClient class. /// /// - /// Required. The URI endpoint of the Search Service. This is likely + /// Required. The URI endpoint of the Search service. This is likely /// to be similar to "https://{search_service}.search.windows.net". /// The URI must use HTTPS. /// /// /// Required. The API key credential used to authenticate requests - /// against the search service. You need to use an admin key to + /// against the Search service. You need to use an admin key to /// perform any operations on the SearchServiceClient. See /// /// for more information about API keys in Azure Cognitive Search. @@ -131,12 +149,6 @@ public SearchServiceClient( ClientDiagnostics = new ClientDiagnostics(options); Pipeline = options.Build(credential); Version = options.Version; - - Protocol = new ServiceRestClient( - ClientDiagnostics, - Pipeline, - Endpoint.ToString(), - Version.ToVersionString()); } /// @@ -172,22 +184,27 @@ public virtual SearchIndexClient GetSearchIndexClient(string indexName) Version); } + #region Service operations /// - /// Gets service level statistics for a Search Service. - /// + /// + /// Gets service level statistics for a Search service. + /// + /// /// This operation returns the number and type of objects in your /// service, the maximum allowed for each object type given the service /// tier, actual and maximum storage, and other limits that vary by /// tier. This request pulls information from the service so that you /// don't have to look up or calculate service limits. - /// + /// + /// /// Statistics on document count and storage size are collected every /// few minutes, not in real time. Therefore, the statistics returned /// by this API may not reflect changes caused by recent indexing /// operations. + /// /// /// - /// Options to customize the operation's behavior. + /// Optional to customize the operation's behavior. /// /// /// Optional to propagate notifications @@ -195,32 +212,36 @@ public virtual SearchIndexClient GetSearchIndexClient(string indexName) /// /// The service level statistics. /// - /// Thrown when a failure is returned by the Search Service. + /// Thrown when a failure is returned by the Search service. /// [ForwardsClientCalls] - public virtual Response GetStatistics( + public virtual Response GetServiceStatistics( SearchRequestOptions options = null, CancellationToken cancellationToken = default) => - Protocol.GetServiceStatistics( + ServiceClient.GetServiceStatistics( options?.ClientRequestId, cancellationToken); /// - /// Gets service level statistics for a Search Service. - /// + /// + /// Gets service level statistics for a Search service. + /// + /// /// This operation returns the number and type of objects in your /// service, the maximum allowed for each object type given the service /// tier, actual and maximum storage, and other limits that vary by /// tier. This request pulls information from the service so that you /// don't have to look up or calculate service limits. - /// + /// + /// /// Statistics on document count and storage size are collected every /// few minutes, not in real time. Therefore, the statistics returned /// by this API may not reflect changes caused by recent indexing /// operations. + /// /// /// - /// Options to customize the operation's behavior. + /// Optional to customize the operation's behavior. /// /// /// Optional to propagate notifications @@ -228,15 +249,83 @@ public virtual Response GetStatistics( /// /// The service level statistics. /// - /// Thrown when a failure is returned by the Search Service. + /// Thrown when a failure is returned by the Search service. + /// + [ForwardsClientCalls] + public virtual async Task> GetServiceStatisticsAsync( + SearchRequestOptions options = null, + CancellationToken cancellationToken = default) => + await ServiceClient.GetServiceStatisticsAsync( + options?.ClientRequestId, + cancellationToken) + .ConfigureAwait(false); + #endregion + + /// + /// Creates a new search index in the Search service. + /// + /// + /// The to create. + /// + /// + /// Optional to customize the operation's behavior. + /// + /// + /// Optional to propagate notifications + /// that the operation should be canceled. + /// + /// + /// The that was created. + /// + /// + /// is null. + /// + /// + /// Thrown when a failure is returned by the Search service. + /// + #region Index operations + [ForwardsClientCalls] + public virtual Response CreateIndex( + SearchIndex index, + SearchRequestOptions options = null, + CancellationToken cancellationToken = default) => + IndexesClient.Create( + options?.ClientRequestId, + index, + cancellationToken); + + /// + /// Creates a new search index in the Search service. + /// + /// + /// The to create. + /// + /// + /// Optional to customize the operation's behavior. + /// + /// + /// Optional to propagate notifications + /// that the operation should be canceled. + /// + /// + /// The that was created. + /// + /// + /// is null. + /// + /// + /// Thrown when a failure is returned by the Search service. /// [ForwardsClientCalls] - public virtual async Task> GetStatisticsAsync( + public virtual async Task> CreateIndexAsync( + SearchIndex index, SearchRequestOptions options = null, CancellationToken cancellationToken = default) => - await Protocol.GetServiceStatisticsAsync( + await IndexesClient.CreateAsync( options?.ClientRequestId, + index, cancellationToken) .ConfigureAwait(false); + #endregion } } diff --git a/sdk/search/Azure.Search.Documents/src/swagger/searchservice.json b/sdk/search/Azure.Search.Documents/src/swagger/searchservice.json index 74a006942dc26..e205a9f1b575e 100644 --- a/sdk/search/Azure.Search.Documents/src/swagger/searchservice.json +++ b/sdk/search/Azure.Search.Documents/src/swagger/searchservice.json @@ -1800,7 +1800,474 @@ ], "x-ms-enum": { "name": "AnalyzerName", - "modelAsString": true + "modelAsString": true, + "values": [ + { + "value": "ar.microsoft", + "name": "ArMicrosoft", + "description": "Microsoft analyzer for Arabic." + }, + { + "value": "ar.lucene", + "name": "ArLucene", + "description": "Lucene analyzer for Arabic." + }, + { + "value": "hy.lucene", + "name": "HyLucene", + "description": "Lucene analyzer for Armenian." + }, + { + "value": "bn.microsoft", + "name": "BnMicrosoft", + "description": "Microsoft analyzer for Bangla." + }, + { + "value": "eu.lucene", + "name": "EuLucene", + "description": "Lucene analyzer for Basque." + }, + { + "value": "bg.microsoft", + "name": "BgMicrosoft", + "description": "Microsoft analyzer for Bulgarian." + }, + { + "value": "bg.lucene", + "name": "BgLucene", + "description": "Lucene analyzer for Bulgarian." + }, + { + "value": "ca.microsoft", + "name": "CaMicrosoft", + "description": "Microsoft analyzer for Catalan." + }, + { + "value": "ca.lucene", + "name": "CaLucene", + "description": "Lucene analyzer for Catalan." + }, + { + "value": "zh-Hans.microsoft", + "name": "ZhHansMicrosoft", + "description": "Microsoft analyzer for Chinese (Simplified)." + }, + { + "value": "zh-Hans.lucene", + "name": "ZhHansLucene", + "description": "Lucene analyzer for Chinese (Simplified)." + }, + { + "value": "zh-Hant.microsoft", + "name": "ZhHantMicrosoft", + "description": "Microsoft analyzer for Chinese (Traditional)." + }, + { + "value": "zh-Hant.lucene", + "name": "ZhHantLucene", + "description": "Lucene analyzer for Chinese (Traditional)." + }, + { + "value": "hr.microsoft", + "name": "HrMicrosoft", + "description": "Microsoft analyzer for Croatian." + }, + { + "value": "cs.microsoft", + "name": "CsMicrosoft", + "description": "Microsoft analyzer for Czech." + }, + { + "value": "cs.lucene", + "name": "CsLucene", + "description": "Lucene analyzer for Czech." + }, + { + "value": "da.microsoft", + "name": "DaMicrosoft", + "description": "Microsoft analyzer for Danish." + }, + { + "value": "da.lucene", + "name": "DaLucene", + "description": "Lucene analyzer for Danish." + }, + { + "value": "nl.microsoft", + "name": "NlMicrosoft", + "description": "Microsoft analyzer for Dutch." + }, + { + "value": "nl.lucene", + "name": "NlLucene", + "description": "Lucene analyzer for Dutch." + }, + { + "value": "en.microsoft", + "name": "EnMicrosoft", + "description": "Microsoft analyzer for English." + }, + { + "value": "en.lucene", + "name": "EnLucene", + "description": "Lucene analyzer for English." + }, + { + "value": "et.microsoft", + "name": "EtMicrosoft", + "description": "Microsoft analyzer for Estonian." + }, + { + "value": "fi.microsoft", + "name": "FiMicrosoft", + "description": "Microsoft analyzer for Finnish." + }, + { + "value": "fi.lucene", + "name": "FiLucene", + "description": "Lucene analyzer for Finnish." + }, + { + "value": "fr.microsoft", + "name": "FrMicrosoft", + "description": "Microsoft analyzer for French." + }, + { + "value": "fr.lucene", + "name": "FrLucene", + "description": "Lucene analyzer for French." + }, + { + "value": "gl.lucene", + "name": "GlLucene", + "description": "Lucene analyzer for Galician." + }, + { + "value": "de.microsoft", + "name": "DeMicrosoft", + "description": "Microsoft analyzer for German." + }, + { + "value": "de.lucene", + "name": "DeLucene", + "description": "Lucene analyzer for German." + }, + { + "value": "el.microsoft", + "name": "ElMicrosoft", + "description": "Microsoft analyzer for Greek." + }, + { + "value": "el.lucene", + "name": "ElLucene", + "description": "Lucene analyzer for Greek." + }, + { + "value": "gu.microsoft", + "name": "GuMicrosoft", + "description": "Microsoft analyzer for Gujarati." + }, + { + "value": "he.microsoft", + "name": "HeMicrosoft", + "description": "Microsoft analyzer for Hebrew." + }, + { + "value": "hi.microsoft", + "name": "HiMicrosoft", + "description": "Microsoft analyzer for Hindi." + }, + { + "value": "hi.lucene", + "name": "HiLucene", + "description": "Lucene analyzer for Hindi." + }, + { + "value": "hu.microsoft", + "name": "HuMicrosoft", + "description": "Microsoft analyzer for Hungarian." + }, + { + "value": "hu.lucene", + "name": "HuLucene", + "description": "Lucene analyzer for Hungarian." + }, + { + "value": "is.microsoft", + "name": "IsMicrosoft", + "description": "Microsoft analyzer for Icelandic." + }, + { + "value": "id.microsoft", + "name": "IdMicrosoft", + "description": "Microsoft analyzer for Indonesian (Bahasa)." + }, + { + "value": "id.lucene", + "name": "IdLucene", + "description": "Lucene analyzer for Indonesian." + }, + { + "value": "ga.lucene", + "name": "GaLucene", + "description": "Lucene analyzer for Irish." + }, + { + "value": "it.microsoft", + "name": "ItMicrosoft", + "description": "Microsoft analyzer for Italian." + }, + { + "value": "it.lucene", + "name": "ItLucene", + "description": "Lucene analyzer for Italian." + }, + { + "value": "ja.microsoft", + "name": "JaMicrosoft", + "description": "Microsoft analyzer for Japanese." + }, + { + "value": "ja.lucene", + "name": "JaLucene", + "description": "Lucene analyzer for Japanese." + }, + { + "value": "kn.microsoft", + "name": "KnMicrosoft", + "description": "Microsoft analyzer for Kannada." + }, + { + "value": "ko.microsoft", + "name": "KoMicrosoft", + "description": "Microsoft analyzer for Korean." + }, + { + "value": "ko.lucene", + "name": "KoLucene", + "description": "Lucene analyzer for Korean." + }, + { + "value": "lv.microsoft", + "name": "LvMicrosoft", + "description": "Microsoft analyzer for Latvian." + }, + { + "value": "lv.lucene", + "name": "LvLucene", + "description": "Lucene analyzer for Latvian." + }, + { + "value": "lt.microsoft", + "name": "LtMicrosoft", + "description": "Microsoft analyzer for Lithuanian." + }, + { + "value": "ml.microsoft", + "name": "MlMicrosoft", + "description": "Microsoft analyzer for Malayalam." + }, + { + "value": "ms.microsoft", + "name": "MsMicrosoft", + "description": "Microsoft analyzer for Malay (Latin)." + }, + { + "value": "mr.microsoft", + "name": "MrMicrosoft", + "description": "Microsoft analyzer for Marathi." + }, + { + "value": "nb.microsoft", + "name": "NbMicrosoft", + "description": "Microsoft analyzer for Norwegian (Bokmål)." + }, + { + "value": "no.lucene", + "name": "NoLucene", + "description": "Lucene analyzer for Norwegian." + }, + { + "value": "fa.lucene", + "name": "FaLucene", + "description": "Lucene analyzer for Persian." + }, + { + "value": "pl.microsoft", + "name": "PlMicrosoft", + "description": "Microsoft analyzer for Polish." + }, + { + "value": "pl.lucene", + "name": "PlLucene", + "description": "Lucene analyzer for Polish." + }, + { + "value": "pt-BR.microsoft", + "name": "PtBrMicrosoft", + "description": "Microsoft analyzer for Portuguese (Brazil)." + }, + { + "value": "pt-BR.lucene", + "name": "PtBrLucene", + "description": "Lucene analyzer for Portuguese (Brazil)." + }, + { + "value": "pt-PT.microsoft", + "name": "PtPtMicrosoft", + "description": "Microsoft analyzer for Portuguese (Portugal)." + }, + { + "value": "pt-PT.lucene", + "name": "PtPtLucene", + "description": "Lucene analyzer for Portuguese (Portugal)." + }, + { + "value": "pa.microsoft", + "name": "PaMicrosoft", + "description": "Microsoft analyzer for Punjabi." + }, + { + "value": "ro.microsoft", + "name": "RoMicrosoft", + "description": "Microsoft analyzer for Romanian." + }, + { + "value": "ro.lucene", + "name": "RoLucene", + "description": "Lucene analyzer for Romanian." + }, + { + "value": "ru.microsoft", + "name": "RuMicrosoft", + "description": "Microsoft analyzer for Russian." + }, + { + "value": "ru.lucene", + "name": "RuLucene", + "description": "Lucene analyzer for Russian." + }, + { + "value": "sr-cyrillic.microsoft", + "name": "SrCyrillicMicrosoft", + "description": "Microsoft analyzer for Serbian (Cyrillic)." + }, + { + "value": "sr-latin.microsoft", + "name": "SrLatinMicrosoft", + "description": "Microsoft analyzer for Serbian (Latin)." + }, + { + "value": "sk.microsoft", + "name": "SkMicrosoft", + "description": "Microsoft analyzer for Slovak." + }, + { + "value": "sl.microsoft", + "name": "SlMicrosoft", + "description": "Microsoft analyzer for Slovenian." + }, + { + "value": "es.microsoft", + "name": "EsMicrosoft", + "description": "Microsoft analyzer for Spanish." + }, + { + "value": "es.lucene", + "name": "EsLucene", + "description": "Lucene analyzer for Spanish." + }, + { + "value": "sv.microsoft", + "name": "SvMicrosoft", + "description": "Microsoft analyzer for Swedish." + }, + { + "value": "sv.lucene", + "name": "SvLucene", + "description": "Lucene analyzer for Swedish." + }, + { + "value": "ta.microsoft", + "name": "TaMicrosoft", + "description": "Microsoft analyzer for Tamil." + }, + { + "value": "te.microsoft", + "name": "TeMicrosoft", + "description": "Microsoft analyzer for Telugu." + }, + { + "value": "th.microsoft", + "name": "ThMicrosoft", + "description": "Microsoft analyzer for Thai." + }, + { + "value": "th.lucene", + "name": "ThLucene", + "description": "Lucene analyzer for Thai." + }, + { + "value": "tr.microsoft", + "name": "TrMicrosoft", + "description": "Microsoft analyzer for Turkish." + }, + { + "value": "tr.lucene", + "name": "TrLucene", + "description": "Lucene analyzer for Turkish." + }, + { + "value": "uk.microsoft", + "name": "UkMicrosoft", + "description": "Microsoft analyzer for Ukrainian." + }, + { + "value": "ur.microsoft", + "name": "UrMicrosoft", + "description": "Microsoft analyzer for Urdu." + }, + { + "value": "vi.microsoft", + "name": "ViMicrosoft", + "description": "Microsoft analyzer for Vietnamese." + }, + { + "value": "standard.lucene", + "name": "StandardLucene", + "description": "Standard Lucene analyzer." + }, + { + "value": "standardasciifolding.lucene", + "name": "StandardAsciiFoldingLucene", + "description": "Standard ASCII Folding Lucene analyzer. See https://docs.microsoft.com/rest/api/searchservice/Custom-analyzers-in-Azure-Search#Analyzers" + }, + { + "value": "keyword", + "name": "Keyword", + "description": "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" + }, + { + "value": "pattern", + "name": "Pattern", + "description": "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" + }, + { + "value": "simple", + "name": "Simple", + "description": "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" + }, + { + "value": "stop", + "name": "Stop", + "description": "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" + }, + { + "value": "whitespace", + "name": "Whitespace", + "description": "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" + } + ] }, "description": "Defines the names of all text analyzers supported by Azure Cognitive Search.", "externalDocs": { @@ -2183,7 +2650,8 @@ "discriminator": "@odata.type", "properties": { "@odata.type": { - "type": "string" + "type": "string", + "description": "Identifies the concrete type of the analyzer." }, "name": { "type": "string", @@ -2197,7 +2665,7 @@ "@odata.type", "name" ], - "description": "Abstract base class for analyzers." + "description": "Base type for analyzers." }, "CustomAnalyzer": { "x-ms-discriminator-value": "#Microsoft.Azure.Search.CustomAnalyzer", @@ -2322,7 +2790,8 @@ "discriminator": "@odata.type", "properties": { "@odata.type": { - "type": "string" + "type": "string", + "description": "Identifies the concrete type of the tokenizer." }, "name": { "type": "string", @@ -2336,7 +2805,7 @@ "@odata.type", "name" ], - "description": "Abstract base class for tokenizers.", + "description": "Base type for tokenizers.", "externalDocs": { "url": "https://docs.microsoft.com/rest/api/searchservice/Custom-analyzers-in-Azure-Search" } @@ -2794,7 +3263,8 @@ "discriminator": "@odata.type", "properties": { "@odata.type": { - "type": "string" + "type": "string", + "description": "Identifies the concrete type of the token filter." }, "name": { "type": "string", @@ -2808,7 +3278,7 @@ "@odata.type", "name" ], - "description": "Abstract base class for token filters.", + "description": "Base type for token filters.", "externalDocs": { "url": "https://docs.microsoft.com/rest/api/searchservice/Custom-analyzers-in-Azure-Search" } @@ -3756,7 +4226,8 @@ "discriminator": "@odata.type", "properties": { "@odata.type": { - "type": "string" + "type": "string", + "description": "Identifies the concrete type of the char filter." }, "name": { "type": "string", @@ -3770,7 +4241,7 @@ "@odata.type", "name" ], - "description": "Abstract base class for character filters.", + "description": "Base type for character filters.", "externalDocs": { "url": "https://docs.microsoft.com/rest/api/searchservice/Custom-analyzers-in-Azure-Search" } @@ -3857,13 +4328,14 @@ "discriminator": "@odata.type", "properties": { "@odata.type": { - "type": "string" + "type": "string", + "description": "Identifies the concrete type of the data change detection policy." } }, "required": [ "@odata.type" ], - "description": "Abstract base class for data change detection policies." + "description": "Base type for data change detection policies." }, "HighWaterMarkChangeDetectionPolicy": { "description": "Defines a data change detection policy that captures changes based on the value of a high water mark column.", @@ -3896,13 +4368,14 @@ "discriminator": "@odata.type", "properties": { "@odata.type": { - "type": "string" + "type": "string", + "description": "Identifies the concrete type of the data deletion detection policy." } }, "required": [ "@odata.type" ], - "description": "Abstract base class for data deletion detection policies." + "description": "Base type for data deletion detection policies." }, "SoftDeleteColumnDeletionDetectionPolicy": { "description": "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.", @@ -4487,21 +4960,21 @@ "url": "https://docs.microsoft.com/rest/api/searchservice/Language-support" }, "$ref": "#/definitions/AnalyzerName", - "description": "The name of the language 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." + "description": "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." }, "searchAnalyzer": { "externalDocs": { "url": "https://docs.microsoft.com/rest/api/searchservice/Language-support" }, "$ref": "#/definitions/AnalyzerName", - "description": "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 analyzer can be updated on an existing field. Must be null for complex fields." + "description": "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." }, "indexAnalyzer": { "externalDocs": { "url": "https://docs.microsoft.com/rest/api/searchservice/Language-support" }, "$ref": "#/definitions/AnalyzerName", - "description": "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. Once the analyzer is chosen, it cannot be changed for the field. Must be null for complex fields." + "description": "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." }, "synonymMaps": { "externalDocs": { @@ -4551,7 +5024,8 @@ "discriminator": "type", "properties": { "type": { - "type": "string" + "type": "string", + "description": "Indicates the type of function to use. Valid values include magnitude, freshness, distance, and tag. The function type must be lower case." }, "fieldName": { "type": "string", @@ -4575,7 +5049,7 @@ "externalDocs": { "url": "https://docs.microsoft.com/rest/api/searchservice/Add-scoring-profiles-to-a-search-index" }, - "description": "Abstract base class for functions that can modify document scores during ranking." + "description": "Base type for functions that can modify document scores during ranking." }, "DistanceScoringFunction": { "x-ms-discriminator-value": "distance", @@ -5029,16 +5503,18 @@ "discriminator": "@odata.type", "properties": { "@odata.type": { - "type": "string" + "type": "string", + "description": "Identifies the concrete type of the cognitive service resource attached to a skillset." }, "description": { - "type": "string" + "type": "string", + "description": "Description of the cognitive service resource attached to a skillset." } }, "required": [ "@odata.type" ], - "description": "Abstract base class for describing any cognitive service resource attached to the skillset." + "description": "Base type for describing any cognitive service resource attached to a skillset." }, "DefaultCognitiveServicesAccount": { "description": "An empty object that represents the default cognitive service resource for a skillset.", @@ -5059,7 +5535,8 @@ ], "properties": { "key": { - "type": "string" + "type": "string", + "description": "The key used to provision the cognitive service resource attached to a skillset." } }, "required": [ @@ -5070,7 +5547,8 @@ "discriminator": "@odata.type", "properties": { "@odata.type": { - "type": "string" + "type": "string", + "description": "Identifies the concrete type of the skill." }, "name": { "type": "string", @@ -5107,7 +5585,7 @@ "externalDocs": { "url": "https://docs.microsoft.com/azure/search/cognitive-search-predefined-skills" }, - "description": "Abstract base class for skills." + "description": "Base type for skills." }, "InputFieldMappingEntry": { "properties": { diff --git a/sdk/search/Azure.Search.Documents/tests/Samples/HelloWorld.cs b/sdk/search/Azure.Search.Documents/tests/Samples/HelloWorld.cs index d2154eac01165..50dc122420e5a 100644 --- a/sdk/search/Azure.Search.Documents/tests/Samples/HelloWorld.cs +++ b/sdk/search/Azure.Search.Documents/tests/Samples/HelloWorld.cs @@ -37,7 +37,7 @@ public async Task CreateClient() // Perform an operation //@@ Response stats = search.GetStatistics(); - /*@@*/ Response stats = await search.GetStatisticsAsync(); + /*@@*/ Response stats = await search.GetServiceStatisticsAsync(); Console.WriteLine($"You are using {stats.Value.Counters.IndexCounter.Usage} indexes."); #endregion Snippet:Azure_Search_Tests_Samples_CreateClient @@ -62,7 +62,7 @@ public async Task CreateClientAsync() /*@@*/ search = InstrumentClient(new SearchServiceClient(endpoint, credential, GetSearchClientOptions())); // Perform an operation - Response stats = await search.GetStatisticsAsync(); + Response stats = await search.GetServiceStatisticsAsync(); Console.WriteLine($"You are using {stats.Value.Counters.IndexCounter.Usage} indexes."); #endregion Snippet:Azure_Search_Tests_Samples_CreateClientAsync @@ -140,7 +140,7 @@ public async Task GetStatisticsAsync() /*@@*/ search = InstrumentClient(new SearchServiceClient(endpoint, credential, GetSearchClientOptions())); // Get and report the Search Service statistics - Response stats = await search.GetStatisticsAsync(); + Response stats = await search.GetServiceStatisticsAsync(); Console.WriteLine($"You are using {stats.Value.Counters.IndexCounter.Usage} of {stats.Value.Counters.IndexCounter.Quota} indexes."); #endregion Snippet:Azure_Search_Tests_Samples_GetStatisticsAsync } diff --git a/sdk/search/Azure.Search.Documents/tests/SearchServiceClientTests.cs b/sdk/search/Azure.Search.Documents/tests/SearchServiceClientTests.cs index 09bb9d8382a53..2625b9b7ec02f 100644 --- a/sdk/search/Azure.Search.Documents/tests/SearchServiceClientTests.cs +++ b/sdk/search/Azure.Search.Documents/tests/SearchServiceClientTests.cs @@ -94,7 +94,7 @@ public async Task ClientRequestIdRountrips() SearchServiceClient client = resources.GetServiceClient(); Guid id = Recording.Random.NewGuid(); Response response = - await client.GetStatisticsAsync( + await client.GetServiceStatisticsAsync( new SearchRequestOptions { ClientRequestId = id }); // TODO: #10604 - C# generator doesn't properly support ClientRequestId yet @@ -135,7 +135,7 @@ public async Task GetStatistics() await using SearchResources resources = await SearchResources.GetSharedHotelsIndexAsync(this); SearchServiceClient client = resources.GetServiceClient(); - Response < SearchServiceStatistics > response = await client.GetStatisticsAsync(); + Response < SearchServiceStatistics > response = await client.GetServiceStatisticsAsync(); Assert.AreEqual(200, response.GetRawResponse().Status); Assert.IsNotNull(response.Value); Assert.IsNotNull(response.Value.Counters); @@ -150,5 +150,17 @@ public async Task GetStatistics() Assert.NotZero(response.Value.Counters.IndexCounter.Quota ?? 0L); Assert.AreEqual(1, response.Value.Counters.IndexCounter.Usage); } + + //[Test] + //public async Task CreateIndexRequiresIndex() + //{ + // await using SearchResources resources = await SearchResources.GetSharedHotelsIndexAsync(this); + + // // TODO + // SearchIndex index = new SearchIndex(); + + // SearchServiceClient client = resources.GetServiceClient(); + // Response response = await client.CreateIndexAsync(index); + //} } }