|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.solr.client.solrj.SolrServer
org.apache.solr.client.solrj.impl.HttpSolrServer
public class HttpSolrServer
| Field Summary | |
|---|---|
static String |
AGENT
User-Agent String. |
protected String |
baseUrl
The URL of the Solr server. |
protected ModifiableSolrParams |
invariantParams
Default value: null / empty. |
protected ResponseParser |
parser
Default response parser is BinaryResponseParser This parser represents the default Response Parser chosen to parse the response if the parser were not specified as part of the request. |
protected RequestWriter |
requestWriter
The RequestWriter used to write all requests to Solr |
| Constructor Summary | |
|---|---|
HttpSolrServer(String baseURL)
|
|
HttpSolrServer(String baseURL,
org.apache.http.client.HttpClient client)
|
|
HttpSolrServer(String baseURL,
org.apache.http.client.HttpClient client,
ResponseParser parser)
|
|
| Method Summary | |
|---|---|
UpdateResponse |
add(Iterator<SolrInputDocument> docIterator)
Adds the documents supplied by the given iterator. |
UpdateResponse |
addBeans(Iterator<?> beanIterator)
Adds the beans supplied by the given iterator. |
String |
getBaseURL()
|
org.apache.http.client.HttpClient |
getHttpClient()
Return the HttpClient this instance uses. |
ModifiableSolrParams |
getInvariantParams()
Retrieve the default list of parameters are added to every request regardless. |
ResponseParser |
getParser()
|
NamedList<Object> |
request(SolrRequest request)
Process the request. |
NamedList<Object> |
request(SolrRequest request,
ResponseParser processor)
|
void |
setAllowCompression(boolean allowCompression)
Allow server->client communication to be compressed. |
void |
setBaseURL(String baseURL)
|
void |
setConnectionTimeout(int timeout)
HttpConnectionParams.setConnectionTimeout |
void |
setDefaultMaxConnectionsPerHost(int max)
Set the maximum number of connections that can be open to a single host at any given time. |
void |
setFollowRedirects(boolean followRedirects)
Configure whether the client should follow redirects or not. |
void |
setMaxRetries(int maxRetries)
Set maximum number of retries to attempt in the event of transient errors. |
void |
setMaxTotalConnections(int max)
Set the maximum number of connections that can be open at any given time. |
void |
setParser(ResponseParser processor)
Note: This setter method is not thread-safe. |
void |
setRequestWriter(RequestWriter requestWriter)
|
void |
setSoTimeout(int timeout)
Set SoTimeout (read timeout). |
void |
shutdown()
Close the ClientConnectionManager from the internal client. |
| Methods inherited from class org.apache.solr.client.solrj.SolrServer |
|---|
add, add, add, add, addBean, addBean, addBeans, addBeans, commit, commit, commit, deleteById, deleteById, deleteById, deleteById, deleteByQuery, deleteByQuery, getBinder, optimize, optimize, optimize, ping, query, query, queryAndStreamResponse, rollback |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String AGENT
protected String baseUrl
protected ModifiableSolrParams invariantParams
protected ResponseParser parser
BinaryResponseParserprotected RequestWriter requestWriter
RequestWriter| Constructor Detail |
|---|
public HttpSolrServer(String baseURL)
baseURL - The URL of the Solr server. For example, "
http://localhost:8983/solr/" if you are using the
standard distribution Solr webapp on your local machine.
public HttpSolrServer(String baseURL,
org.apache.http.client.HttpClient client)
public HttpSolrServer(String baseURL,
org.apache.http.client.HttpClient client,
ResponseParser parser)
| Method Detail |
|---|
public NamedList<Object> request(SolrRequest request)
throws SolrServerException,
IOException
SolrRequest.getResponseParser() is
null, then use getParser()
request in class SolrServerrequest - The SolrRequest to process
NamedList result
IOException - If there is a low-level I/O error.
SolrServerExceptionrequest(org.apache.solr.client.solrj.SolrRequest,
org.apache.solr.client.solrj.ResponseParser)
public NamedList<Object> request(SolrRequest request,
ResponseParser processor)
throws SolrServerException,
IOException
SolrServerException
IOExceptionpublic ModifiableSolrParams getInvariantParams()
invariantParamspublic String getBaseURL()
public void setBaseURL(String baseURL)
public ResponseParser getParser()
public void setParser(ResponseParser processor)
processor - Default Response Parser chosen to parse the response if the parser
were not specified as part of the request.SolrRequest.getResponseParser()public org.apache.http.client.HttpClient getHttpClient()
public void setConnectionTimeout(int timeout)
timeout - Timeout in millisecondspublic void setSoTimeout(int timeout)
timeout - Timeout in millisecondspublic void setFollowRedirects(boolean followRedirects)
This defaults to false under the assumption that if you are following a redirect to get to a Solr installation, something is misconfigured somewhere.
public void setAllowCompression(boolean allowCompression)
public void setMaxRetries(int maxRetries)
Maximum number of retries to attempt in the event of transient errors. Default: 0 (no) retries. No more than 1 recommended.
maxRetries - No more than 1 recommendedpublic void setRequestWriter(RequestWriter requestWriter)
public UpdateResponse add(Iterator<SolrInputDocument> docIterator)
throws SolrServerException,
IOException
docIterator - the iterator which returns SolrInputDocument instances
SolrServerException
IOException
public UpdateResponse addBeans(Iterator<?> beanIterator)
throws SolrServerException,
IOException
beanIterator - the iterator which returns Beans
SolrServerException
IOExceptionpublic void shutdown()
ClientConnectionManager from the internal client.
shutdown in class SolrServerpublic void setDefaultMaxConnectionsPerHost(int max)
public void setMaxTotalConnections(int max)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||