Skip to content

deprecate standard token filter as per elastic/elasticsearch#33468 #3520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Nest/Analysis/TokenFilters/StandardTokenFilter.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
namespace Nest
using System;

namespace Nest
{
/// <summary>
/// A token filter of type standard that normalizes tokens extracted with the Standard Tokenizer.
/// </summary>
[Obsolete(" The `standard` token filter has been deprecated because it doesn't change anything in the stream. It will be removed in 7.0.")]
public interface IStandardTokenFilter : ITokenFilter { }

/// <inheritdoc />
[Obsolete(" The `standard` token filter has been deprecated because it doesn't change anything in the stream. It will be removed in 7.0.")]
public class StandardTokenFilter : TokenFilterBase, IStandardTokenFilter
{
public StandardTokenFilter() : base("standard") { }
}

/// <inheritdoc />
[Obsolete(" The `standard` token filter has been deprecated because it doesn't change anything in the stream. It will be removed in 7.0.")]
public class StandardTokenFilterDescriptor
: TokenFilterDescriptorBase<StandardTokenFilterDescriptor, IStandardTokenFilter>, IStandardTokenFilter
{
Expand Down
2 changes: 2 additions & 0 deletions src/Nest/Analysis/TokenFilters/TokenFilterJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
case "stemmer": return o.ToObject<StemmerTokenFilter>(ElasticContractResolver.Empty);
case "stemmer_override": return o.ToObject<StemmerOverrideTokenFilter>(ElasticContractResolver.Empty);
case "stop": return o.ToObject<StopTokenFilter>(ElasticContractResolver.Empty);
#pragma warning disable 618
case "standard": return o.ToObject<StandardTokenFilter>(ElasticContractResolver.Empty);
#pragma warning restore 618
case "synonym": return o.ToObject<SynonymTokenFilter>(ElasticContractResolver.Empty);
case "synonym_graph": return o.ToObject<SynonymGraphTokenFilter>(ElasticContractResolver.Empty);
case "trim": return o.ToObject<TrimTokenFilter>(ElasticContractResolver.Empty);
Expand Down
2 changes: 2 additions & 0 deletions src/Nest/Analysis/TokenFilters/TokenFilters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,10 @@ public TokenFiltersDescriptor Snowball(string name, Func<SnowballTokenFilterDesc
/// <summary>
/// A token filter of type standard that normalizes tokens extracted with the Standard Tokenizer.
/// </summary>
#pragma warning disable 618
public TokenFiltersDescriptor Standard(string name, Func<StandardTokenFilterDescriptor, IStandardTokenFilter> selector = null) =>
Assign(name, selector.InvokeOrDefault(new StandardTokenFilterDescriptor()));
#pragma warning restore 618

/// <summary>
/// A filter that stems words (similar to snowball, but with more options).
Expand Down
2 changes: 2 additions & 0 deletions src/Nest/Indices/Analyze/AnalyzeTokenFilters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,10 @@ public AnalyzeTokenFiltersDescriptor Snowball(Func<SnowballTokenFilterDescriptor
/// <summary>
/// A token filter of type standard that normalizes tokens extracted with the Standard Tokenizer.
/// </summary>
#pragma warning disable 618
public AnalyzeTokenFiltersDescriptor Standard(Func<StandardTokenFilterDescriptor, IStandardTokenFilter> selector = null) =>
AssignIfNotNull(selector.InvokeOrDefault(new StandardTokenFilterDescriptor()));
#pragma warning restore 618

/// <summary>
/// A filter that stems words (similar to snowball, but with more options).
Expand Down
2 changes: 2 additions & 0 deletions src/Tests/Tests/Analysis/TokenFilters/TokenFilterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,9 @@ public class StandardTests : TokenFilterAssertionBase<StandardTests>
{
public override FuncTokenFilters Fluent => (n, tf) => tf.Standard(n);

#pragma warning disable 618
public override ITokenFilter Initializer => new StandardTokenFilter();
#pragma warning restore 618

public override object Json => new { type = "standard" };
public override string Name => "standard";
Expand Down