Example usage for org.apache.solr.client.solrj.impl CloudSolrClient setParser

List of usage examples for org.apache.solr.client.solrj.impl CloudSolrClient setParser

Introduction

In this page you can find the example usage for org.apache.solr.client.solrj.impl CloudSolrClient setParser.

Prototype

public void setParser(ResponseParser processor) 

Source Link

Document

Note: This setter method is not thread-safe.

Usage

From source file:org.wso2.extension.siddhi.store.solr.impl.SolrClientServiceImpl.java

License:Open Source License

private void initSolrClientForTable(CollectionConfiguration config) throws SolrClientServiceException {
    synchronized (this) {
        String serverURL = config.getSolrServerUrl();
        if (serverURL == null || serverURL.isEmpty()) {
            throw new SolrClientServiceException("Solr server URL for collection: " + config.getCollectionName()
                    + " cannot be empty or null");
        }//from  ww w . ja  v a  2  s .  c  om
        tableToConfigMapping.put(config.getCollectionName(), config);
        CloudSolrClient solrClient = new CloudSolrClient.Builder().withZkHost(config.getSolrServerUrl())
                .build();
        solrClient.setParser(new XMLResponseParser());
        urlToSolrClientMapping.put(config.getSolrServerUrl(),
                new SiddhiSolrClient(config.getDomainName(), solrClient));
        Integer count = urlToTableCountMapping.get(config.getSolrServerUrl());
        if (count == null) {
            urlToTableCountMapping.put(config.getSolrServerUrl(), Integer.valueOf(1));
        } else {
            urlToTableCountMapping.put(config.getSolrServerUrl(), count + 1);
        }
    }
}