Hi, i’m trying to add accent insensitive search for elasticsearch.
I want to add a AsciiFolding tokenfilter that preservs the original characters so it’s possible to search with or withouth the accent for example “e” and “é” should be handle the same, ex: if a brand name would be original “èrgonomica” searching at “ergo” or “érgo” should yield the same results.
What I’v tried to do is to override the “BuildIndexDescriptor” for the document type im searching at: (the class inherits from “MultilingualIndexConfigurationBase”). As I understand it, this is the class that will handle the configuration for that type off searchable entity?
protected override CreateIndexDescriptor BuildIndexDescriptor(CultureInfo cultureInfo, CreateIndexDescriptor descriptor)
{
return descriptor.Settings(s => s
.Analysis(analysis => analysis
.TokenFilters(tokenfilters => tokenfilters
.AsciiFolding("folding-preserve", ft => ft
.PreserveOriginal()
)
)
.Analyzers(analyzers => analyzers
.Custom("folding-analyzer", c => c
.Tokenizer("standard")
.Filters("standard", "folding-preserve")
)
)
)
).Map<Category>(mm => mm
.AutoMap()
.Properties(p => p
.Text(t => t
.Name(n => n.Localizations[cultureInfo].Name)
.Analyzer("folding-analyzer")
)
)
);
}
Though, this code dosent get hit when im trying to debug it, im now wondering if this is the place to add my custom analysers and mappers for special properties that need special handling when searching.
Litium version: 7.7.0