private IndexManager createIndexManager(String indexName,
Similarity indexSimilarity,
Properties properties,
WorkerBuildContext workerBuildContext) {
// get hold of the index manager factory via the service manager
ServiceManager serviceManager = workerBuildContext.getServiceManager();
IndexManagerFactory indexManagerFactory = serviceManager.requestService( IndexManagerFactory.class );
// create IndexManager instance via the index manager factory
String indexManagerImplementationName = properties.getProperty( Environment.INDEX_MANAGER_IMPL_NAME );
final IndexManager manager;
try {
if ( StringHelper.isEmpty( indexManagerImplementationName ) ) {
manager = indexManagerFactory.createDefaultIndexManager();
}
else {
manager = indexManagerFactory.createIndexManagerByName( indexManagerImplementationName );
}
}
finally {
serviceManager.releaseService( IndexManagerFactory.class );
}
// init the IndexManager
try {
manager.initialize( indexName, properties, indexSimilarity, workerBuildContext );