public void GetAnalyzerSettings_German_AddsNormalizationFilter() { var instance = Analyzers.GetAnalyzerSettings("de", null); var result = JsonConvert.SerializeObject(instance); Assert.Contains("german_normalization", result); }
public void GetAnalyzerSettings_SynonymsFilePath_SetsSynonymsPath() { var instance = Analyzers.GetAnalyzerSettings("en", "foo.txt"); var result = JsonConvert.SerializeObject(instance); Assert.Contains("\"synonyms_path\":\"en_foo.txt\"", result); }
public void GetAnalyzerSettings_French_AddsElisionFilter() { var instance = Analyzers.GetAnalyzerSettings("fr", null); var result = JsonConvert.SerializeObject(instance); Assert.Contains("french_elision", result); }
public void GetAnalyzerSettings_SpecialLanguage_SetsLightStemmer(string langCode, string expectedStemmer) { var instance = Analyzers.GetAnalyzerSettings(langCode, null); var result = JsonConvert.SerializeObject(instance); Assert.Contains(expectedStemmer, result); }
public void GetAnalyzerSettings_NoSynonymsFilePath_DoesNotSetSynonymsPath() { var instance = Analyzers.GetAnalyzerSettings("en", null); var result = JsonConvert.SerializeObject(instance); Assert.DoesNotContain("synonyms_path", result); }
public void GetAnalyzerSettings_English_AddsPossessiveAndLightStemmer() { var instance = Analyzers.GetAnalyzerSettings("en", null); var result = JsonConvert.SerializeObject(instance); Assert.Contains("possessive_english", result); Assert.Contains("light_english", result); }
private void CreateAnalyzerSettings() { var config = ElasticSearchSection.GetConfiguration(); var indexConfig = config.IndicesParsed.FirstOrDefault(i => i.Name == _nameWithoutLanguage); string json = Serialization.Serialize(Analyzers.GetAnalyzerSettings(_language, indexConfig?.SynonymsFile)); var data = Encoding.UTF8.GetBytes(json); var uri = _indexing.GetUri(_name, "_settings"); Logger.Information($"Creating analyzer settings. Language: {_name}"); Logger.Information(JToken.Parse(json).ToString(Formatting.Indented)); _httpClientHelper.Put(uri, data); }