Skip to content

Commit

Permalink
Make Search base classes non-instantiatable (#12250)
Browse files Browse the repository at this point in the history
Resolves #9686 without making the classes abstract, given that a fix for Azure/autorest.csharp#650 is further out.
  • Loading branch information
heaths authored May 22, 2020
1 parent bda99f6 commit 1d5b23c
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1373,7 +1373,7 @@ public ShingleTokenFilter(string name) { }
}
public partial class SimilarityAlgorithm
{
public SimilarityAlgorithm() { }
internal SimilarityAlgorithm() { }
}
public partial class SimpleField : Azure.Search.Documents.Indexes.Models.SearchFieldTemplate
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public partial class CharFilter
{
/// <summary> Initializes a new instance of CharFilter. </summary>
/// <param name="name"> The name of the char filter. It must only contain letters, digits, spaces, dashes or underscores, can only start and end with alphanumeric characters, and is limited to 128 characters. </param>
/// <exception cref="ArgumentNullException"><paramref name="name"/> is null.</exception>
private protected CharFilter(string name)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace Azure.Search.Documents.Indexes.Models
{
public partial class CognitiveServicesAccount
{
/// <summary> Initializes a new instance of CognitiveServicesAccount. </summary>
private protected CognitiveServicesAccount()
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace Azure.Search.Documents.Indexes.Models
{
public partial class DataChangeDetectionPolicy
{
/// <summary> Initializes a new instance of DataChangeDetectionPolicy. </summary>
private protected DataChangeDetectionPolicy()
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace Azure.Search.Documents.Indexes.Models
{
public partial class DataDeletionDetectionPolicy
{
/// <summary> Initializes a new instance of DataDeletionDetectionPolicy. </summary>
private protected DataDeletionDetectionPolicy()
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public partial class LexicalAnalyzer
{
/// <summary> Initializes a new instance of LexicalAnalyzer. </summary>
/// <param name="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. </param>
/// <exception cref="ArgumentNullException"><paramref name="name"/> is null.</exception>
private protected LexicalAnalyzer(string name)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public partial class LexicalTokenizer
{
/// <summary> Initializes a new instance of LexicalTokenizer. </summary>
/// <param name="name"> The name of the tokenizer. It must only contain letters, digits, spaces, dashes or underscores, can only start and end with alphanumeric characters, and is limited to 128 characters. </param>
/// <exception cref="ArgumentNullException"><paramref name="name"/> is null.</exception>
private protected LexicalTokenizer(string name)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Azure.Core;
using System;

namespace Azure.Search.Documents.Indexes.Models
{
Expand All @@ -12,11 +12,10 @@ public partial class ScoringFunction
/// </summary>
/// <param name="fieldName">The name of the field used as input to the scoring function.</param>
/// <param name="boost">A multiplier for the raw score. Must be a positive number not equal to 1.0.</param>
/// <exception cref="ArgumentNullException"><paramref name="fieldName"/> is null.</exception>
private protected ScoringFunction(string fieldName, double boost)
{
Argument.AssertNotNullOrEmpty(fieldName, nameof(fieldName));

FieldName = fieldName;
FieldName = fieldName ?? throw new ArgumentNullException(nameof(fieldName));
Boost = boost;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Linq;
using Azure.Core;
Expand All @@ -12,6 +13,7 @@ public partial class SearchIndexerSkill
/// <summary> Initializes a new instance of SearchIndexerSkill. </summary>
/// <param name="inputs"> Inputs of the skills could be a column in the source data set, or the output of an upstream skill. </param>
/// <param name="outputs"> The output of a skill is either a field in a search index, or a value that can be consumed as an input by another skill. </param>
/// <exception cref="ArgumentNullException"><paramref name="inputs"/> or <paramref name="outputs"/> is null.</exception>
private protected SearchIndexerSkill(IEnumerable<InputFieldMappingEntry> inputs, IEnumerable<OutputFieldMappingEntry> outputs)
{
Argument.AssertNotNull(inputs, nameof(inputs));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@ namespace Azure.Search.Documents.Indexes.Models
[CodeGenModel("Similarity")]
public partial class SimilarityAlgorithm
{
/// <summary> Initializes a new instance of SimilarityAlgorithm. </summary>
private protected SimilarityAlgorithm()
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public partial class TokenFilter
{
/// <summary> Initializes a new instance of TokenFilter. </summary>
/// <param name="name"> The name of the token filter. It must only contain letters, digits, spaces, dashes or underscores, can only start and end with alphanumeric characters, and is limited to 128 characters. </param>
/// <exception cref="ArgumentNullException"><paramref name="name"/> is null.</exception>
private protected TokenFilter(string name)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
Expand Down

0 comments on commit 1d5b23c

Please sign in to comment.