@Factory public SearchMapping build() { SearchMapping mapping = new SearchMapping(); mapping .analyzerDef( "ngram", StandardTokenizerFactory.class ) .filter( LowerCaseFilterFactory.class ) .filter( StopFilterFactory.class ) .param( "words", "non-existent-resourcename.file" ) // We must mark at least one entity as indexed, otherwise analyzer definitions are not initialized (no need to) .entity( SomeHibernateEntity.class ).indexed(); return mapping; }
@Factory public SearchMapping create() { SearchMapping searchMapping = new SearchMapping(); searchMapping.analyzerDef( "english", StandardTokenizerFactory.class ) .filter( LowerCaseFilterFactory.class ) .filter( SnowballPorterFilterFactory.class ) .analyzerDef( "english", StandardTokenizerFactory.class ) // ups duplicate name here - this should throw an exception .filter( LowerCaseFilterFactory.class ) .filter( GermanStemFilterFactory.class ) .entity( BlogEntry.class ) .indexed() .property( "title", ElementType.METHOD ); return searchMapping; } }
.entity( Address.class ) .indexed() .boost( 2 )