HttpSolrServer instead.public class CommonsHttpSolrServer extends SolrServer
CommonsHttpSolrServer uses the Apache Commons HTTP Client to connect to solr.
SolrServer server = new CommonsHttpSolrServer( url );
| Modifier and Type | Field and Description |
|---|---|
private boolean |
_allowCompression
Deprecated.
If compression is enabled, both gzip and deflate compression will
be accepted in the HTTP response.
|
protected java.lang.String |
_baseURL
Deprecated.
The URL of the Solr server.
|
private boolean |
_followRedirects
Deprecated.
This defaults to false under the
assumption that if you are following a redirect to get to a Solr
installation, something is misconfigured somewhere.
|
private org.apache.commons.httpclient.HttpClient |
_httpClient
Deprecated.
|
protected ModifiableSolrParams |
_invariantParams
Deprecated.
Default value: null / empty.
|
private int |
_maxRetries
Deprecated.
Maximum number of retries to attempt in the event of transient
errors.
|
protected ResponseParser |
_parser
Deprecated.
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.
|
static java.lang.String |
AGENT
Deprecated.
User-Agent String as identified by the HTTP request by the
HttpClient to the Solr
server from the client. |
private static org.slf4j.Logger |
log
Deprecated.
|
protected RequestWriter |
requestWriter
Deprecated.
The RequestWriter used to write all requests to Solr
|
private static long |
serialVersionUID
Deprecated.
|
private boolean |
useMultiPartPost
Deprecated.
Default value: false
|
| Constructor and Description |
|---|
CommonsHttpSolrServer(java.lang.String solrServerUrl)
Deprecated.
|
CommonsHttpSolrServer(java.lang.String solrServerUrl,
org.apache.commons.httpclient.HttpClient httpClient)
Deprecated.
Talk to the Solr server via the given HttpClient.
|
CommonsHttpSolrServer(java.lang.String solrServerUrl,
org.apache.commons.httpclient.HttpClient httpClient,
boolean useMultiPartPost)
Deprecated.
|
CommonsHttpSolrServer(java.lang.String solrServerUrl,
org.apache.commons.httpclient.HttpClient httpClient,
ResponseParser parser)
Deprecated.
|
CommonsHttpSolrServer(java.net.URL baseURL)
Deprecated.
|
CommonsHttpSolrServer(java.net.URL baseURL,
org.apache.commons.httpclient.HttpClient client)
Deprecated.
|
CommonsHttpSolrServer(java.net.URL baseURL,
org.apache.commons.httpclient.HttpClient client,
boolean useMultiPartPost)
Deprecated.
|
CommonsHttpSolrServer(java.net.URL baseURL,
org.apache.commons.httpclient.HttpClient client,
ResponseParser parser,
boolean useMultiPartPost)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
UpdateResponse |
add(java.util.Iterator<SolrInputDocument> docIterator)
Deprecated.
Adds the documents supplied by the given iterator.
|
UpdateResponse |
add(java.util.Iterator<SolrInputDocument> docIterator,
int commitWithinMs)
Deprecated.
Adds the documents supplied by the given iterator, specifying max time before they become committed
|
UpdateResponse |
addBeans(java.util.Iterator<?> beanIterator)
Deprecated.
Adds the beans supplied by the given iterator
|
UpdateResponse |
addBeans(java.util.Iterator<?> beanIterator,
int commitWithinMs)
Deprecated.
Adds the beans supplied by the given iterator, specifying max time before they become committed
|
java.lang.String |
getBaseURL()
Deprecated.
|
private org.apache.commons.httpclient.HttpConnectionManager |
getConnectionManager()
Deprecated.
|
org.apache.commons.httpclient.HttpClient |
getHttpClient()
Deprecated.
|
ModifiableSolrParams |
getInvariantParams()
Deprecated.
Retrieve the default list of parameters are added to every request regardless.
|
ResponseParser |
getParser()
Deprecated.
|
NamedList<java.lang.Object> |
request(SolrRequest request)
Deprecated.
Process the request.
|
NamedList<java.lang.Object> |
request(SolrRequest request,
ResponseParser processor)
Deprecated.
|
void |
setAllowCompression(boolean allowCompression)
Deprecated.
set allowCompression.
|
void |
setBaseURL(java.lang.String baseURL)
Deprecated.
|
void |
setConnectionManagerTimeout(int timeout)
Deprecated.
|
void |
setConnectionManagerTimeout(long timeout)
Deprecated.
Sets soTimeout (read timeout) on the underlying
HttpConnectionManager.
|
void |
setConnectionTimeout(int timeout)
Deprecated.
set connectionTimeout on the underlying HttpConnectionManager
|
void |
setDefaultMaxConnectionsPerHost(int connections)
Deprecated.
set maxConnectionsPerHost on the underlying HttpConnectionManager
|
void |
setFollowRedirects(boolean followRedirects)
Deprecated.
set followRedirects.
|
void |
setMaxRetries(int maxRetries)
Deprecated.
set maximum number of retries to attempt in the event of
transient errors.
|
void |
setMaxTotalConnections(int connections)
Deprecated.
set maxTotalConnection on the underlying HttpConnectionManager
|
void |
setParser(ResponseParser processor)
Deprecated.
Note: This setter method is not thread-safe.
|
void |
setRequestWriter(RequestWriter requestWriter)
Deprecated.
|
void |
setSoTimeout(int timeout)
Deprecated.
Sets soTimeout (read timeout) on the underlying
HttpConnectionManager.
|
add, add, add, add, addBean, addBean, addBeans, addBeans, commit, commit, deleteById, deleteById, deleteById, deleteById, deleteByQuery, deleteByQuery, getBinder, optimize, optimize, optimize, ping, query, query, rollbackprivate static final long serialVersionUID
public static final java.lang.String AGENT
HttpClient to the Solr
server from the client.private static org.slf4j.Logger log
protected java.lang.String _baseURL
protected ModifiableSolrParams _invariantParams
protected ResponseParser _parser
BinaryResponseParserprotected RequestWriter requestWriter
RequestWriterprivate final org.apache.commons.httpclient.HttpClient _httpClient
private boolean _followRedirects
private boolean _allowCompression
private int _maxRetries
private boolean useMultiPartPost
If set to false, add the query parameters as URL-encoded parameters to the POST request in a single part. If set to true, create a new part of a multi-part request for each parameter. The reason for adding all parameters as parts of a multi-part request is that this allows us to specify the charset -- standards for single-part requests specify that non-ASCII characters should be URL-encoded, but don't specify the charset of the characters to be URL-encoded (cf. http://www.w3.org/TR/html401/interact/forms.html#form-content-type). Therefore you have to rely on your servlet container doing the right thing with single-part requests.
public CommonsHttpSolrServer(java.lang.String solrServerUrl)
throws java.net.MalformedURLException
solrServerUrl - 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.java.net.MalformedURLExceptionpublic CommonsHttpSolrServer(java.lang.String solrServerUrl,
org.apache.commons.httpclient.HttpClient httpClient)
throws java.net.MalformedURLException
java.net.MalformedURLExceptionpublic CommonsHttpSolrServer(java.lang.String solrServerUrl,
org.apache.commons.httpclient.HttpClient httpClient,
boolean useMultiPartPost)
throws java.net.MalformedURLException
java.net.MalformedURLExceptionpublic CommonsHttpSolrServer(java.lang.String solrServerUrl,
org.apache.commons.httpclient.HttpClient httpClient,
ResponseParser parser)
throws java.net.MalformedURLException
java.net.MalformedURLExceptionpublic CommonsHttpSolrServer(java.net.URL 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 CommonsHttpSolrServer(java.net.URL baseURL,
org.apache.commons.httpclient.HttpClient client)
public CommonsHttpSolrServer(java.net.URL baseURL,
org.apache.commons.httpclient.HttpClient client,
boolean useMultiPartPost)
useMultiPartPostpublic CommonsHttpSolrServer(java.net.URL baseURL,
org.apache.commons.httpclient.HttpClient client,
ResponseParser parser,
boolean useMultiPartPost)
useMultiPartPost,
_parserpublic NamedList<java.lang.Object> request(SolrRequest request) throws SolrServerException, java.io.IOException
SolrRequest.getResponseParser() is null, then use
getParser()request in class SolrServerrequest - The SolrRequest to processNamedList resultSolrServerExceptionjava.io.IOExceptionrequest(org.apache.solr.client.solrj.SolrRequest, org.apache.solr.client.solrj.ResponseParser)public NamedList<java.lang.Object> request(SolrRequest request, ResponseParser processor) throws SolrServerException, java.io.IOException
SolrServerExceptionjava.io.IOExceptionpublic ModifiableSolrParams getInvariantParams()
_invariantParamspublic java.lang.String getBaseURL()
public void setBaseURL(java.lang.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.commons.httpclient.HttpClient getHttpClient()
private org.apache.commons.httpclient.HttpConnectionManager getConnectionManager()
public void setConnectionTimeout(int timeout)
timeout - Timeout in milliseconds@Deprecated public void setConnectionManagerTimeout(int timeout)
setConnectionManagerTimeout(long)timeout - Timeout in millisecondspublic void setConnectionManagerTimeout(long timeout)
timeout - Timeout in millisecondspublic void setSoTimeout(int timeout)
timeout - Timeout in millisecondspublic void setDefaultMaxConnectionsPerHost(int connections)
public void setMaxTotalConnections(int connections)
public void setFollowRedirects(boolean followRedirects)
_followRedirectspublic void setAllowCompression(boolean allowCompression)
_allowCompressionpublic void setMaxRetries(int maxRetries)
maxRetries - No more than 1 recommended_maxRetriespublic void setRequestWriter(RequestWriter requestWriter)
public UpdateResponse add(java.util.Iterator<SolrInputDocument> docIterator) throws SolrServerException, java.io.IOException
docIterator - the iterator which returns SolrInputDocument instancesSolrServerExceptionjava.io.IOExceptionpublic UpdateResponse add(java.util.Iterator<SolrInputDocument> docIterator, int commitWithinMs) throws SolrServerException, java.io.IOException
docIterator - the iterator which returns SolrInputDocument instancescommitWithinMs - the time in milliseconds before a commit automatically is triggeredSolrServerExceptionjava.io.IOExceptionpublic UpdateResponse addBeans(java.util.Iterator<?> beanIterator) throws SolrServerException, java.io.IOException
beanIterator - the iterator which returns BeansSolrServerExceptionjava.io.IOExceptionpublic UpdateResponse addBeans(java.util.Iterator<?> beanIterator, int commitWithinMs) throws SolrServerException, java.io.IOException
commitWithinMs - the time in milliseconds before a commit automatically is triggeredbeanIterator - the iterator which returns BeansSolrServerExceptionjava.io.IOException