Thanks. I know it exists, but don't know how to use it.
I am trying to use EmbeddedSolrServer(Path solrHome, String defaultCoreName)
What should be the "solrHome"? Should it be the actual solr home (i.e.
lucene-solr-master\solr\server\solr) in the solr server, or can it be any
temporary folder?
I create it with: new EmbeddedSolrServer((new File("testdata/solr")).toPath(),
"tmpcore"); and get the following Exception (I use solr-Solr-7.0.0):
org.apache.solr.common.SolrException: Should not have found solr/@persistent
. Please upgrade your solr.xml:
https://cwiki.apache.org/confluence/display/solr/Format+of+solr.xml
at
org.apache.solr.core.SolrXmlConfig.failIfFound(SolrXmlConfig.java:167)
at
org.apache.solr.core.SolrXmlConfig.checkForIllegalConfig(SolrXmlConfig.java:149)
at org.apache.solr.core.SolrXmlConfig.fromConfig(SolrXmlConfig.java:61)
at
org.apache.solr.core.SolrXmlConfig.fromInputStream(SolrXmlConfig.java:129)
at org.apache.solr.core.SolrXmlConfig.fromFile(SolrXmlConfig.java:111)
at
org.apache.solr.core.SolrXmlConfig.fromSolrHome(SolrXmlConfig.java:139)
at
org.apache.solr.core.SolrXmlConfig.fromSolrHome(SolrXmlConfig.java:144)
at
org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.<init>(EmbeddedSolrServer.java:70)
at
com.gossinteractive.solr.DocPhraseUpdateProcessorTest.createEmbeddedSolrServer(DocPhraseUpdateProcessorTest.java:140)
at
com.gossinteractive.solr.DocPhraseUpdateProcessorTest.setUp(DocPhraseUpdateProcessorTest.java:98)
...
-----Original Message-----
From: Shawn Heisey [mailto:[email protected]]
Sent: 08 April 2016 14:35
To: [email protected]
Subject: Re: EmbeddedSolr for unit tests in Solr 6
On 4/8/2016 2:35 AM, Rohana Rajapakse wrote:
> Can someone please tell me how to create a temporary Solr server
> programmatically for the use of Unit Tests? I was using EmbeddedSolrServer in
> Solr 4.x. How do you do thi in Solr 6.x?
EmbeddedSolrServer still exists in 6.x.
There may be *minor* differences in usage -- you are upgrading two major
releases -- but if there are, they shouldn't be too hard to figure out.
https://www.dropbox.com/s/iokyb3wijtaz7xg/embeddedsolrserver.png?dl=0
https://lucene.apache.org/solr/6_0_0/solr-core/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.html
Thanks,
Shawn
Registered Office: 24 Darklake View, Estover, Plymouth, PL6 7TL.
Company Registration No: 3553908
This email contains proprietary information, some or all of which may be
legally privileged. It is for the intended recipient only. If an addressing or
transmission error has misdirected this email, please notify the author by
replying to this email. If you are not the intended recipient you may not use,
disclose, distribute, copy, print or rely on this email.
Email transmission cannot be guaranteed to be secure or error free, as
information may be intercepted, corrupted, lost, destroyed, arrive late or
incomplete or contain viruses. This email and any files attached to it have
been checked with virus detection software before transmission. You should
nonetheless carry out your own virus check before opening any attachment. GOSS
Interactive Ltd accepts no liability for any loss or damage that may be caused
by software viruses.