在过去几个小时里,我一直试图让同义词在Elastic Search
中运行,但到目前为止都失败了。
当我进行搜索时,它就像同义词永远不会被索引。
以下是我认为我可能犯错误的代码部分。 请看一下,非常感谢任何帮助。
var createIndexTask = Client.CreateIndexAsync(synonymsindexname, i => i
.Settings(s => s
.Analysis(a => a
.TokenFilters(tf => tf
.Synonym("my_synonym", sf => sf
.Format(SynonymFormat.Solr)
.SynonymsPath("synonyms/solrsynonyms.txt")
)
)
.Analyzers(an => an
.Custom("my_analyzer", ca => ca
.Tokenizer("standard")
.Filters("lowercase", "stop", "my_synonym")
)
)
)
)
.Mappings(m => m
.Map<ClinicalCode>(c => c
.AutoMap()
.Properties(p => p
.Completion(comp => comp
.Contexts(ctx => ctx
.Category(csug => csug
.Name("ShortDescription")
.Path(x => x.ShortDescription)
)
)
.Name(n => n.Suggests)
.Analyzer("simple")
)
.Text(t => t
.Name(n => n.LongDescription)
.Analyzer("my_analyzer")
.CopyTo(ct => ct
.Field("allFields")
)
)
.Text(t => t
.Name(n => n.ShortDescription)
.Analyzer("my_analyzer")
.CopyTo(ct => ct
.Field("allFields")
)
)
.Text(t => t
.Name(n => n.ICDCode)
.Analyzer("my_analyzer")
.CopyTo(ct => ct
.Field("allFields")
)
)
.Keyword(k => k
.Name(n => n.ICDCode)
)
)
)
)
);