Issue
I define an analyzer on hibernate search 6
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 );
}
}
After I add this to application.properties
:
hibernate.search.backend.indexes.<Product>.analysis.configurer = com.example.springmvcrest.services.MyLuceneAnalysisConfigurer
but its not resolved by IntelliJ,
and after running:
Analyzer not found org.hibernate.search.util.common.SearchException: HSEARCH000353: Unknown analyzer: 'english'. Make sure you defined this analyzer.
Any solution? I use spring boot 2.4.0
Solution
The following should work:
In your application.properties
, change this
hibernate.search.backend.indexes.<Product>.analysis.configurer
to:
hibernate.search.backend.analysis.configurer
In summary:
spring.jpa.properties.hibernate.search.backend.analysis.configurer=com.example.springmvcrest.services.MyLuceneAnalysisConfigurer
Source: Hibernate Search 6.0.1.Final: Reference Documentation
Answered By - manu
Answer Checked By - Timothy Miller (JavaFixing Admin)