Package org.apache.solr.servlet
Class DirectSolrConnection
- java.lang.Object
-
- org.apache.solr.servlet.DirectSolrConnection
-
public class DirectSolrConnection extends Object
DirectSolrConnection provides an interface to Solr that is similar to the the HTTP interface, but does not require an HTTP connection. This class is designed to be as simple as possible and allow for more flexibility in how you interface to Solr.- Since:
- solr 1.2
-
-
Field Summary
Fields Modifier and Type Field Description protected SolrCore
core
protected SolrRequestParsers
parser
-
Constructor Summary
Constructors Constructor Description DirectSolrConnection(SolrCore c)
Initialize using an explicit SolrCore
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Use this method to close the underlying SolrCore.String
request(String pathAndParams, String body)
For example: String json = solr.request( "/select?qt=dismax&wt=json&q=...", null ); String xml = solr.request( "/select?qt=dismax&wt=xml&q=...", null ); String xml = solr.request( "/update", "<add><doc><field ..." );String
request(String path, SolrParams params, String body)
String
request(SolrRequestHandler handler, SolrParams params, String body)
-
-
-
Field Detail
-
core
protected final SolrCore core
-
parser
protected final SolrRequestParsers parser
-
-
Constructor Detail
-
DirectSolrConnection
public DirectSolrConnection(SolrCore c)
Initialize using an explicit SolrCore
-
-
Method Detail
-
request
public String request(String pathAndParams, String body) throws Exception
For example: String json = solr.request( "/select?qt=dismax&wt=json&q=...", null ); String xml = solr.request( "/select?qt=dismax&wt=xml&q=...", null ); String xml = solr.request( "/update", "<add><doc><field ..." );- Throws:
Exception
-
request
public String request(String path, SolrParams params, String body) throws Exception
- Throws:
Exception
-
request
public String request(SolrRequestHandler handler, SolrParams params, String body) throws Exception
- Throws:
Exception
-
close
public void close()
Use this method to close the underlying SolrCore.- Since:
- solr 1.3
-
-