Skip to content

Commit 2da59be

Browse files
authored
De/serialize pipe-delimited array of RegexFlags (#11461)
* De/serialize |-delimited array of RegexFlags Fixes #10748 * Declare related read-only collection properties * Update public APIs * Resolve PR feedback
1 parent 2e1eead commit 2da59be

17 files changed

+3365
-77
lines changed

sdk/search/Azure.Search.Documents/api/Azure.Search.Documents.netstandard2.0.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,10 +1109,10 @@ public PathHierarchyTokenizerV2(string name) : base (default(string)) { }
11091109
public partial class PatternAnalyzer : Azure.Search.Documents.Models.Analyzer
11101110
{
11111111
public PatternAnalyzer(string name) : base (default(string)) { }
1112-
public Azure.Search.Documents.Models.RegexFlags? Flags { get { throw null; } set { } }
1112+
public System.Collections.Generic.IList<Azure.Search.Documents.Models.RegexFlags> Flags { get { throw null; } }
11131113
public bool? LowerCaseTerms { get { throw null; } set { } }
11141114
public string Pattern { get { throw null; } set { } }
1115-
public System.Collections.Generic.IList<string> Stopwords { get { throw null; } set { } }
1115+
public System.Collections.Generic.IList<string> Stopwords { get { throw null; } }
11161116
}
11171117
public partial class PatternCaptureTokenFilter : Azure.Search.Documents.Models.TokenFilter
11181118
{
@@ -1135,7 +1135,7 @@ public PatternReplaceTokenFilter(string name, string pattern, string replacement
11351135
public partial class PatternTokenizer : Azure.Search.Documents.Models.Tokenizer
11361136
{
11371137
public PatternTokenizer(string name) : base (default(string)) { }
1138-
public Azure.Search.Documents.Models.RegexFlags? Flags { get { throw null; } set { } }
1138+
public System.Collections.Generic.IList<Azure.Search.Documents.Models.RegexFlags> Flags { get { throw null; } }
11391139
public int? Group { get { throw null; } set { } }
11401140
public string Pattern { get { throw null; } set { } }
11411141
}
@@ -1268,18 +1268,18 @@ public partial class SearchIndex
12681268
{
12691269
public SearchIndex(string name) { }
12701270
public SearchIndex(string name, System.Collections.Generic.IEnumerable<Azure.Search.Documents.Models.SearchField> fields) { }
1271-
public System.Collections.Generic.IList<Azure.Search.Documents.Models.Analyzer> Analyzers { get { throw null; } set { } }
1272-
public System.Collections.Generic.IList<Azure.Search.Documents.Models.CharFilter> CharFilters { get { throw null; } set { } }
1271+
public System.Collections.Generic.IList<Azure.Search.Documents.Models.Analyzer> Analyzers { get { throw null; } }
1272+
public System.Collections.Generic.IList<Azure.Search.Documents.Models.CharFilter> CharFilters { get { throw null; } }
12731273
public Azure.Search.Documents.Models.CorsOptions CorsOptions { get { throw null; } set { } }
12741274
public string DefaultScoringProfile { get { throw null; } set { } }
12751275
public Azure.Search.Documents.Models.EncryptionKey EncryptionKey { get { throw null; } set { } }
12761276
public string ETag { get { throw null; } set { } }
12771277
public System.Collections.Generic.IList<Azure.Search.Documents.Models.SearchField> Fields { get { throw null; } }
12781278
public string Name { get { throw null; } }
1279-
public System.Collections.Generic.IList<Azure.Search.Documents.Models.ScoringProfile> ScoringProfiles { get { throw null; } set { } }
1280-
public System.Collections.Generic.IList<Azure.Search.Documents.Models.Suggester> Suggesters { get { throw null; } set { } }
1281-
public System.Collections.Generic.IList<Azure.Search.Documents.Models.TokenFilter> TokenFilters { get { throw null; } set { } }
1282-
public System.Collections.Generic.IList<Azure.Search.Documents.Models.Tokenizer> Tokenizers { get { throw null; } set { } }
1279+
public System.Collections.Generic.IList<Azure.Search.Documents.Models.ScoringProfile> ScoringProfiles { get { throw null; } }
1280+
public System.Collections.Generic.IList<Azure.Search.Documents.Models.Suggester> Suggesters { get { throw null; } }
1281+
public System.Collections.Generic.IList<Azure.Search.Documents.Models.TokenFilter> TokenFilters { get { throw null; } }
1282+
public System.Collections.Generic.IList<Azure.Search.Documents.Models.Tokenizer> Tokenizers { get { throw null; } }
12831283
}
12841284
public partial class SearchIndexer
12851285
{

sdk/search/Azure.Search.Documents/src/Generated/Models/PatternAnalyzer.Serialization.cs

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/search/Azure.Search.Documents/src/Generated/Models/PatternAnalyzer.cs

Lines changed: 5 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/search/Azure.Search.Documents/src/Generated/Models/PatternTokenizer.Serialization.cs

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/search/Azure.Search.Documents/src/Generated/Models/PatternTokenizer.cs

Lines changed: 3 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndex.Serialization.cs

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndex.cs

Lines changed: 7 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System.Collections.Generic;
5+
using Azure.Core;
6+
7+
namespace Azure.Search.Documents.Models
8+
{
9+
public partial class PatternAnalyzer
10+
{
11+
[CodeGenMember("flags")]
12+
private string FlagsInternal
13+
{
14+
get => string.Join("|", Flags);
15+
set
16+
{
17+
Flags.Clear();
18+
19+
if (!string.IsNullOrEmpty(value))
20+
{
21+
string[] values = value.Split('|');
22+
for (int i = 0; i < values.Length; ++i)
23+
{
24+
Flags.Add(new RegexFlags(values[i]));
25+
}
26+
}
27+
}
28+
}
29+
30+
/// <summary>
31+
/// Gets regular expression flags for <see cref="Pattern"/>.
32+
/// </summary>
33+
public IList<RegexFlags> Flags { get; } = new List<RegexFlags>();
34+
35+
/// <summary>
36+
/// Gets a list of stopwords.
37+
/// </summary>
38+
[CodeGenMember(Initialize = true, EmptyAsUndefined = true)]
39+
public IList<string> Stopwords { get; }
40+
}
41+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System.Collections.Generic;
5+
using Azure.Core;
6+
7+
namespace Azure.Search.Documents.Models
8+
{
9+
public partial class PatternTokenizer
10+
{
11+
[CodeGenMember("flags")]
12+
private string FlagsInternal
13+
{
14+
get => string.Join("|", Flags);
15+
set
16+
{
17+
Flags.Clear();
18+
19+
if (!string.IsNullOrEmpty(value))
20+
{
21+
string[] values = value.Split('|');
22+
for (int i = 0; i < values.Length; ++i)
23+
{
24+
Flags.Add(new RegexFlags(values[i]));
25+
}
26+
}
27+
}
28+
}
29+
30+
/// <summary>
31+
/// Regular expression flags for <see cref="Pattern"/>.
32+
/// </summary>
33+
public IList<RegexFlags> Flags { get; } = new List<RegexFlags>();
34+
}
35+
}

0 commit comments

Comments
 (0)