What I need to achive is left side match. I'm using Query Type full. Please find my model and analyzer below:
public class Product
{
[System.ComponentModel.DataAnnotations.Key]
public string Id { get; set; }
[IsSearchable, Analyzer("polish_analyzer")]
public string Name { get; set; }
}
Analyzers = new[]
{
new CustomAnalyzer()
{
Name="polish_analyzer",
Tokenizer = "polish_tokenizer",
TokenFilters = new TokenFilterName[] {"lowercase", "asciifolding" }
}
},
Tokenizers = new[]
{
new MicrosoftLanguageStemmingTokenizer()
{
Language = MicrosoftStemmingTokenizerLanguage.Polish,
IsSearchTokenizer = true,
Name = "polish_tokenizer"
}
}
I've added doucment { Id = "1", Name = "Łódka" } to the index, created based on Product class.
For search query "Lod*" document with id 1 is being returned but search query "Łód*" deosn't return any result. I've checked "polish_analyzer" and for text "Łódka" it returns token "lodka". My second approach was to use EdgeNGramTokenFilterV2, and add it to TokenFilters:
new EdgeNGramTokenFilterV2()
{
MaxGram=300,
MinGram=1,
Name="token_edge"
}
With EdgeNGramTokenFilterV2 I don't have to use '*' and left side match is working fine for both cases "Łód", "Lod" but I don't know if this solution is efficient as analyzer with EdgeNGramTokenFilterV2 token filter produces a lot of tokens.
Does anybody know why left side match is not working in the first case? Or if second approch is efficient?