GlobalComponentRegistry globalComponentRegistry = cr.getGlobalComponentRegistry();
EmbeddedCacheManager uninitializedCacheManager = globalComponentRegistry.getComponent(EmbeddedCacheManager.class);
indexingProperties = addMappingsForRemoteQuery(indexingProperties, cr, cl);
// Set up the search factory for Hibernate Search first.
SearchConfiguration config = new SearchableCacheConfiguration(new Class[0], indexingProperties, uninitializedCacheManager, cr);
searchFactory = new SearchFactoryBuilder().configuration(config).buildSearchFactory();
cr.registerComponent(searchFactory, SearchFactoryIntegrator.class);
}
return searchFactory;
}