based on some help here in stack overflow I managed to create a custom analyzer, but still cant work around search where a word has an accent.
public class CustomAnalyzer : Analyzer
{
LuceneVersion matchVersion;
public CustomAnalyzer(LuceneVersion p_matchVersion) : base()
{
matchVersion = p_matchVersion;
}
protected override TokenStreamComponents CreateComponents(string fieldName, TextReader reader)
{
Tokenizer tokenizer = new KeywordTokenizer(reader);
TokenStream result = new StopFilter(matchVersion, tokenizer, StopAnalyzer.ENGLISH_STOP_WORDS_SET);
result = new LowerCaseFilter(matchVersion, result);
result = new StandardFilter(matchVersion, result);
result = new ASCIIFoldingFilter(result);
return new TokenStreamComponents(tokenizer, result);
}
}
The idea is to be able to search for "perez" and also find "Pérez". Using that analyzer I recreated the index and searched but still no results for words with accent.
As LuceneVersion I'm using LuceneVersion.LUCENE_48
Any help would be greatly appreciated. Thanks!