Permalink
Browse files

Fixed TokenFilterSettings to use "filter" as json part name

  • Loading branch information...
1 parent 1c8636d commit ee11bd74c621040ac3190e3e2689b366922a5655 @devoyster committed May 21, 2012
@@ -150,8 +150,8 @@ class When_complete_TokenFilterSettings_built
It should_contain_named_word_delimiter_part = () => result.ShouldContain("'named_word_delimiter': { 'type': 'word_delimiter' }".AltQuote());
It should_contain_custom_part = () => result.ShouldContain("{ Custom }".AltQuote());
-
- It should_return_correct_result = () => result.ShouldEqual(("'token_filter': { " +
+
+ It should_return_correct_result = () => result.ShouldEqual(("'filter': { " +
"'asciifolding': { 'type': 'asciifolding',Asciifolding }," +
"'named_asciifolding': { 'type': 'asciifolding' }," +
"'dictionary_decompounder': { 'type': 'dictionary_decompounder',DictionaryDecompounder }," +
@@ -10,7 +10,7 @@ class When_empty_TokenFilterSettings_built
Because of = () => result = new TokenFilterSettings()
.ToString();
- It should_return_correct_result = () => result.ShouldEqual("'token_filter': { }".AltQuote());
+ It should_return_correct_result = () => result.ShouldEqual("'filter': { }".AltQuote());
private static string result;
}
@@ -10,7 +10,7 @@ class When_complete_Analysis_built
Because of = () => result = new Analysis()
.Analyzer(a => a.CustomPart("Analyzers"))
.Tokenizer(t => t.CustomPart("Tokenizers"))
- .TokenFilter(t => t.CustomPart("TokenFilters"))
+ .Filter(t => t.CustomPart("TokenFilters"))
.CharFilter(c => c.CustomPart("CharFilters"))
.CustomPart("{ Custom }")
.ToString();
@@ -19,7 +19,7 @@ class When_complete_Analysis_built
It should_contain_tokenizer_part = () => result.ShouldContain("'tokenizer': { Tokenizers }".AltQuote());
- It should_contain_token_filter_part = () => result.ShouldContain("'token_filter': { TokenFilters }".AltQuote());
+ It should_contain_filter_part = () => result.ShouldContain("'filter': { TokenFilters }".AltQuote());
It should_contain_char_filter_part = () => result.ShouldContain("'char_filter': { CharFilters }".AltQuote());
@@ -28,7 +28,7 @@ class When_complete_Analysis_built
It should_return_correct_result = () => result.ShouldEqual(("'analysis': { " +
"'analyzer': { Analyzers }," +
"'tokenizer': { Tokenizers }," +
- "'token_filter': { TokenFilters }," +
+ "'filter': { TokenFilters }," +
"'char_filter': { CharFilters }," +
"{ Custom } }").AltQuote());
@@ -32,9 +32,9 @@ public Analysis Tokenizer(Func<TokenizerSettings, TokenizerSettings> tokenizer)
/// <summary>
/// Allows to configure token filters to be used in custom analyzers.
/// </summary>
- public Analysis TokenFilter(Func<TokenFilterSettings, TokenFilterSettings> tokenFilter)
+ public Analysis Filter(Func<TokenFilterSettings, TokenFilterSettings> filter)
{
- RegisterJsonPartExpression(tokenFilter);
+ RegisterJsonPartExpression(filter);
return this;
}
@@ -573,7 +573,7 @@ public TokenFilterSettings WordDelimiter(Func<WordDelimiterTokenFilter, WordDeli
protected override string ApplyJsonTemplate(string body)
{
- return "'token_filter': {{ {0} }}".AltQuoteF(body);
+ return "'filter': {{ {0} }}".AltQuoteF(body);
}
}
}
@@ -9,6 +9,9 @@
<#@ include file="..\ComponentsGenerator.tt" #>
<#
- var settings = new AnalysisViewSettings("token_filter");
+ var settings = new AnalysisViewSettings("token_filter")
+ {
+ ElasticSectionName = "filter"
+ };
new ComponentsGenerator(Host, settings).Run();
#>

0 comments on commit ee11bd7

Please sign in to comment.