Skip to content

Commit

Permalink
Fix issues blocking mocking or model construction (Azure#15671)
Browse files Browse the repository at this point in the history
  • Loading branch information
heaths authored and annelo-msft committed Feb 17, 2021
1 parent 9cbc497 commit 2581b50
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 1 deletion.
1 change: 1 addition & 0 deletions sdk/search/Azure.Search.Documents/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixed

- Support deserializing null values during deserialization of skills ([#15108](https://github.com/Azure/azure-sdk-for-net/issues/15108))
- Fixed issues preventing mocking clients or initializing all models.

### Added

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2252,12 +2252,20 @@ public static partial class SearchModelFactory
public static Azure.Search.Documents.Indexes.Models.AnalyzedTokenInfo AnalyzedTokenInfo(string token, int startOffset, int endOffset, int position) { throw null; }
public static Azure.Search.Documents.Models.AutocompleteItem AutocompleteItem(string text, string queryPlusText) { throw null; }
public static Azure.Search.Documents.Models.AutocompleteResults AutocompleteResults(double? coverage, System.Collections.Generic.IReadOnlyList<Azure.Search.Documents.Models.AutocompleteItem> results) { throw null; }
public static Azure.Search.Documents.Indexes.Models.CharFilter CharFilter(string oDataType, string name) { throw null; }
public static Azure.Search.Documents.Indexes.Models.CognitiveServicesAccount CognitiveServicesAccount(string oDataType, string description) { throw null; }
public static Azure.Search.Documents.Indexes.Models.DataChangeDetectionPolicy DataChangeDetectionPolicy(string oDataType) { throw null; }
public static Azure.Search.Documents.Indexes.Models.DataDeletionDetectionPolicy DataDeletionDetectionPolicy(string oDataType) { throw null; }
public static Azure.Search.Documents.Models.FacetResult FacetResult(long? count, System.Collections.Generic.IReadOnlyDictionary<string, object> additionalProperties) { throw null; }
public static Azure.Search.Documents.Models.IndexDocumentsResult IndexDocumentsResult(System.Collections.Generic.IEnumerable<Azure.Search.Documents.Models.IndexingResult> results) { throw null; }
public static Azure.Search.Documents.Indexes.Models.IndexerExecutionResult IndexerExecutionResult(Azure.Search.Documents.Indexes.Models.IndexerExecutionStatus status, string errorMessage, System.DateTimeOffset? startTime, System.DateTimeOffset? endTime, System.Collections.Generic.IReadOnlyList<Azure.Search.Documents.Indexes.Models.SearchIndexerError> errors, System.Collections.Generic.IReadOnlyList<Azure.Search.Documents.Indexes.Models.SearchIndexerWarning> warnings, int itemCount, int failedItemCount, string initialTrackingState, string finalTrackingState) { throw null; }
public static Azure.Search.Documents.Models.IndexingResult IndexingResult(string key, string errorMessage, bool succeeded, int status) { throw null; }
public static Azure.Search.Documents.Indexes.Models.LexicalAnalyzer LexicalAnalyzer(string oDataType, string name) { throw null; }
public static Azure.Search.Documents.Indexes.Models.LexicalTokenizer LexicalTokenizer(string oDataType, string name) { throw null; }
public static Azure.Search.Documents.Indexes.Models.ScoringFunction ScoringFunction(string type, string fieldName, double boost, Azure.Search.Documents.Indexes.Models.ScoringFunctionInterpolation? interpolation) { throw null; }
public static Azure.Search.Documents.Indexes.Models.SearchIndexerError SearchIndexerError(string key, string errorMessage, int statusCode, string name, string details, string documentationLink) { throw null; }
public static Azure.Search.Documents.Indexes.Models.SearchIndexerLimits SearchIndexerLimits(System.TimeSpan? maxRunTime, long? maxDocumentExtractionSize, long? maxDocumentContentCharactersToExtract) { throw null; }
public static Azure.Search.Documents.Indexes.Models.SearchIndexerSkill SearchIndexerSkill(string oDataType, string name, string description, string context, System.Collections.Generic.IList<Azure.Search.Documents.Indexes.Models.InputFieldMappingEntry> inputs, System.Collections.Generic.IList<Azure.Search.Documents.Indexes.Models.OutputFieldMappingEntry> outputs) { throw null; }
public static Azure.Search.Documents.Indexes.Models.SearchIndexerStatus SearchIndexerStatus(Azure.Search.Documents.Indexes.Models.IndexerStatus status, Azure.Search.Documents.Indexes.Models.IndexerExecutionResult lastResult, System.Collections.Generic.IReadOnlyList<Azure.Search.Documents.Indexes.Models.IndexerExecutionResult> executionHistory, Azure.Search.Documents.Indexes.Models.SearchIndexerLimits limits) { throw null; }
public static Azure.Search.Documents.Indexes.Models.SearchIndexerWarning SearchIndexerWarning(string key, string message, string name, string details, string documentationLink) { throw null; }
public static Azure.Search.Documents.Indexes.Models.SearchIndexStatistics SearchIndexStatistics(long documentCount, long storageSize) { throw null; }
Expand All @@ -2269,7 +2277,9 @@ public static partial class SearchModelFactory
public static Azure.Search.Documents.Indexes.Models.SearchServiceLimits SearchServiceLimits(int? maxFieldsPerIndex, int? maxFieldNestingDepthPerIndex, int? maxComplexCollectionFieldsPerIndex, int? maxComplexObjectsInCollectionsPerDocument) { throw null; }
public static Azure.Search.Documents.Indexes.Models.SearchServiceStatistics SearchServiceStatistics(Azure.Search.Documents.Indexes.Models.SearchServiceCounters counters, Azure.Search.Documents.Indexes.Models.SearchServiceLimits limits) { throw null; }
public static Azure.Search.Documents.Models.SearchSuggestion<T> SearchSuggestion<T>(T document, string text) { throw null; }
public static Azure.Search.Documents.Indexes.Models.SimilarityAlgorithm SimilarityAlgorithm(string oDataType) { throw null; }
public static Azure.Search.Documents.Models.SuggestResults<T> SuggestResults<T>(System.Collections.Generic.IReadOnlyList<Azure.Search.Documents.Models.SearchSuggestion<T>> results, double? coverage) { throw null; }
public static Azure.Search.Documents.Indexes.Models.TokenFilter TokenFilter(string oDataType, string name) { throw null; }
}
public enum SearchQueryType
{
Expand Down
86 changes: 86 additions & 0 deletions sdk/search/Azure.Search.Documents/src/Models/SearchModelFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,34 @@ public static AnalyzedTokenInfo AnalyzedTokenInfo(
int position) =>
new AnalyzedTokenInfo(token, startOffset, endOffset, position);

/// <summary> Initializes a new instance of CharFilter. </summary>
/// <param name="oDataType"> Identifies the concrete type of the char filter. </param>
/// <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>
public static CharFilter CharFilter(
string oDataType,
string name) =>
new CharFilter(oDataType, name);

/// <summary> Initializes a new instance of CognitiveServicesAccount. </summary>
/// <param name="oDataType"> Identifies the concrete type of the cognitive service resource attached to a skillset. </param>
/// <param name="description"> Description of the cognitive service resource attached to a skillset. </param>
public static CognitiveServicesAccount CognitiveServicesAccount(
string oDataType,
string description) =>
new CognitiveServicesAccount(oDataType, description);

/// <summary> Initializes a new instance of DataChangeDetectionPolicy. </summary>
/// <param name="oDataType"> Identifies the concrete type of the data change detection policy. </param>
public static DataChangeDetectionPolicy DataChangeDetectionPolicy(
string oDataType) =>
new DataChangeDetectionPolicy(oDataType);

/// <summary> Initializes a new instance of DataDeletionDetectionPolicy. </summary>
/// <param name="oDataType"> Identifies the concrete type of the data deletion detection policy. </param>
public static DataDeletionDetectionPolicy DataDeletionDetectionPolicy(
string oDataType) =>
new DataDeletionDetectionPolicy(oDataType);

/// <summary> Initializes a new instance of IndexerExecutionResult. </summary>
/// <param name="status"> The outcome of this indexer execution. </param>
/// <param name="errorMessage"> The error message indicating the top-level error, if any. </param>
Expand All @@ -50,6 +78,34 @@ public static IndexerExecutionResult IndexerExecutionResult(
string finalTrackingState) =>
new IndexerExecutionResult(status, errorMessage, startTime, endTime, errors, warnings, itemCount, failedItemCount, initialTrackingState, finalTrackingState);

/// <summary> Initializes a new instance of LexicalAnalyzer. </summary>
/// <param name="oDataType"> Identifies the concrete type of the analyzer. </param>
/// <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>
public static LexicalAnalyzer LexicalAnalyzer(
string oDataType,
string name) =>
new LexicalAnalyzer(oDataType, name);

/// <summary> Initializes a new instance of LexicalTokenizer. </summary>
/// <param name="oDataType"> Identifies the concrete type of the tokenizer. </param>
/// <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>
public static LexicalTokenizer LexicalTokenizer(
string oDataType,
string name) =>
new LexicalTokenizer(oDataType, name);

/// <summary> Initializes a new instance of ScoringFunction. </summary>
/// <param name="type"> Indicates the type of function to use. Valid values include magnitude, freshness, distance, and tag. The function type must be lower case. </param>
/// <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>
/// <param name="interpolation"> A value indicating how boosting will be interpolated across document scores; defaults to &quot;Linear&quot;. </param>
public static ScoringFunction ScoringFunction(
string type,
string fieldName,
double boost,
ScoringFunctionInterpolation? interpolation) =>
new ScoringFunction(type, fieldName, boost, interpolation);

/// <summary> Initializes a new instance of SearchIndexerError. </summary>
/// <param name="key"> The key of the item for which indexing failed. </param>
/// <param name="errorMessage"> The message describing the error that occurred while processing the item. </param>
Expand Down Expand Up @@ -78,6 +134,22 @@ public static SearchIndexerLimits SearchIndexerLimits(
long? maxDocumentContentCharactersToExtract) =>
new SearchIndexerLimits(maxRunTime, maxDocumentExtractionSize, maxDocumentContentCharactersToExtract);

/// <summary> Initializes a new instance of SearchIndexerSkill. </summary>
/// <param name="oDataType"> Identifies the concrete type of the skill. </param>
/// <param name="name"> The name of the skill which uniquely identifies it within the skillset. A skill with no name defined will be given a default name of its 1-based index in the skills array, prefixed with the character &apos;#&apos;. </param>
/// <param name="description"> The description of the skill which describes the inputs, outputs, and usage of the skill. </param>
/// <param name="context"> Represents the level at which operations take place, such as the document root or document content (for example, /document or /document/content). The default is /document. </param>
/// <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>
public static SearchIndexerSkill SearchIndexerSkill(
string oDataType,
string name,
string description,
string context,
IList<InputFieldMappingEntry> inputs,
IList<OutputFieldMappingEntry> outputs) =>
new SearchIndexerSkill(oDataType, name, description, context, inputs, outputs);

/// <summary> Initializes a new instance of SearchIndexerStatus. </summary>
/// <param name="status"> Overall indexer status. </param>
/// <param name="lastResult"> The result of the most recent or an in-progress indexer execution. </param>
Expand Down Expand Up @@ -163,6 +235,20 @@ public static SearchServiceStatistics SearchServiceStatistics(
SearchServiceLimits limits) =>
new SearchServiceStatistics(counters, limits);

/// <summary> Initializes a new instance of SimilarityAlgorithm. </summary>
/// <param name="oDataType"> . </param>
public static SimilarityAlgorithm SimilarityAlgorithm(
string oDataType) =>
new SimilarityAlgorithm(oDataType);

/// <summary> Initializes a new instance of TokenFilter. </summary>
/// <param name="oDataType"> Identifies the concrete type of the token filter. </param>
/// <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>
public static TokenFilter TokenFilter(
string oDataType,
string name) =>
new TokenFilter(oDataType, name);

/// <summary> Initializes a new instance of AutocompleteResults. </summary>
/// <param name="coverage"> A value indicating the percentage of the index that was considered by the autocomplete request, or null if minimumCoverage was not specified in the request. </param>
/// <param name="results"> The list of returned Autocompleted items. </param>
Expand Down
2 changes: 1 addition & 1 deletion sdk/search/Azure.Search.Documents/src/SearchClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public SearchClient(
ClientDiagnostics,
Pipeline,
endpoint.ToString(),
IndexName,
indexName,
null,
Version.ToVersionString());
}
Expand Down

0 comments on commit 2581b50

Please sign in to comment.