I am using spring-data-solr
to query indexed Solr data running on a Hadoop cluser. 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 Spring Boot version 1.5.2 with the following dependency:
compile('org.springframework.boot:spring-boot-starter-data-solr')
Any help or pointers are appreciated.