use of org.alfresco.repo.index.shard.ShardInstance in project alfresco-repository by Alfresco.
the class SolrClientUtil method extractMapping.
public static SolrStoreMappingWrapper extractMapping(StoreRef store, HashMap<StoreRef, SolrStoreMappingWrapper> mappingLookup, ShardRegistry shardRegistry, boolean useDynamicShardRegistration, BeanFactory beanFactory) {
if ((shardRegistry != null) && useDynamicShardRegistration) {
SearchParameters sp = new SearchParameters();
sp.addStore(store);
List<ShardInstance> slice = shardRegistry.getIndexSlice(sp);
if ((slice == null) || (slice.size() == 0)) {
logger.error("No available shards for solr query of store " + store + " - trying non-dynamic configuration");
SolrStoreMappingWrapper mappings = mappingLookup.get(store);
if (mappings == null) {
throw new LuceneQueryParserException("No solr query support for store " + store);
}
return mappings;
}
return DynamicSolrStoreMappingWrapperFactory.wrap(slice, beanFactory);
} else {
SolrStoreMappingWrapper mappings = mappingLookup.get(store);
if (mappings == null) {
throw new LuceneQueryParserException("No solr query support for store " + store);
}
return mappings;
}
}
Aggregations