- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Using spring-data-solr to Query Indexed Data on CDH 5.10
- Labels:
-
Apache Solr
-
Cloudera Search
Created on ‎04-13-2017 06:32 AM - edited ‎09-16-2022 04:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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.
Created ‎04-18-2017 06:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
By adding the annotation to my model(document) the problem was resolved.
@SolrDocument(solrCoreName = "party_name")
public class PartyName {
....
}
Created ‎04-18-2017 06:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
By adding the annotation to my model(document) the problem was resolved.
@SolrDocument(solrCoreName = "party_name")
public class PartyName {
....
}
