Skip to content

Commit 97b2979

Browse files
committed
Make predefined stopwords support backwards compatible
1 parent b190aa3 commit 97b2979

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

src/Nest/Domain/Analysis/TokenFilter/StopTokenFilter.cs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,24 @@ public StopTokenFilter() : base("stop")
1313

1414
}
1515

16-
[JsonProperty("enable_position_increments")]
16+
[JsonProperty("stopwords")]
17+
internal object _Stopwords { get; set; }
18+
19+
[JsonIgnore]
20+
public IEnumerable<string> Stopwords
21+
{
22+
get { return _Stopwords as IEnumerable<string>; }
23+
set { _Stopwords = value; }
24+
}
25+
26+
[JsonIgnore]
27+
public string PredefinedStopwords
28+
{
29+
get { return _Stopwords as string; }
30+
set { _Stopwords = value; }
31+
}
32+
33+
[JsonProperty("enable_position_increments")]
1734
public bool? EnablePositionIncrements { get; set; }
1835

1936
[JsonProperty("ignore_case")]
@@ -22,9 +39,6 @@ public StopTokenFilter() : base("stop")
2239
[JsonProperty("stopwords_path")]
2340
public string StopwordsPath { get; set; }
2441

25-
[JsonProperty("stopwords")]
26-
public object Stopwords { get; set; }
27-
2842
[JsonProperty("remove_trailing")]
2943
public bool? RemoveTrailing { get; set; }
3044
}

src/Tests/Nest.Tests.Unit/Core/Indices/Analysis/TokenFilters/TokenFilterTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void TestStopTokenFilterWithPredefinedLanguageList()
3333
.TokenFilters(t => t
3434
.Add("my_stop", new StopTokenFilter
3535
{
36-
Stopwords = "_english_"
36+
PredefinedStopwords = "_english_"
3737
})
3838
)
3939
);

0 commit comments

Comments
 (0)