I am tring to start the Solr Server in beforeALL method but it is giving collection not found error.
Here is the code snippet
var server: EmbeddedSolrServer = _
override def beforeAll() {
val container = new CoreContainer("testConf")
container.load()
server = new EmbeddedSolrServer(container, "collection1")
}
test("") {
val param = new ModifiableSolrParams()
param.set("q", "search")
server.getCoreContainer.load()
println(server.query(param).getResults.get(0).getFirstValue("title").toString)
assert(true)
}
override def afterAll(): Unit = {
server.close()
}
i am following step from https://wiki.searchtechnologies.com/index.php/Unit_Testing_with_Embedded_Solr
Here is the error stack
org.apache.solr.common.SolrException: No such core: collection1 at org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:149) at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:149) at org.apache.solr.client.solrj.SolrClient.query(SolrClient.java:942) at org.apache.solr.client.solrj.SolrClient.query(SolrClient.java:957)
Any help will be appretiacted
Inside directory called "collection1", you have to insert a core.properties
file in which you write the follow property: name=collection1
.
Without this file, you get the SolrException.