You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Christopher Gross <co...@gmail.com> on 2010/10/01 20:17:00 UTC

SolrJ - CommonsHttpSolrServer

I have SolrJ working, but it is running slower than I'd like.  The logger
spits out a lot of things that make me feel like I don't have something
configured quite right.  Instead of holding on to the connection, I think
that it closes it each time.  I'd want it to stay open -- I'm trying to do a
clean load of data and I think it would go faster if the connection stayed
alive.

I made a function to create the CommonsHttpSolrServer object, set the
parameters and the parser and set it to the right url, then I use that
object in all of my routines.  I tried to use the SolrServer object in the
wiki, but I need to set the parser and I can't do that unless I set the
HttpClient, but then I'm not using the Solr aspects...right?

Can someone point me to some more in-depth code examples of SolrJ?  Or if
there is a spot that better documents how all this is supposed to work?

Thanks!

Slice of the logfile that I see for every post to Solr:
2010-10-01 14:04:13,171 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.methods.EntityEnclosingMethod - Request body
sent
2010-10-01 14:04:13,296 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.HttpMethodBase - Resorting to protocol version
default close connection policy
2010-10-01 14:04:13,296 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.HttpMethodBase - Should NOT close connection,
using HTTP/1.1
2010-10-01 14:04:13,296 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.HttpConnection - Releasing connection back to
connection manager.
2010-10-01 14:04:13,296 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager - Freeing
connection, hostConfig=HostConfiguration[host=http://localhost:8080]
2010-10-01 14:04:13,296 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.util.IdleConnectionHandler - Adding connection
at: 1285956253296
2010-10-01 14:04:13,296 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager - Notifying
no-one, there are no waiting threads
2010-10-01 14:04:13,296 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.params.DefaultHttpParams - Set parameter
http.protocol.content-charset = UTF-8
2010-10-01 14:04:13,296 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.params.DefaultHttpParams - Set parameter
http.protocol.content-charset = UTF-8
2010-10-01 14:04:13,296 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.params.DefaultHttpParams - Set parameter
http.protocol.content-charset = UTF-8
2010-10-01 14:04:13,296 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.params.DefaultHttpParams - Set parameter
http.protocol.content-charset = UTF-8
2010-10-01 14:04:13,296 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager -
HttpConnectionManager.getConnection:  config = HostConfiguration[host=
http://localhost:8080], timeout = 40000
2010-10-01 14:04:13,296 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager - Getting
free connection, hostConfig=HostConfiguration[host=http://localhost:8080]
2010-10-01 14:04:13,296 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.HttpMethodBase - Adding Host request header
2010-10-01 14:04:13,296 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.methods.EntityEnclosingMethod - Request body
sent
2010-10-01 14:04:14,093 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.HttpMethodBase - Resorting to protocol version
default close connection policy
2010-10-01 14:04:14,093 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.HttpMethodBase - Should NOT close connection,
using HTTP/1.1
2010-10-01 14:04:14,093 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.HttpConnection - Releasing connection back to
connection manager.
2010-10-01 14:04:14,093 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager - Freeing
connection, hostConfig=HostConfiguration[host=http://localhost:8080]
2010-10-01 14:04:14,093 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.util.IdleConnectionHandler - Adding connection
at: 1285956254093
2010-10-01 14:04:14,093 [pool-2-thread-1] DEBUG
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager - Notifying
no-one, there are no waiting threads

-- Chris