Class EmbeddedSolrServer
- java.lang.Object
-
- org.apache.solr.client.solrj.SolrClient
-
- org.apache.solr.client.solrj.embedded.EmbeddedSolrServer
-
- All Implemented Interfaces:
Closeable
,Serializable
,AutoCloseable
public class EmbeddedSolrServer extends org.apache.solr.client.solrj.SolrClient
SolrClient that connects directly to a CoreContainer.- Since:
- solr 1.3
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EmbeddedSolrServer.RequestWriterSupplier
-
Field Summary
Fields Modifier and Type Field Description protected CoreContainer
coreContainer
protected String
coreName
-
Constructor Summary
Constructors Constructor Description EmbeddedSolrServer(Path solrHome, String defaultCoreName)
Create an EmbeddedSolrServer using a given solr home directoryEmbeddedSolrServer(CoreContainer coreContainer, String coreName)
Create an EmbeddedSolrServer wrapping a CoreContainer.EmbeddedSolrServer(CoreContainer coreContainer, String coreName, EmbeddedSolrServer.RequestWriterSupplier supplier)
Create an EmbeddedSolrServer wrapping a CoreContainer.EmbeddedSolrServer(NodeConfig nodeConfig, String defaultCoreName)
Create an EmbeddedSolrServer using a NodeConfigEmbeddedSolrServer(SolrCore core)
Create an EmbeddedSolrServer wrapping a particular SolrCore
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes any resources created by this instanceCoreContainer
getCoreContainer()
Getter method for the CoreContainerorg.apache.solr.common.util.NamedList<Object>
request(org.apache.solr.client.solrj.SolrRequest<?> request, String coreName)
-
Methods inherited from class org.apache.solr.client.solrj.SolrClient
add, add, add, add, add, add, add, add, add, add, addBean, addBean, addBean, addBean, addBeans, addBeans, addBeans, addBeans, addBeans, addBeans, commit, commit, commit, commit, commit, commit, deleteById, deleteById, deleteById, deleteById, deleteById, deleteById, deleteById, deleteById, deleteByQuery, deleteByQuery, deleteByQuery, deleteByQuery, getBinder, getById, getById, getById, getById, getById, getById, getById, getById, getContext, getDefaultCollection, optimize, optimize, optimize, optimize, optimize, optimize, ping, ping, query, query, query, query, queryAndStreamResponse, queryAndStreamResponse, queryAndStreamResponse, request, rollback, rollback
-
-
-
-
Field Detail
-
coreContainer
protected final CoreContainer coreContainer
-
coreName
protected final String coreName
-
-
Constructor Detail
-
EmbeddedSolrServer
public EmbeddedSolrServer(Path solrHome, String defaultCoreName)
Create an EmbeddedSolrServer using a given solr home directory- Parameters:
solrHome
- the solr home directorydefaultCoreName
- the core to route requests to by default (optional)
-
EmbeddedSolrServer
public EmbeddedSolrServer(NodeConfig nodeConfig, String defaultCoreName)
Create an EmbeddedSolrServer using a NodeConfig- Parameters:
nodeConfig
- the configurationdefaultCoreName
- the core to route requests to by default (optional)
-
EmbeddedSolrServer
public EmbeddedSolrServer(SolrCore core)
Create an EmbeddedSolrServer wrapping a particular SolrCore
-
EmbeddedSolrServer
public EmbeddedSolrServer(CoreContainer coreContainer, String coreName)
Create an EmbeddedSolrServer wrapping a CoreContainer.- Parameters:
coreContainer
- the core containercoreName
- the core to route requests to by default (optional)
-
EmbeddedSolrServer
public EmbeddedSolrServer(CoreContainer coreContainer, String coreName, EmbeddedSolrServer.RequestWriterSupplier supplier)
Create an EmbeddedSolrServer wrapping a CoreContainer.- Parameters:
coreContainer
- the core containercoreName
- the core to route requests to by defaultsupplier
- the supplier used to create aRequestWriter
-
-
Method Detail
-
request
public org.apache.solr.common.util.NamedList<Object> request(org.apache.solr.client.solrj.SolrRequest<?> request, String coreName) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Specified by:
request
in classorg.apache.solr.client.solrj.SolrClient
- Throws:
org.apache.solr.client.solrj.SolrServerException
IOException
-
close
public void close() throws IOException
Closes any resources created by this instance- Throws:
IOException
-
getCoreContainer
public CoreContainer getCoreContainer()
Getter method for the CoreContainer- Returns:
- the core container
-
-