Hello Zdenek,
Thank you for your reply. My custom analyzer currently looks like this:
public class SearchSynonymAnalyzer : SubSetAnalyzer
{
/// <summary>
/// Token stream.
/// </summary>
/// <param name="fieldName">Field name</param>
/// <param name="reader">Text reader</param>
public override TokenStream TokenStream(string fieldName, TextReader reader)
{
TokenStream result = new WhitespaceTokenizer(reader);
result = new StandardFilter(result);
result = new LowerCaseFilter(result);
result = new StopFilter(result, StopAnalyzer.ENGLISH_STOP_WORDS);
return new SynonymTokenizer(result);
}
/// <summary>
/// Construct a new SearchSynonymAnalyzer.
/// </summary>
public SearchSynonymAnalyzer(Boolean isSearch, Boolean startsWith, int minimalLength)
: base(isSearch, startsWith, minimalLength)
{
}
}
The SynonymTokenizer class is where I insert the synonyms.
For my document type, the search fields are defined as follows:
Title field: DocumentName
Content field: DocumentContent
Image field: (none)
Date field: DocumentCreatedWhen
Inserting synonyms works, but unfortunately at the cost of not being able to search for subsets anymore. Should I apply some additional filtering in the TokenStream method?
Regards,
Martijn