On 8/13/2011 9:59 AM, Michael Sokolov wrote:
Shawn, my experience with SolrJ in that configuration (no autoCommit)
is that you have control over commits: if you don't issue an explicit
commit, it won't happen. Re lifecycle: we don't use a static
instance; rather our app maintains a small pool of
CommonsHttpSolrServer instances that we re-use across requests. I
think that will be preferable since I don't think the underlying
HttpClient is thread safe?
Hmm, I just checked and actually CommonsHttpSolrServer uses
MultiThreadedHttpConnectionManager so it should be thread-safe, and OK
to use a static instance as per documentation. Sorry for the
misinformation.
Thanks for the help!
I've been able to muddle my way through part of my implementation on my
own. There doesn't seem to be any way to point to the base /solr/ url
and then ask SolrJ to add a core when creating requests. I did see that
you can set the URL for the server object after it's created, but if I
ever make this thing multithreaded, I fear doing so will cause
problems. I'm going with one server object (solrServer) for CoreAdmin
and another object (solrCore) for requests against the core.
This new build system has an object representing one complete index,
which uses a container of seven objects representing each of the
shards. Each of the shard objects has two objects representing a build
core and a live core. Each of the core objects contains the solrServer
and solrCore already mentioned. Since I have two complete indexes, this
means that the final product will initialize 56 server objects.
I couldn't use static server objects as recommended by the docs, because
I have so many instances that all need different URLs. They are private
class members that get created only once, so I think it will be OK. A
static object would be a good idea for a search application, because it
likely only needs to deal with one URL. Our webapp developers told me
that they will be putting the server object into a bean in the
application context.
When I've got everything done and debugged, I will use what I've learned
to augment the SolrJ wiki page. Who is the best community person to
coordinate with on that to make sure I put up good information?
Thanks,
Shawn