I am using spring-data-solr to query indexed solr data running on a Cloudera Hadoop cluser(CDH5.10) . The name of my collection is party_name. Below is the code I used to configure the Cloud client:
@Configuration @EnableSolrRepositories(basePackages = { "org.nccourts.repository" }, multicoreSupport = true) public class SpringSolrConfig {
@Value("${spring.data.solr.zk-host}")
private String zkHost;
@Bean
public SolrClient solrClient() {
return new CloudSolrClient(zkHost);
}
@Bean
public SolrTemplate solrTemplate(CloudSolrClient solrClient) throws Exception {
solrClient.setDefaultCollection("party_name");
return new SolrTemplate(solrClient);
}
}
When I run my junit test, I am getting the following exception: org.springframework.data.solr.UncategorizedSolrException: Collection not found: partyname; nested exception is org.apache.solr.common.SolrException: Collection not found: partyname at org.springframework.data.solr.core.SolrTemplate.execute(SolrTemplate.java:215)
at org.springframework.data.solr.core.SolrTemplate.executeSolrQuery(SolrTemplate.java:1030)Note the Collection not found: partyname, but the collection name I entered is party_name.
I am using springboot version 1.5.2 with the following dependency: compile('org.springframework.boot:spring-boot-starter-data-solr')
Any help or pointers are appreciated.