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 956edf76bb97..85053204b7c9 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 @@ -1109,10 +1109,10 @@ public PathHierarchyTokenizerV2(string name) : base (default(string)) { } public partial class PatternAnalyzer : Azure.Search.Documents.Models.Analyzer { public PatternAnalyzer(string name) : base (default(string)) { } - public Azure.Search.Documents.Models.RegexFlags? Flags { get { throw null; } set { } } + public System.Collections.Generic.IList Flags { get { throw null; } } public bool? LowerCaseTerms { get { throw null; } set { } } public string Pattern { get { throw null; } set { } } - public System.Collections.Generic.IList Stopwords { get { throw null; } set { } } + public System.Collections.Generic.IList Stopwords { get { throw null; } } } public partial class PatternCaptureTokenFilter : Azure.Search.Documents.Models.TokenFilter { @@ -1135,7 +1135,7 @@ public PatternReplaceTokenFilter(string name, string pattern, string replacement public partial class PatternTokenizer : Azure.Search.Documents.Models.Tokenizer { public PatternTokenizer(string name) : base (default(string)) { } - public Azure.Search.Documents.Models.RegexFlags? Flags { get { throw null; } set { } } + public System.Collections.Generic.IList Flags { get { throw null; } } public int? Group { get { throw null; } set { } } public string Pattern { get { throw null; } set { } } } @@ -1268,18 +1268,18 @@ 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 { } } + public System.Collections.Generic.IList Analyzers { get { throw null; } } + public System.Collections.Generic.IList CharFilters { get { throw null; } } public Azure.Search.Documents.Models.CorsOptions CorsOptions { get { throw null; } set { } } public string DefaultScoringProfile { get { throw null; } set { } } public Azure.Search.Documents.Models.EncryptionKey EncryptionKey { get { throw null; } set { } } public string ETag { get { throw null; } set { } } public System.Collections.Generic.IList Fields { get { throw null; } } public string Name { get { throw null; } } - public System.Collections.Generic.IList ScoringProfiles { get { throw null; } set { } } - public System.Collections.Generic.IList Suggesters { get { throw null; } set { } } - public System.Collections.Generic.IList TokenFilters { get { throw null; } set { } } - public System.Collections.Generic.IList Tokenizers { get { throw null; } set { } } + public System.Collections.Generic.IList ScoringProfiles { get { throw null; } } + public System.Collections.Generic.IList Suggesters { get { throw null; } } + public System.Collections.Generic.IList TokenFilters { get { throw null; } } + public System.Collections.Generic.IList Tokenizers { get { throw null; } } } public partial class SearchIndexer { diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/PatternAnalyzer.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/PatternAnalyzer.Serialization.cs index b26d47376b64..c7b7863edef6 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/PatternAnalyzer.Serialization.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/PatternAnalyzer.Serialization.cs @@ -6,6 +6,7 @@ #nullable disable using System.Collections.Generic; +using System.Linq; using System.Text.Json; using Azure.Core; @@ -26,12 +27,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("pattern"); writer.WriteStringValue(Pattern); } - if (Flags != null) + if (FlagsInternal != null) { writer.WritePropertyName("flags"); - writer.WriteStringValue(Flags.Value.ToString()); + writer.WriteStringValue(FlagsInternal); } - if (Stopwords != null) + if (Stopwords != null && Stopwords.Any()) { writer.WritePropertyName("stopwords"); writer.WriteStartArray(); @@ -52,7 +53,7 @@ internal static PatternAnalyzer DeserializePatternAnalyzer(JsonElement element) { bool? lowercase = default; string pattern = default; - RegexFlags? flags = default; + string flags = default; IList stopwords = default; string odataType = default; string name = default; @@ -82,7 +83,7 @@ internal static PatternAnalyzer DeserializePatternAnalyzer(JsonElement element) { continue; } - flags = new RegexFlags(property.Value.GetString()); + flags = property.Value.GetString(); continue; } if (property.NameEquals("stopwords")) diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/PatternAnalyzer.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/PatternAnalyzer.cs index e35dec13ab5f..057cd8f49bda 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/PatternAnalyzer.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/PatternAnalyzer.cs @@ -22,6 +22,7 @@ public PatternAnalyzer(string name) : base(name) throw new ArgumentNullException(nameof(name)); } + Stopwords = new List(); ODataType = "#Microsoft.Azure.Search.PatternAnalyzer"; } @@ -30,14 +31,14 @@ public PatternAnalyzer(string name) : base(name) /// The name of the analyzer. It must only contain letters, digits, spaces, dashes or underscores, can only start and end with alphanumeric characters, and is limited to 128 characters. /// A value indicating whether terms should be lower-cased. Default is true. /// A regular expression pattern to match token separators. Default is an expression that matches one or more whitespace characters. - /// Regular expression flags. + /// Regular expression flags. /// A list of stopwords. - internal PatternAnalyzer(string oDataType, string name, bool? lowerCaseTerms, string pattern, RegexFlags? flags, IList stopwords) : base(oDataType, name) + internal PatternAnalyzer(string oDataType, string name, bool? lowerCaseTerms, string pattern, string flagsInternal, IList stopwords) : base(oDataType, name) { LowerCaseTerms = lowerCaseTerms; Pattern = pattern; - Flags = flags; - Stopwords = stopwords; + FlagsInternal = flagsInternal; + Stopwords = stopwords ?? new List(); ODataType = oDataType ?? "#Microsoft.Azure.Search.PatternAnalyzer"; } @@ -45,9 +46,5 @@ internal PatternAnalyzer(string oDataType, string name, bool? lowerCaseTerms, st public bool? LowerCaseTerms { get; set; } /// A regular expression pattern to match token separators. Default is an expression that matches one or more whitespace characters. public string Pattern { get; set; } - /// Regular expression flags. - public RegexFlags? Flags { get; set; } - /// A list of stopwords. - public IList Stopwords { get; set; } } } diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/PatternTokenizer.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/PatternTokenizer.Serialization.cs index f4bc80a6e04f..101b131e7ed7 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/PatternTokenizer.Serialization.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/PatternTokenizer.Serialization.cs @@ -20,10 +20,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("pattern"); writer.WriteStringValue(Pattern); } - if (Flags != null) + if (FlagsInternal != null) { writer.WritePropertyName("flags"); - writer.WriteStringValue(Flags.Value.ToString()); + writer.WriteStringValue(FlagsInternal); } if (Group != null) { @@ -40,7 +40,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static PatternTokenizer DeserializePatternTokenizer(JsonElement element) { string pattern = default; - RegexFlags? flags = default; + string flags = default; int? group = default; string odataType = default; string name = default; @@ -61,7 +61,7 @@ internal static PatternTokenizer DeserializePatternTokenizer(JsonElement element { continue; } - flags = new RegexFlags(property.Value.GetString()); + flags = property.Value.GetString(); continue; } if (property.NameEquals("group")) diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/PatternTokenizer.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/PatternTokenizer.cs index 90cbbe677e27..85c99aae68a5 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/PatternTokenizer.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/PatternTokenizer.cs @@ -28,20 +28,18 @@ public PatternTokenizer(string name) : base(name) /// Identifies the concrete type of the tokenizer. /// The name of the tokenizer. It must only contain letters, digits, spaces, dashes or underscores, can only start and end with alphanumeric characters, and is limited to 128 characters. /// A regular expression pattern to match token separators. Default is an expression that matches one or more whitespace characters. - /// Regular expression flags. + /// Regular expression flags. /// The zero-based ordinal of the matching group in the regular expression pattern to extract into tokens. Use -1 if you want to use the entire pattern to split the input into tokens, irrespective of matching groups. Default is -1. - internal PatternTokenizer(string oDataType, string name, string pattern, RegexFlags? flags, int? group) : base(oDataType, name) + internal PatternTokenizer(string oDataType, string name, string pattern, string flagsInternal, int? group) : base(oDataType, name) { Pattern = pattern; - Flags = flags; + FlagsInternal = flagsInternal; Group = group; ODataType = oDataType ?? "#Microsoft.Azure.Search.PatternTokenizer"; } /// A regular expression pattern to match token separators. Default is an expression that matches one or more whitespace characters. public string Pattern { get; set; } - /// Regular expression flags. - public RegexFlags? Flags { get; set; } /// The zero-based ordinal of the matching group in the regular expression pattern to extract into tokens. Use -1 if you want to use the entire pattern to split the input into tokens, irrespective of matching groups. Default is -1. public int? Group { get; set; } } diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndex.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndex.Serialization.cs index e6ce33d4fc1d..a79dfe45079b 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndex.Serialization.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndex.Serialization.cs @@ -6,6 +6,7 @@ #nullable disable using System.Collections.Generic; +using System.Linq; using System.Text.Json; using Azure.Core; @@ -21,7 +22,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - if (Fields != null) + if (Fields != null && Fields.Any()) { writer.WritePropertyName("fields"); writer.WriteStartArray(); @@ -31,7 +32,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } - if (ScoringProfiles != null) + if (ScoringProfiles != null && ScoringProfiles.Any()) { writer.WritePropertyName("scoringProfiles"); writer.WriteStartArray(); @@ -51,7 +52,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("corsOptions"); writer.WriteObjectValue(CorsOptions); } - if (Suggesters != null) + if (Suggesters != null && Suggesters.Any()) { writer.WritePropertyName("suggesters"); writer.WriteStartArray(); @@ -61,7 +62,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } - if (Analyzers != null) + if (Analyzers != null && Analyzers.Any()) { writer.WritePropertyName("analyzers"); writer.WriteStartArray(); @@ -71,7 +72,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } - if (Tokenizers != null) + if (Tokenizers != null && Tokenizers.Any()) { writer.WritePropertyName("tokenizers"); writer.WriteStartArray(); @@ -81,7 +82,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } - if (TokenFilters != null) + if (TokenFilters != null && TokenFilters.Any()) { writer.WritePropertyName("tokenFilters"); writer.WriteStartArray(); @@ -91,7 +92,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } - if (CharFilters != null) + if (CharFilters != null && CharFilters.Any()) { writer.WritePropertyName("charFilters"); writer.WriteStartArray(); 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 b076e723c1c6..38306f7bac03 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndex.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndex.cs @@ -31,34 +31,22 @@ public partial class SearchIndex internal SearchIndex(string name, IList fields, IList scoringProfiles, string defaultScoringProfile, CorsOptions corsOptions, IList suggesters, IList analyzers, IList tokenizers, IList tokenFilters, IList charFilters, EncryptionKey encryptionKey, string eTag) { Name = name; - Fields = fields; - ScoringProfiles = scoringProfiles; + Fields = fields ?? new List(); + ScoringProfiles = scoringProfiles ?? new List(); DefaultScoringProfile = defaultScoringProfile; CorsOptions = corsOptions; - Suggesters = suggesters; - Analyzers = analyzers; - Tokenizers = tokenizers; - TokenFilters = tokenFilters; - CharFilters = charFilters; + Suggesters = suggesters ?? new List(); + Analyzers = analyzers ?? new List(); + Tokenizers = tokenizers ?? new List(); + TokenFilters = tokenFilters ?? new List(); + CharFilters = charFilters ?? new List(); EncryptionKey = encryptionKey; ETag = eTag; } - /// 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. public string DefaultScoringProfile { get; set; } /// Options to control Cross-Origin Resource Sharing (CORS) for the index. public CorsOptions CorsOptions { get; set; } - /// The suggesters for the index. - public IList Suggesters { get; set; } - /// The analyzers for the index. - public IList Analyzers { get; set; } - /// The tokenizers for the index. - public IList Tokenizers { get; set; } - /// The token filters for the index. - public IList TokenFilters { get; set; } - /// The character filters for the index. - public IList CharFilters { get; set; } /// 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 index. diff --git a/sdk/search/Azure.Search.Documents/src/Models/PatternAnalyzer.cs b/sdk/search/Azure.Search.Documents/src/Models/PatternAnalyzer.cs new file mode 100644 index 000000000000..e56c0d97ef12 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Models/PatternAnalyzer.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Search.Documents.Models +{ + public partial class PatternAnalyzer + { + [CodeGenMember("flags")] + private string FlagsInternal + { + get => string.Join("|", Flags); + set + { + Flags.Clear(); + + if (!string.IsNullOrEmpty(value)) + { + string[] values = value.Split('|'); + for (int i = 0; i < values.Length; ++i) + { + Flags.Add(new RegexFlags(values[i])); + } + } + } + } + + /// + /// Gets regular expression flags for . + /// + public IList Flags { get; } = new List(); + + /// + /// Gets a list of stopwords. + /// + [CodeGenMember(Initialize = true, EmptyAsUndefined = true)] + public IList Stopwords { get; } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Models/PatternTokenizer.cs b/sdk/search/Azure.Search.Documents/src/Models/PatternTokenizer.cs new file mode 100644 index 000000000000..3ecb1e9644c3 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Models/PatternTokenizer.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Search.Documents.Models +{ + public partial class PatternTokenizer + { + [CodeGenMember("flags")] + private string FlagsInternal + { + get => string.Join("|", Flags); + set + { + Flags.Clear(); + + if (!string.IsNullOrEmpty(value)) + { + string[] values = value.Split('|'); + for (int i = 0; i < values.Length; ++i) + { + Flags.Add(new RegexFlags(values[i])); + } + } + } + } + + /// + /// Regular expression flags for . + /// + public IList Flags { get; } = new List(); + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Models/SearchIndex.cs b/sdk/search/Azure.Search.Documents/src/Models/SearchIndex.cs index 045ed53dd1a0..b3b2db44bf09 100644 --- a/sdk/search/Azure.Search.Documents/src/Models/SearchIndex.cs +++ b/sdk/search/Azure.Search.Documents/src/Models/SearchIndex.cs @@ -10,8 +10,6 @@ namespace Azure.Search.Documents.Models [CodeGenModel("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. /// @@ -26,7 +24,13 @@ public SearchIndex(string name) Name = name; - _fields = new List(); + Analyzers = new List(); + CharFilters = new List(); + Fields = new List(); + ScoringProfiles = new List(); + Suggesters = new List(); + TokenFilters = new List(); + Tokenizers = new List(); } /// @@ -36,17 +40,20 @@ public SearchIndex(string name) /// Fields to add to the index. /// is an empty string. /// or is null. - public SearchIndex(string name, IEnumerable fields) : this(name) + public SearchIndex(string name, IEnumerable fields) { + Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(fields, nameof(fields)); - // We define the field as List to take advantage of its faster AddRange. - _fields.AddRange(fields); - } + Name = name; - // TODO: Remove when https://github.com/Azure/autorest.csharp/issues/582 is fixed. - private SearchIndex() - { + Analyzers = new List(); + CharFilters = new List(); + Fields = new List(fields); + ScoringProfiles = new List(); + Suggesters = new List(); + TokenFilters = new List(); + Tokenizers = new List(); } /// @@ -55,20 +62,48 @@ private SearchIndex() [CodeGenMember("name")] public string Name { get; } - // TODO: Remove read-only collection properties when https://github.com/Azure/autorest.csharp/issues/521 is fixed. + /// + /// Gets the analyzers for the index. + /// + [CodeGenMember(Initialize = true, EmptyAsUndefined = true)] + public IList Analyzers { get; } + + /// + /// Gets the character filters for the index. + /// + [CodeGenMember(Initialize = true, EmptyAsUndefined = true)] + public IList CharFilters { get; } /// /// 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. /// - [CodeGenMember("fields")] - public IList Fields - { - get => _fields; + [CodeGenMember(Initialize = true, EmptyAsUndefined = true)] + public IList Fields { get; } - // Make a shallow copy of the fields. - internal set => _fields = new List(value ?? throw new ArgumentNullException(nameof(value))); - } + /// + /// Gets the scoring profiles for the index. + /// + [CodeGenMember(Initialize = true, EmptyAsUndefined = true)] + public IList ScoringProfiles { get; } + + /// + /// Gets the suggesters for the index. + /// + [CodeGenMember(Initialize = true, EmptyAsUndefined = true)] + public IList Suggesters { get; } + + /// + /// Gets the token filters for the index. + /// + [CodeGenMember(Initialize = true, EmptyAsUndefined = true)] + public IList TokenFilters { get; } + + /// + /// Gets the tokenizers for the index. + /// + [CodeGenMember(Initialize = true, EmptyAsUndefined = true)] + public IList Tokenizers { get; } } } diff --git a/sdk/search/Azure.Search.Documents/src/SearchClientOptions.cs b/sdk/search/Azure.Search.Documents/src/SearchClientOptions.cs index 0172674a635f..70c0a2c98bd9 100644 --- a/sdk/search/Azure.Search.Documents/src/SearchClientOptions.cs +++ b/sdk/search/Azure.Search.Documents/src/SearchClientOptions.cs @@ -129,6 +129,7 @@ private void AddLoggingHeaders() private void AddLoggingQueryParameters() { Diagnostics.LoggedQueryParameters.Add("api-version"); + Diagnostics.LoggedQueryParameters.Add("allowIndexDowntime"); Diagnostics.LoggedQueryParameters.Add("$select"); } } diff --git a/sdk/search/Azure.Search.Documents/tests/Models/PatternAnalyzerTests.cs b/sdk/search/Azure.Search.Documents/tests/Models/PatternAnalyzerTests.cs new file mode 100644 index 000000000000..f5cbcabcde13 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/tests/Models/PatternAnalyzerTests.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using System.IO; +using System.Text.Json; +using Azure.Core; +using Azure.Search.Documents.Models; +using NUnit.Framework; + +namespace Azure.Search.Documents.Tests.Models +{ + public class PatternAnalyzerTests + { + [TestCaseSource(nameof(RoundtripsRegexFlagsData))] + public void RoundtripsRegexFlags(PatternAnalyzer expected) + { + using MemoryStream stream = new MemoryStream(); + using (Utf8JsonWriter writer = new Utf8JsonWriter(stream)) + { + ((IUtf8JsonSerializable)expected).Write(writer); + } + + using JsonDocument doc = JsonDocument.Parse(stream.ToArray()); + PatternAnalyzer actual = Analyzer.DeserializeAnalyzer(doc.RootElement) as PatternAnalyzer; + + CollectionAssert.AreEqual(expected.Flags, actual?.Flags); + } + + private static IEnumerable RoundtripsRegexFlagsData + { + get + { + yield return new PatternAnalyzer("test"); + yield return new PatternAnalyzer("test") + { + Flags = + { + RegexFlags.CaseInsensitive, + } + }; + yield return new PatternAnalyzer("test") + { + Flags = + { + RegexFlags.CaseInsensitive, + RegexFlags.Literal + } + }; + } + } + } +} diff --git a/sdk/search/Azure.Search.Documents/tests/Models/PatternTokenizerTests.cs b/sdk/search/Azure.Search.Documents/tests/Models/PatternTokenizerTests.cs new file mode 100644 index 000000000000..247388ecca62 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/tests/Models/PatternTokenizerTests.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using System.IO; +using System.Text.Json; +using Azure.Core; +using Azure.Search.Documents.Models; +using NUnit.Framework; + +namespace Azure.Search.Documents.Tests.Models +{ + public class PatternTokenizerTests + { + [TestCaseSource(nameof(RoundtripsRegexFlagsData))] + public void RoundtripsRegexFlags(PatternTokenizer expected) + { + using MemoryStream stream = new MemoryStream(); + using (Utf8JsonWriter writer = new Utf8JsonWriter(stream)) + { + ((IUtf8JsonSerializable)expected).Write(writer); + } + + using JsonDocument doc = JsonDocument.Parse(stream.ToArray()); + PatternTokenizer actual = Tokenizer.DeserializeTokenizer(doc.RootElement) as PatternTokenizer; + + CollectionAssert.AreEqual(expected.Flags, actual?.Flags); + } + + private static IEnumerable RoundtripsRegexFlagsData + { + get + { + yield return new PatternTokenizer("test"); + yield return new PatternTokenizer("test") + { + Flags = + { + RegexFlags.CaseInsensitive, + } + }; + yield return new PatternTokenizer("test") + { + Flags = + { + RegexFlags.CaseInsensitive, + RegexFlags.Literal + } + }; + } + } + } +} diff --git a/sdk/search/Azure.Search.Documents/tests/SearchServiceClientTests.cs b/sdk/search/Azure.Search.Documents/tests/SearchServiceClientTests.cs index 056e8186042d..0e6e5bb20c40 100644 --- a/sdk/search/Azure.Search.Documents/tests/SearchServiceClientTests.cs +++ b/sdk/search/Azure.Search.Documents/tests/SearchServiceClientTests.cs @@ -173,6 +173,59 @@ public async Task CreateIndex() Assert.AreEqual(expectedIndex.ScoringProfiles[0].Name, actualIndex.ScoringProfiles[0].Name); } + [Test] + public async Task UpdateIndex() + { + await using SearchResources resources = await SearchResources.CreateWithNoIndexesAsync(this); + + string indexName = Recording.Random.GetName(); + SearchIndex initialIndex = SearchResources.GetHotelIndex(indexName); + + SearchServiceClient client = resources.GetServiceClient(); + SearchIndex createdIndex = await client.CreateIndexAsync(initialIndex); + + string analyzerName = "asciiTags"; + + createdIndex.Analyzers.Add( + new PatternAnalyzer(analyzerName) + { + Pattern = @"[0-9a-z]+", + Flags = + { + RegexFlags.CaseInsensitive, + RegexFlags.Multiline, + }, + Stopwords = + { + "a", + "and", + "the", + }, + }); + + createdIndex.Fields.Add( + new SearchableField("asciiTags", collection: true) + { + Analyzer = analyzerName, + IsFacetable = true, + IsFilterable = true, + }); + + SearchIndex updatedIndex = await client.CreateOrUpdateIndexAsync( + createdIndex, + allowIndexDowntime: true, + accessConditions: new MatchConditions { IfMatch = new ETag(createdIndex.ETag) }); + + Assert.AreEqual(createdIndex.Name, updatedIndex.Name); + Assert.That(updatedIndex.Fields, Is.EqualTo(updatedIndex.Fields).Using(SearchFieldComparer.Shared)); + Assert.AreEqual(createdIndex.Suggesters.Count, updatedIndex.Suggesters.Count); + Assert.AreEqual(createdIndex.Suggesters[0].Name, updatedIndex.Suggesters[0].Name); + Assert.AreEqual(createdIndex.ScoringProfiles.Count, updatedIndex.ScoringProfiles.Count); + Assert.AreEqual(createdIndex.ScoringProfiles[0].Name, updatedIndex.ScoringProfiles[0].Name); + Assert.AreEqual(createdIndex.Analyzers.Count, updatedIndex.Analyzers.Count); + Assert.AreEqual(createdIndex.Analyzers[0].Name, updatedIndex.Analyzers[0].Name); + } + [Test] public void GetIndexParameterValidation() { diff --git a/sdk/search/Azure.Search.Documents/tests/SessionRecords/SearchServiceClientTests/UpdateIndex.json b/sdk/search/Azure.Search.Documents/tests/SessionRecords/SearchServiceClientTests/UpdateIndex.json new file mode 100644 index 000000000000..af957f9fca39 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/tests/SessionRecords/SearchServiceClientTests/UpdateIndex.json @@ -0,0 +1,1516 @@ +{ + "Entries": [ + { + "RequestUri": "https://azs-net-puoxctyi.search.windows.net/indexes?api-version=2019-05-06-Preview", + "RequestMethod": "POST", + "RequestHeaders": { + "api-key": "Sanitized", + "Content-Length": "4032", + "Content-Type": "application/json", + "traceparent": "00-f4b0e81e72e9dd488ae9b2a4786dfdfb-cc3ecc8c78e16b46-00", + "User-Agent": [ + "azsdk-net-Search.Documents/1.0.0-dev.20200420.1", + "(.NET Core 4.6.28619.01; Microsoft Windows 10.0.18363 )" + ], + "x-ms-client-request-id": "26f7066d315f5ab3f827c83cbd605a50", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "ptbgbued", + "fields": [ + { + "name": "hotelId", + "type": "Edm.String", + "key": true, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true + }, + { + "name": "hotelName", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": false + }, + { + "name": "description", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false, + "analyzer": "en.lucene" + }, + { + "name": "descriptionFr", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false, + "analyzer": "fr.lucene" + }, + { + "name": "category", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true + }, + { + "name": "tags", + "type": "Collection(Edm.String)", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": false, + "facetable": true + }, + { + "name": "parkingIncluded", + "type": "Edm.Boolean", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true + }, + { + "name": "smokingAllowed", + "type": "Edm.Boolean", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true + }, + { + "name": "lastRenovationDate", + "type": "Edm.DateTimeOffset", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true + }, + { + "name": "rating", + "type": "Edm.Int32", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true + }, + { + "name": "location", + "type": "Edm.GeographyPoint", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": false + }, + { + "name": "address", + "type": "Edm.ComplexType", + "fields": [ + { + "name": "streetAddress", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false + }, + { + "name": "city", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true + }, + { + "name": "stateProvince", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true + }, + { + "name": "country", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true + }, + { + "name": "postalCode", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true + } + ] + }, + { + "name": "rooms", + "type": "Collection(Edm.ComplexType)", + "fields": [ + { + "name": "description", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false, + "analyzer": "en.lucene" + }, + { + "name": "descriptionFr", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false, + "analyzer": "fr.lucene" + }, + { + "name": "type", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": false, + "facetable": true + }, + { + "name": "baseRate", + "type": "Edm.Double", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": false, + "facetable": true + }, + { + "name": "bedOptions", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": false, + "facetable": true + }, + { + "name": "sleepsCount", + "type": "Edm.Int32", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": false, + "facetable": true + }, + { + "name": "smokingAllowed", + "type": "Edm.Boolean", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": false, + "facetable": true + }, + { + "name": "tags", + "type": "Collection(Edm.String)", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": false, + "facetable": true + } + ] + } + ], + "scoringProfiles": [ + { + "name": "nearest", + "functions": [ + { + "distance": { + "referencePointParameter": "myloc", + "boostingDistance": 100 + }, + "type": "distance", + "fieldName": "location", + "boost": 2 + } + ], + "functionAggregation": "sum" + } + ], + "suggesters": [ + { + "name": "sg", + "searchMode": "analyzingInfixMatching", + "sourceFields": [ + "description", + "hotelName" + ] + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "6158", + "Content-Type": "application/json; odata.metadata=minimal", + "Date": "Mon, 20 Apr 2020 23:17:08 GMT", + "elapsed-time": "762", + "ETag": "W/\u00220x8D7E580F29EAE6B\u0022", + "Expires": "-1", + "Location": "https://azs-net-puoxctyi.search.windows.net/indexes(\u0027ptbgbued\u0027)?api-version=2019-05-06-Preview", + "OData-Version": "4.0", + "Pragma": "no-cache", + "Preference-Applied": "odata.include-annotations=\u0022*\u0022", + "request-id": "26f7066d-315f-5ab3-f827-c83cbd605a50", + "Strict-Transport-Security": "max-age=15724800; includeSubDomains" + }, + "ResponseBody": { + "@odata.context": "https://azs-net-puoxctyi.search.windows.net/$metadata#indexes/$entity", + "@odata.etag": "\u00220x8D7E580F29EAE6B\u0022", + "name": "ptbgbued", + "defaultScoringProfile": null, + "fields": [ + { + "name": "hotelId", + "type": "Edm.String", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": true, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "hotelName", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "description", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": "en.lucene", + "synonymMaps": [] + }, + { + "name": "descriptionFr", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": "fr.lucene", + "synonymMaps": [] + }, + { + "name": "category", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "tags", + "type": "Collection(Edm.String)", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "parkingIncluded", + "type": "Edm.Boolean", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "smokingAllowed", + "type": "Edm.Boolean", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "lastRenovationDate", + "type": "Edm.DateTimeOffset", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "rating", + "type": "Edm.Int32", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "location", + "type": "Edm.GeographyPoint", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "address", + "type": "Edm.ComplexType", + "fields": [ + { + "name": "streetAddress", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "city", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "stateProvince", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "country", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "postalCode", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + } + ] + }, + { + "name": "rooms", + "type": "Collection(Edm.ComplexType)", + "fields": [ + { + "name": "description", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": "en.lucene", + "synonymMaps": [] + }, + { + "name": "descriptionFr", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": "fr.lucene", + "synonymMaps": [] + }, + { + "name": "type", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "baseRate", + "type": "Edm.Double", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "bedOptions", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "sleepsCount", + "type": "Edm.Int32", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "smokingAllowed", + "type": "Edm.Boolean", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "tags", + "type": "Collection(Edm.String)", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + } + ] + } + ], + "scoringProfiles": [ + { + "name": "nearest", + "functionAggregation": "sum", + "text": null, + "functions": [ + { + "fieldName": "location", + "interpolation": "linear", + "type": "distance", + "boost": 2.0, + "freshness": null, + "magnitude": null, + "distance": { + "referencePointParameter": "myloc", + "boostingDistance": 100.0 + }, + "tag": null + } + ] + } + ], + "corsOptions": null, + "suggesters": [ + { + "name": "sg", + "searchMode": "analyzingInfixMatching", + "sourceFields": [ + "description", + "hotelName" + ] + } + ], + "analyzers": [], + "tokenizers": [], + "tokenFilters": [], + "charFilters": [], + "encryptionKey": null, + "similarity": null + } + }, + { + "RequestUri": "https://azs-net-puoxctyi.search.windows.net/indexes(\u0027ptbgbued\u0027)?allowIndexDowntime=true\u0026api-version=2019-05-06-Preview", + "RequestMethod": "PUT", + "RequestHeaders": { + "api-key": "Sanitized", + "Content-Length": "4873", + "Content-Type": "application/json", + "If-Match": "\u00220x8D7E580F29EAE6B\u0022", + "Prefer": "return=representation", + "traceparent": "00-c73390b778e66f4f80e9851c4cee4168-7c40cdf49445b24c-00", + "User-Agent": [ + "azsdk-net-Search.Documents/1.0.0-dev.20200420.1", + "(.NET Core 4.6.28619.01; Microsoft Windows 10.0.18363 )" + ], + "x-ms-client-request-id": "5c92b4cdda72b9dbb6ec10cb1f481d99", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "ptbgbued", + "fields": [ + { + "name": "hotelId", + "type": "Edm.String", + "key": true, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "hotelName", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": false, + "synonymMaps": [] + }, + { + "name": "description", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false, + "analyzer": "en.lucene", + "synonymMaps": [] + }, + { + "name": "descriptionFr", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false, + "analyzer": "fr.lucene", + "synonymMaps": [] + }, + { + "name": "category", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "tags", + "type": "Collection(Edm.String)", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": false, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "parkingIncluded", + "type": "Edm.Boolean", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "smokingAllowed", + "type": "Edm.Boolean", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "lastRenovationDate", + "type": "Edm.DateTimeOffset", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "rating", + "type": "Edm.Int32", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "location", + "type": "Edm.GeographyPoint", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": false, + "synonymMaps": [] + }, + { + "name": "address", + "type": "Edm.ComplexType", + "fields": [ + { + "name": "streetAddress", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false, + "synonymMaps": [] + }, + { + "name": "city", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "stateProvince", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "country", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "postalCode", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + } + ] + }, + { + "name": "rooms", + "type": "Collection(Edm.ComplexType)", + "fields": [ + { + "name": "description", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false, + "analyzer": "en.lucene", + "synonymMaps": [] + }, + { + "name": "descriptionFr", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false, + "analyzer": "fr.lucene", + "synonymMaps": [] + }, + { + "name": "type", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": false, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "baseRate", + "type": "Edm.Double", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": false, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "bedOptions", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": false, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "sleepsCount", + "type": "Edm.Int32", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": false, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "smokingAllowed", + "type": "Edm.Boolean", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": false, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "tags", + "type": "Collection(Edm.String)", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": false, + "facetable": true, + "synonymMaps": [] + } + ] + }, + { + "name": "asciiTags", + "type": "Collection(Edm.String)", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": false, + "facetable": true, + "analyzer": "asciiTags" + } + ], + "scoringProfiles": [ + { + "name": "nearest", + "functions": [ + { + "distance": { + "referencePointParameter": "myloc", + "boostingDistance": 100 + }, + "type": "distance", + "fieldName": "location", + "boost": 2, + "interpolation": "linear" + } + ], + "functionAggregation": "sum" + } + ], + "suggesters": [ + { + "name": "sg", + "searchMode": "analyzingInfixMatching", + "sourceFields": [ + "description", + "hotelName" + ] + } + ], + "analyzers": [ + { + "pattern": "[0-9a-z]\u002B", + "flags": "CASE_INSENSITIVE|MULTILINE", + "stopwords": [ + "a", + "and", + "the" + ], + "@odata.type": "#Microsoft.Azure.Search.PatternAnalyzer", + "name": "asciiTags" + } + ], + "@odata.etag": "\u00220x8D7E580F29EAE6B\u0022" + }, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "6577", + "Content-Type": "application/json; odata.metadata=minimal", + "Date": "Mon, 20 Apr 2020 23:17:09 GMT", + "elapsed-time": "759", + "ETag": "W/\u00220x8D7E580F324E684\u0022", + "Expires": "-1", + "OData-Version": "4.0", + "Pragma": "no-cache", + "Preference-Applied": "odata.include-annotations=\u0022*\u0022", + "request-id": "5c92b4cd-da72-b9db-b6ec-10cb1f481d99", + "Strict-Transport-Security": "max-age=15724800; includeSubDomains" + }, + "ResponseBody": { + "@odata.context": "https://azs-net-puoxctyi.search.windows.net/$metadata#indexes/$entity", + "@odata.etag": "\u00220x8D7E580F324E684\u0022", + "name": "ptbgbued", + "defaultScoringProfile": null, + "fields": [ + { + "name": "hotelId", + "type": "Edm.String", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": true, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "hotelName", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "description", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": "en.lucene", + "synonymMaps": [] + }, + { + "name": "descriptionFr", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": "fr.lucene", + "synonymMaps": [] + }, + { + "name": "category", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "tags", + "type": "Collection(Edm.String)", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "parkingIncluded", + "type": "Edm.Boolean", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "smokingAllowed", + "type": "Edm.Boolean", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "lastRenovationDate", + "type": "Edm.DateTimeOffset", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "rating", + "type": "Edm.Int32", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "location", + "type": "Edm.GeographyPoint", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "address", + "type": "Edm.ComplexType", + "fields": [ + { + "name": "streetAddress", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "city", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "stateProvince", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "country", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "postalCode", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + } + ] + }, + { + "name": "rooms", + "type": "Collection(Edm.ComplexType)", + "fields": [ + { + "name": "description", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": "en.lucene", + "synonymMaps": [] + }, + { + "name": "descriptionFr", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": "fr.lucene", + "synonymMaps": [] + }, + { + "name": "type", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "baseRate", + "type": "Edm.Double", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "bedOptions", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "sleepsCount", + "type": "Edm.Int32", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "smokingAllowed", + "type": "Edm.Boolean", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "tags", + "type": "Collection(Edm.String)", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + } + ] + }, + { + "name": "asciiTags", + "type": "Collection(Edm.String)", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": "asciiTags", + "synonymMaps": [] + } + ], + "scoringProfiles": [ + { + "name": "nearest", + "functionAggregation": "sum", + "text": null, + "functions": [ + { + "fieldName": "location", + "interpolation": "linear", + "type": "distance", + "boost": 2.0, + "freshness": null, + "magnitude": null, + "distance": { + "referencePointParameter": "myloc", + "boostingDistance": 100.0 + }, + "tag": null + } + ] + } + ], + "corsOptions": null, + "suggesters": [ + { + "name": "sg", + "searchMode": "analyzingInfixMatching", + "sourceFields": [ + "description", + "hotelName" + ] + } + ], + "analyzers": [ + { + "@odata.type": "#Microsoft.Azure.Search.PatternAnalyzer", + "name": "asciiTags", + "lowercase": true, + "pattern": "[0-9a-z]\u002B", + "flags": "CASE_INSENSITIVE|MULTILINE", + "stopwords": [ + "a", + "and", + "the" + ] + } + ], + "tokenizers": [], + "tokenFilters": [], + "charFilters": [], + "encryptionKey": null, + "similarity": null + } + } + ], + "Variables": { + "RandomSeed": "1669853055", + "SearchServiceName": "azs-net-puoxctyi" + } +} \ No newline at end of file diff --git a/sdk/search/Azure.Search.Documents/tests/SessionRecords/SearchServiceClientTests/UpdateIndexAsync.json b/sdk/search/Azure.Search.Documents/tests/SessionRecords/SearchServiceClientTests/UpdateIndexAsync.json new file mode 100644 index 000000000000..be9ba916356e --- /dev/null +++ b/sdk/search/Azure.Search.Documents/tests/SessionRecords/SearchServiceClientTests/UpdateIndexAsync.json @@ -0,0 +1,1516 @@ +{ + "Entries": [ + { + "RequestUri": "https://azs-net-hmiexjey.search.windows.net/indexes?api-version=2019-05-06-Preview", + "RequestMethod": "POST", + "RequestHeaders": { + "api-key": "Sanitized", + "Content-Length": "4032", + "Content-Type": "application/json", + "traceparent": "00-cf52f14a5d7b9e4b9799f4bf9cd8608b-9315f068ef817f4a-00", + "User-Agent": [ + "azsdk-net-Search.Documents/1.0.0-dev.20200420.1", + "(.NET Core 4.6.28619.01; Microsoft Windows 10.0.18363 )" + ], + "x-ms-client-request-id": "62e943843b5a3dfda55d7936ea8d46fa", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "mvqfigik", + "fields": [ + { + "name": "hotelId", + "type": "Edm.String", + "key": true, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true + }, + { + "name": "hotelName", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": false + }, + { + "name": "description", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false, + "analyzer": "en.lucene" + }, + { + "name": "descriptionFr", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false, + "analyzer": "fr.lucene" + }, + { + "name": "category", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true + }, + { + "name": "tags", + "type": "Collection(Edm.String)", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": false, + "facetable": true + }, + { + "name": "parkingIncluded", + "type": "Edm.Boolean", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true + }, + { + "name": "smokingAllowed", + "type": "Edm.Boolean", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true + }, + { + "name": "lastRenovationDate", + "type": "Edm.DateTimeOffset", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true + }, + { + "name": "rating", + "type": "Edm.Int32", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true + }, + { + "name": "location", + "type": "Edm.GeographyPoint", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": false + }, + { + "name": "address", + "type": "Edm.ComplexType", + "fields": [ + { + "name": "streetAddress", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false + }, + { + "name": "city", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true + }, + { + "name": "stateProvince", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true + }, + { + "name": "country", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true + }, + { + "name": "postalCode", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true + } + ] + }, + { + "name": "rooms", + "type": "Collection(Edm.ComplexType)", + "fields": [ + { + "name": "description", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false, + "analyzer": "en.lucene" + }, + { + "name": "descriptionFr", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false, + "analyzer": "fr.lucene" + }, + { + "name": "type", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": false, + "facetable": true + }, + { + "name": "baseRate", + "type": "Edm.Double", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": false, + "facetable": true + }, + { + "name": "bedOptions", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": false, + "facetable": true + }, + { + "name": "sleepsCount", + "type": "Edm.Int32", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": false, + "facetable": true + }, + { + "name": "smokingAllowed", + "type": "Edm.Boolean", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": false, + "facetable": true + }, + { + "name": "tags", + "type": "Collection(Edm.String)", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": false, + "facetable": true + } + ] + } + ], + "scoringProfiles": [ + { + "name": "nearest", + "functions": [ + { + "distance": { + "referencePointParameter": "myloc", + "boostingDistance": 100 + }, + "type": "distance", + "fieldName": "location", + "boost": 2 + } + ], + "functionAggregation": "sum" + } + ], + "suggesters": [ + { + "name": "sg", + "searchMode": "analyzingInfixMatching", + "sourceFields": [ + "description", + "hotelName" + ] + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "6158", + "Content-Type": "application/json; odata.metadata=minimal", + "Date": "Mon, 20 Apr 2020 23:17:14 GMT", + "elapsed-time": "798", + "ETag": "W/\u00220x8D7E580F662088D\u0022", + "Expires": "-1", + "Location": "https://azs-net-hmiexjey.search.windows.net/indexes(\u0027mvqfigik\u0027)?api-version=2019-05-06-Preview", + "OData-Version": "4.0", + "Pragma": "no-cache", + "Preference-Applied": "odata.include-annotations=\u0022*\u0022", + "request-id": "62e94384-3b5a-3dfd-a55d-7936ea8d46fa", + "Strict-Transport-Security": "max-age=15724800; includeSubDomains" + }, + "ResponseBody": { + "@odata.context": "https://azs-net-hmiexjey.search.windows.net/$metadata#indexes/$entity", + "@odata.etag": "\u00220x8D7E580F662088D\u0022", + "name": "mvqfigik", + "defaultScoringProfile": null, + "fields": [ + { + "name": "hotelId", + "type": "Edm.String", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": true, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "hotelName", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "description", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": "en.lucene", + "synonymMaps": [] + }, + { + "name": "descriptionFr", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": "fr.lucene", + "synonymMaps": [] + }, + { + "name": "category", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "tags", + "type": "Collection(Edm.String)", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "parkingIncluded", + "type": "Edm.Boolean", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "smokingAllowed", + "type": "Edm.Boolean", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "lastRenovationDate", + "type": "Edm.DateTimeOffset", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "rating", + "type": "Edm.Int32", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "location", + "type": "Edm.GeographyPoint", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "address", + "type": "Edm.ComplexType", + "fields": [ + { + "name": "streetAddress", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "city", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "stateProvince", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "country", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "postalCode", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + } + ] + }, + { + "name": "rooms", + "type": "Collection(Edm.ComplexType)", + "fields": [ + { + "name": "description", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": "en.lucene", + "synonymMaps": [] + }, + { + "name": "descriptionFr", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": "fr.lucene", + "synonymMaps": [] + }, + { + "name": "type", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "baseRate", + "type": "Edm.Double", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "bedOptions", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "sleepsCount", + "type": "Edm.Int32", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "smokingAllowed", + "type": "Edm.Boolean", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "tags", + "type": "Collection(Edm.String)", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + } + ] + } + ], + "scoringProfiles": [ + { + "name": "nearest", + "functionAggregation": "sum", + "text": null, + "functions": [ + { + "fieldName": "location", + "interpolation": "linear", + "type": "distance", + "boost": 2.0, + "freshness": null, + "magnitude": null, + "distance": { + "referencePointParameter": "myloc", + "boostingDistance": 100.0 + }, + "tag": null + } + ] + } + ], + "corsOptions": null, + "suggesters": [ + { + "name": "sg", + "searchMode": "analyzingInfixMatching", + "sourceFields": [ + "description", + "hotelName" + ] + } + ], + "analyzers": [], + "tokenizers": [], + "tokenFilters": [], + "charFilters": [], + "encryptionKey": null, + "similarity": null + } + }, + { + "RequestUri": "https://azs-net-hmiexjey.search.windows.net/indexes(\u0027mvqfigik\u0027)?allowIndexDowntime=true\u0026api-version=2019-05-06-Preview", + "RequestMethod": "PUT", + "RequestHeaders": { + "api-key": "Sanitized", + "Content-Length": "4873", + "Content-Type": "application/json", + "If-Match": "\u00220x8D7E580F662088D\u0022", + "Prefer": "return=representation", + "traceparent": "00-72fbe5394eb0a14e963d73bd30d7730e-835848551a4ecf4a-00", + "User-Agent": [ + "azsdk-net-Search.Documents/1.0.0-dev.20200420.1", + "(.NET Core 4.6.28619.01; Microsoft Windows 10.0.18363 )" + ], + "x-ms-client-request-id": "b20370b178072cf624850527937d7829", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "mvqfigik", + "fields": [ + { + "name": "hotelId", + "type": "Edm.String", + "key": true, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "hotelName", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": false, + "synonymMaps": [] + }, + { + "name": "description", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false, + "analyzer": "en.lucene", + "synonymMaps": [] + }, + { + "name": "descriptionFr", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false, + "analyzer": "fr.lucene", + "synonymMaps": [] + }, + { + "name": "category", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "tags", + "type": "Collection(Edm.String)", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": false, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "parkingIncluded", + "type": "Edm.Boolean", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "smokingAllowed", + "type": "Edm.Boolean", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "lastRenovationDate", + "type": "Edm.DateTimeOffset", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "rating", + "type": "Edm.Int32", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "location", + "type": "Edm.GeographyPoint", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": true, + "facetable": false, + "synonymMaps": [] + }, + { + "name": "address", + "type": "Edm.ComplexType", + "fields": [ + { + "name": "streetAddress", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false, + "synonymMaps": [] + }, + { + "name": "city", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "stateProvince", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "country", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "postalCode", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": true, + "facetable": true, + "synonymMaps": [] + } + ] + }, + { + "name": "rooms", + "type": "Collection(Edm.ComplexType)", + "fields": [ + { + "name": "description", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false, + "analyzer": "en.lucene", + "synonymMaps": [] + }, + { + "name": "descriptionFr", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": false, + "sortable": false, + "facetable": false, + "analyzer": "fr.lucene", + "synonymMaps": [] + }, + { + "name": "type", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": false, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "baseRate", + "type": "Edm.Double", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": false, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "bedOptions", + "type": "Edm.String", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": false, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "sleepsCount", + "type": "Edm.Int32", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": false, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "smokingAllowed", + "type": "Edm.Boolean", + "key": false, + "retrievable": true, + "searchable": false, + "filterable": true, + "sortable": false, + "facetable": true, + "synonymMaps": [] + }, + { + "name": "tags", + "type": "Collection(Edm.String)", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": false, + "facetable": true, + "synonymMaps": [] + } + ] + }, + { + "name": "asciiTags", + "type": "Collection(Edm.String)", + "key": false, + "retrievable": true, + "searchable": true, + "filterable": true, + "sortable": false, + "facetable": true, + "analyzer": "asciiTags" + } + ], + "scoringProfiles": [ + { + "name": "nearest", + "functions": [ + { + "distance": { + "referencePointParameter": "myloc", + "boostingDistance": 100 + }, + "type": "distance", + "fieldName": "location", + "boost": 2, + "interpolation": "linear" + } + ], + "functionAggregation": "sum" + } + ], + "suggesters": [ + { + "name": "sg", + "searchMode": "analyzingInfixMatching", + "sourceFields": [ + "description", + "hotelName" + ] + } + ], + "analyzers": [ + { + "pattern": "[0-9a-z]\u002B", + "flags": "CASE_INSENSITIVE|MULTILINE", + "stopwords": [ + "a", + "and", + "the" + ], + "@odata.type": "#Microsoft.Azure.Search.PatternAnalyzer", + "name": "asciiTags" + } + ], + "@odata.etag": "\u00220x8D7E580F662088D\u0022" + }, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "6577", + "Content-Type": "application/json; odata.metadata=minimal", + "Date": "Mon, 20 Apr 2020 23:17:15 GMT", + "elapsed-time": "730", + "ETag": "W/\u00220x8D7E580F6DB1EC5\u0022", + "Expires": "-1", + "OData-Version": "4.0", + "Pragma": "no-cache", + "Preference-Applied": "odata.include-annotations=\u0022*\u0022", + "request-id": "b20370b1-7807-2cf6-2485-0527937d7829", + "Strict-Transport-Security": "max-age=15724800; includeSubDomains" + }, + "ResponseBody": { + "@odata.context": "https://azs-net-hmiexjey.search.windows.net/$metadata#indexes/$entity", + "@odata.etag": "\u00220x8D7E580F6DB1EC5\u0022", + "name": "mvqfigik", + "defaultScoringProfile": null, + "fields": [ + { + "name": "hotelId", + "type": "Edm.String", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": true, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "hotelName", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "description", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": "en.lucene", + "synonymMaps": [] + }, + { + "name": "descriptionFr", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": "fr.lucene", + "synonymMaps": [] + }, + { + "name": "category", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "tags", + "type": "Collection(Edm.String)", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "parkingIncluded", + "type": "Edm.Boolean", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "smokingAllowed", + "type": "Edm.Boolean", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "lastRenovationDate", + "type": "Edm.DateTimeOffset", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "rating", + "type": "Edm.Int32", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "location", + "type": "Edm.GeographyPoint", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "address", + "type": "Edm.ComplexType", + "fields": [ + { + "name": "streetAddress", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "city", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "stateProvince", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "country", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "postalCode", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": true, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + } + ] + }, + { + "name": "rooms", + "type": "Collection(Edm.ComplexType)", + "fields": [ + { + "name": "description", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": "en.lucene", + "synonymMaps": [] + }, + { + "name": "descriptionFr", + "type": "Edm.String", + "searchable": true, + "filterable": false, + "retrievable": true, + "sortable": false, + "facetable": false, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": "fr.lucene", + "synonymMaps": [] + }, + { + "name": "type", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "baseRate", + "type": "Edm.Double", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "bedOptions", + "type": "Edm.String", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "sleepsCount", + "type": "Edm.Int32", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "smokingAllowed", + "type": "Edm.Boolean", + "searchable": false, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + }, + { + "name": "tags", + "type": "Collection(Edm.String)", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": null, + "synonymMaps": [] + } + ] + }, + { + "name": "asciiTags", + "type": "Collection(Edm.String)", + "searchable": true, + "filterable": true, + "retrievable": true, + "sortable": false, + "facetable": true, + "key": false, + "indexAnalyzer": null, + "searchAnalyzer": null, + "analyzer": "asciiTags", + "synonymMaps": [] + } + ], + "scoringProfiles": [ + { + "name": "nearest", + "functionAggregation": "sum", + "text": null, + "functions": [ + { + "fieldName": "location", + "interpolation": "linear", + "type": "distance", + "boost": 2.0, + "freshness": null, + "magnitude": null, + "distance": { + "referencePointParameter": "myloc", + "boostingDistance": 100.0 + }, + "tag": null + } + ] + } + ], + "corsOptions": null, + "suggesters": [ + { + "name": "sg", + "searchMode": "analyzingInfixMatching", + "sourceFields": [ + "description", + "hotelName" + ] + } + ], + "analyzers": [ + { + "@odata.type": "#Microsoft.Azure.Search.PatternAnalyzer", + "name": "asciiTags", + "lowercase": true, + "pattern": "[0-9a-z]\u002B", + "flags": "CASE_INSENSITIVE|MULTILINE", + "stopwords": [ + "a", + "and", + "the" + ] + } + ], + "tokenizers": [], + "tokenFilters": [], + "charFilters": [], + "encryptionKey": null, + "similarity": null + } + } + ], + "Variables": { + "RandomSeed": "1673829715", + "SearchServiceName": "azs-net-hmiexjey" + } +} \ No newline at end of file diff --git a/sdk/search/Azure.Search.Documents/tests/Utilities/SearchResources.Data.cs b/sdk/search/Azure.Search.Documents/tests/Utilities/SearchResources.Data.cs index 17f939ad25d0..b37c25e9a3e8 100644 --- a/sdk/search/Azure.Search.Documents/tests/Utilities/SearchResources.Data.cs +++ b/sdk/search/Azure.Search.Documents/tests/Utilities/SearchResources.Data.cs @@ -68,11 +68,11 @@ internal static SearchIndex GetHotelIndex(string name) => }, }, }, - Suggesters = new[] + Suggesters = { new Suggester("sg", "description", "hotelName"), }, - ScoringProfiles = new[] + ScoringProfiles = { new ScoringProfile("nearest") {