How to ignore accents in SOLR search?

2019-07-29 00:11发布

问题:

For search keyword like "mäcman" in solr 6.5. I want to search ignoring accent character as "macman". When user search with "mäcman", it is giving resut. But when user search with "macman" it is not giving any result. I changed in config file, solr/core_name/conf/managed-schema like below configuration.

Try 1: I included mapping-FoldToASCII.txt file in path solr/core_name/conf/

<fieldType name="string_ci" class="solr.TextField" >
    <analyzer type="index">
    <charFilter class="solr.MappingCharFilterFactory" mapping="mapping-FoldToASCII.txt"/>
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.ASCIIFoldingFilterFactory" />
    </analyzer>
    <analyzer type="query">
    <charFilter class="solr.MappingCharFilterFactory" mapping="mapping-FoldToASCII.txt"/>
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.ASCIIFoldingFilterFactory" />
    </analyzer>
</fieldType>

Try 2:

<fieldType name="string_ci" class="solr.TextField">
    <analyzer type="index">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.ASCIIFoldingFilterFactory" />
    </analyzer>
    <analyzer type="query">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.ASCIIFoldingFilterFactory" />
    </analyzer>
</fieldType>

Both scenario does not works to search keyword in solr without accent character. Please describe cause of this issue. Thanks.

analysis screenshot

accent search screenshot