Search in sources :

Example 1 with ShardInstance

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;
    }
}
Also used : BasicSearchParameters(org.alfresco.service.cmr.search.BasicSearchParameters) SearchParameters(org.alfresco.service.cmr.search.SearchParameters) LuceneQueryParserException(org.alfresco.repo.search.impl.lucene.LuceneQueryParserException) ShardInstance(org.alfresco.repo.index.shard.ShardInstance)

Aggregations

ShardInstance (org.alfresco.repo.index.shard.ShardInstance)1 LuceneQueryParserException (org.alfresco.repo.search.impl.lucene.LuceneQueryParserException)1 BasicSearchParameters (org.alfresco.service.cmr.search.BasicSearchParameters)1 SearchParameters (org.alfresco.service.cmr.search.SearchParameters)1