无法在hibernate search 6中定义analyzer

mdfafbf1  于 2021-06-29  发布在  Java
关注(0)|答案(0)|浏览(276)

我在HibernateSearch6上定义了一个分析器

public class MyLuceneAnalysisConfigurer implements LuceneAnalysisConfigurer {
    @Override
    public void configure(LuceneAnalysisConfigurationContext context) {
        context.analyzer( "english" ).custom()
                .tokenizer( StandardTokenizerFactory.class )
                .charFilter( HTMLStripCharFilterFactory.class )
                .tokenFilter( LowerCaseFilterFactory.class )
                .tokenFilter( SnowballPorterFilterFactory.class )
                .param( "language", "English" )
                .tokenFilter( ASCIIFoldingFilterFactory.class );
        ;

        context.analyzer( "french" ).custom()
                .tokenizer( StandardTokenizerFactory.class )
                .charFilter( HTMLStripCharFilterFactory.class )
                .tokenFilter( LowerCaseFilterFactory.class )
                .tokenFilter( SnowballPorterFilterFactory.class )
                .param( "language", "French" )
                .tokenFilter( ASCIIFoldingFilterFactory.class );
    }
}

在我把这个加到 application.properties :

hibernate.search.backend.indexes.<Product>.analysis.configurer = com.example.springmvcrest.services.MyLuceneAnalysisConfigurer

但是intellij没有解决这个问题,
运行后:

Analyzer not found org.hibernate.search.util.common.SearchException: HSEARCH000353: Unknown analyzer: 'english'. Make sure you defined this analyzer.

有什么解决办法吗?我使用SpringBoot2.4.0

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题