Hi,
I guess it's easier then to not pass the mapping instance but the mapping-factory class name;
see this test for a quick example:
org.hibernate.search.test.configuration.ProgrammaticMappingTest line 707
Code:
cfg.getProperties().put( Environment.MODEL_MAPPING, ProgrammaticSearchMappingFactory.class.getName() );
or translated into a standard configuration property:
Code:
hibernate.search.model_mapping=org.hibernate.search.test.configuration.ProgrammaticSearchMappingFactory
which has the effect to plugin your custom code to define the mapping:
Code:
public class ProgrammaticSearchMappingFactory {
@Factory
public SearchMapping build() {
SearchMapping mapping = new SearchMapping();
mapping.fullTextFilterDef("security", SecurityFilter ...
...
Note the org.hibernate.search.annotations.Factory annotation to define which method should be used to build the programmatic configuration
I just noticed the property key changed from the blogpost, editing the post and fixing docs: use the org.hibernate.search.Environment.MODEL_MAPPING constant to make sure.