问题
I have two questions regarding handling German umlauts in Lucene:
I'm trying to find a way to convert German Umlauts written as 'ue', 'ae', etc to folded form 'u', 'a' and so on. This is done by GermanAnalyzer (and German2StemFilter used by it), but unfortunately it also does stemming which is very undesired in my case. Is there any other filter that can do only the 'ue' -> 'u' conversion?
Is there any filter that does 'ü' -> 'ue' (NOT 'u' like ASCIIFoldingFilter does) conversion? What I'm trying to achieve is that word "über" should be found in the index whenever the user searches for " über" or "ueber" , but NOT "uber".
回答1:
german2's algorithm but without the stemming:
https://lucene.apache.org/core/4_0_0/analyzers-common/org/apache/lucene/analysis/de/GermanNormalizationFilter.html
回答2:
you can use MappingCharFilterFactory and provide your own mapping file where you can choose to do whatever you want, like 'ü' -> 'ue'
来源:https://stackoverflow.com/questions/13451276/german-ue-u-conversion-in-lucene