I have a spring boot application where I am embedding a solr server. I seem to be forced right now to name my solr core as "collection1" so that my code indeed finds the core to load
anyone know how I can make this arbitrary ?
@Configuration
@EnableSolrRepositories(basePackages = ["uk.xxx"], multicoreSupport = true)
class SolrContext {
static final String SOLR_HOST = 'solr.host'
static final String SOLR_EMBEDDED_PATH = 'solr.embedded.path'
@Resource
Environment environment
@Bean
public SolrServer solrServer() {
EmbeddedSolrServerFactory factory = new EmbeddedSolrServerFactory(environment.getRequiredProperty(SOLR_EMBEDDED_PATH))
return factory.getSolrServer()
}
@Bean
public SolrOperations solrTemplate() {
return new SolrTemplate(solrServer())
}
}
tried like you said, still no good, I named my core 'coursefinder', and passed that in like you said but its still looking for colelction1 :
@Bean
public SolrServer solrServer() {
println "starting embedded solr index"
EmbeddedSolrServerFactory factory = new EmbeddedSolrServerFactory(grailsApplication.config.getProperty('solr.embedded.path'))
return factory.getSolrServer("coursefinder")
}
}
output
starting embedded solr index
ERROR org.apache.solr.core.CoreContainer - Error creating core [collection1]: Could not load conf for core collection1: Error loading solr config from /Developer/dev/LSE/coursefinder-grails-angular/embeddedsolr/collection1/conf/solrconfig.xml
org.apache.solr.common.SolrException: Could not load conf for core collection1: Error loading solr config from /Developer/dev/LSE/coursefinder-grails-angular/embeddedsolr/collection1/conf/solrconfig.xml
at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:66)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:489)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:255)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:249)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)`