From dd567bd4528ed3724ebe42ef152890920bd523b5 Mon Sep 17 00:00:00 2001 From: Scott S Date: Tue, 31 Dec 2013 13:43:44 -0800 Subject: [PATCH 1/2] CustomAnalyzer ctor to set AnalyzerBase.Type By providing a ctor that sets the Type property users will not need to remember to set the type property manually. Removing the default ctor would be a breaking change. Marking it obsolete should lead most people to "the pit of success". --- .../Domain/Analysis/Analyzers/CustomAnalyzer.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Nest/Domain/Analysis/Analyzers/CustomAnalyzer.cs b/src/Nest/Domain/Analysis/Analyzers/CustomAnalyzer.cs index 5b82b280166..469267d7c7f 100644 --- a/src/Nest/Domain/Analysis/Analyzers/CustomAnalyzer.cs +++ b/src/Nest/Domain/Analysis/Analyzers/CustomAnalyzer.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using Newtonsoft.Json; namespace Nest @@ -9,12 +10,15 @@ namespace Nest /// public class CustomAnalyzer : AnalyzerBase { - public CustomAnalyzer() - { - this.Type = "custom"; - } + public CustomAnalyzer(string type) + { + Type = type; + } - [JsonProperty("tokenizer")] + [Obsolete("ctor(string) is preferred")] + public CustomAnalyzer() : this("custom") {} + + [JsonProperty("tokenizer")] public string Tokenizer { get; set; } [JsonProperty("filter")] From bcda3c5062923736ccf0cca838ec176f7fe29827 Mon Sep 17 00:00:00 2001 From: Scott S Date: Wed, 15 Jan 2014 09:12:08 -0800 Subject: [PATCH 2/2] Remove obsolete attribute --- src/Nest/Domain/Analysis/Analyzers/CustomAnalyzer.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Nest/Domain/Analysis/Analyzers/CustomAnalyzer.cs b/src/Nest/Domain/Analysis/Analyzers/CustomAnalyzer.cs index 469267d7c7f..57782e0c7e0 100644 --- a/src/Nest/Domain/Analysis/Analyzers/CustomAnalyzer.cs +++ b/src/Nest/Domain/Analysis/Analyzers/CustomAnalyzer.cs @@ -15,8 +15,7 @@ public CustomAnalyzer(string type) Type = type; } - [Obsolete("ctor(string) is preferred")] - public CustomAnalyzer() : this("custom") {} + public CustomAnalyzer() : this("custom") {} [JsonProperty("tokenizer")] public string Tokenizer { get; set; }